Giter Site home page Giter Site logo

Comments (11)

Gagaro avatar Gagaro commented on July 17, 2024

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.

kinganu avatar kinganu commented on July 17, 2024

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

safedelview

from django-safedelete.

Gagaro avatar Gagaro commented on July 17, 2024

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.

kinganu avatar kinganu commented on July 17, 2024

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.

Gagaro avatar Gagaro commented on July 17, 2024

Did you run a makemigrations/migrate before?

from django-safedelete.

kinganu avatar kinganu commented on July 17, 2024

yeah probably. whenever I edit or make a model i run those. not sure why safedelete is preventing a flush

from django-safedelete.

mordonez-me avatar mordonez-me commented on July 17, 2024

I have the same problem, was this fixed?

from django-safedelete.

Gagaro avatar Gagaro commented on July 17, 2024

The problem with the admin or the flush?

from django-safedelete.

mordonez-me avatar mordonez-me commented on July 17, 2024

With the flash @Gagaro, I am getting the same error with safedelete_safedeletemixin.

from django-safedelete.

MattFisher avatar MattFisher commented on July 17, 2024

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.

Gagaro avatar Gagaro commented on July 17, 2024

Should be fixed in 0.4.3

from django-safedelete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.