Comments (11)
Hi, thanks for the fixes.
Your issue will be fixed in the next release of django-safedelete, wich will be as soon as #77 is merged.
Also in your app, you have:
proj_delete = get_object_or_404(Project, pk=id).delete()
serv_delete = get_object_or_404(Service, pk=id).delete()
You shouldn't have the same id for two objects. Your view should take two parameters, one for each id (unless project and service are linked, in which case you should get the object the id is linked to and delete the other object from that one).
from django-safedelete.
yeah I revamped that and got my delete objects process working with a generic deleteview. current set up: https://dpaste.de/i7tE. still have trouble dealing with permissions and not sure how i could use something like django-guardian admin views in conjunction with safedelete (prob not). there is an issue in the query set I have using your package with [:20] at the end of it. not sure why. also, Id like to be able to delete a users 'safedeleted' objects that they delete, from within the admin, as super user. but with the policy safedelete cant do that. delete objects stay there. maybe i need to try other policies. should be a filter for not deleted, so view isnt cluttered up with deleted junk (testing :)). finally deleted items should be in red, and safedelete adds a redundant name listview thats duplicating my models returned listview here:
return str ....etc
from django-safedelete.
highlight_deleted
is actually just __str__
with a striked red markup if deleted.
It works in my test app, what version of Django/safedelete do you have?
from django-safedelete.
latest django 1.11, and pip installed safedelete. I got it figured out for the most part, its pretty smooth, few small quirks that I can live with. I just change the policy to HARD_DELETE if i need to delete testing junk. My main qualm is, I cannot run 'python manage.py flush' with safedelete wrapping my models, to clear out testing data and start fresh. heres the errors I get:
CommandError: Database djang0 couldn't be flushed. Possible reasons:
- The database isn't running or isn't configured correctly.
- At least one of the expected database tables doesn't exist.
- The SQL was invalid.
Hint: Look at the output of 'django-admin sqlflush'. That's the SQL this command wasn't able to run.
The full error: relation "safedelete_safedeletemixin" does not exist
(venv)john1@j1vm/var/www/djang0/djang0$ python manage.py sqlflush
BEGIN;
TRUNCATE "auth_permission", "dashboard_service_service_type", "dashboard_service", "auth_group", "auth_user_user_permissions", "auth_user_groups", "dashboard_editcontent", "blog_post", "auth_group_permissions", "django_session", "dashboard_project", "dashboard_project_website_type", "dashboard_servicetype", "django_admin_log", "dashboard_websitetype", "auth_user", "django_content_type";
SELECT setval(pg_get_serial_sequence('"blog_post"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"dashboard_project"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"dashboard_websitetype"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"dashboard_editcontent"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"dashboard_service"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"dashboard_servicetype"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"django_admin_log"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"auth_permission"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"auth_group"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"auth_user"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"django_content_type"','id'), 1, false);
SELECT setval(pg_get_serial_sequence('"safedelete_safedeletemixin"','id'), 1, false);
COMMIT;
from django-safedelete.
Did you run a makemigrations/migrate before?
from django-safedelete.
yeah probably. whenever I edit or make a model i run those. not sure why safedelete is preventing a flush
from django-safedelete.
I have the same problem, was this fixed?
from django-safedelete.
The problem with the admin or the flush?
from django-safedelete.
With the flash @Gagaro, I am getting the same error with safedelete_safedeletemixin.
from django-safedelete.
I'm seeing a related error - after running migrate I'm trying to dumpdata but get the error:
CommandError: Unable to serialize database: relation "safedelete_safedeletemixin" does not exist`
LINE 1: ..."id", "safedelete_safedeletemixin"."deleted" FROM "safedelet...
^
Using Django 1.9.13 and safedelete 0.4.2
Note I found a workaround by passing --exclude safedelete
from django-safedelete.
Should be fixed in 0.4.3
from django-safedelete.
Related Issues (20)
- Safe delete does not work as expected with OneToOneField HOT 2
- TypeError: cannot unpack non-iterable NoneType object HOT 3
- add type annotation HOT 3
- SafeDeleteQuery AttributeError on _safedelete_visibility and _safedelete_visibility_field HOT 8
- Setting highlight_deleted_field.short_description mistakenly affects all subclasses of SafeDeleteAdmin HOT 1
- Behaviour of SOFT_DELETE on an object with a PROTECTED relationship to another SOFT_DELETED object HOT 1
- Django 4.2 support HOT 1
- Soft delete model object and cascading delete all related objects which are not instance of SafeDeleteModel HOT 2
- deleted_objects is not documented anywhere HOT 2
- Fields uniqueness with MySQL HOT 2
- delete method hangs on raise ProtectedError, when a lot of related protected objects HOT 1
- HARD_DELETE in SafeDeleteQueryset bypasses custom delete logic HOT 1
- Infinite recursive loop with SafeDeleteQueryset HOT 2
- Is it possible to set _safedelete_visibility without having to define a Manager? HOT 1
- cannot unpack non-iterable NoneType object with `SOFT_DELETE_CASCADE` HOT 17
- get_queryset filteration for related models
- If using django-simple-history, is this needed? HOT 2
- How can I use SafeDeleteQueryset and SafeDeleteManager at the same time?
- pkg_resources deprecation warning HOT 1
- Custom UniqueConstraint do not works with OneToOneField HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-safedelete.