Re: Mark as deleted instead of actually deleting in DeleteView

2017-09-21 Thread James Schneider
On Sep 21, 2017 2:39 AM, "Rakhee Menon"  wrote:

Hello Everyone ,
Can anyone tell me how to write views where, when clicked  on delete button
the data shouldn't get deleted only the flag should turn 0

Just use a standard update view that toggles the field that you are using
for the object status. You can make the buttons on the form say whatever
you'd like.

I would also recommend overriding the default model manager to
automatically exclude objects that have been "deleted" if that makes sense
for your project. Otherwise you'll need to remember to exclude those
deleted objects manually everywhere.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUeGBBavZGBdKcRu_Kssk47Rkwp2q%2BsUTKydXk3iMepeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mark as deleted instead of actually deleting in DeleteView

2017-09-21 Thread Fabio C. Barrionuevo da Luz
try use : SoftDeletableModel and SoftDeletableManager of django-model-utils

https://django-model-utils.readthedocs.io/en/latest/models.html#softdeletablemodel
https://django-model-utils.readthedocs.io/en/latest/managers.html#softdeletablemanager

https://github.com/jazzband/django-model-utils/blob/master/model_utils/models.py#L113-L136
https://github.com/jazzband/django-model-utils/blob/master/model_utils/managers.py#L277-L318





2017-09-21 6:39 GMT-03:00 Rakhee Menon :

> Hello Everyone ,
> Can anyone tell me how to write views where, when clicked  on delete
> button the data shouldn't get deleted only the flag should turn 0
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/133d2433-2902-4856-a4e9-8800363db0ff%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e
mandar o pull-request. Leia mais sobre como publicar em README.md e
contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python
ou é útil para quem usa Python? Está esperando o que? Publica logo, que
estou louco para ler...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPVjvMbe46w4HdaWZcJEepcRp1egQeo3fZHNokYtubq3e97ezw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Mark as deleted instead of actually deleting in DeleteView

2017-09-21 Thread Rakhee Menon
Hello Everyone ,
Can anyone tell me how to write views where, when clicked  on delete button 
the data shouldn't get deleted only the flag should turn 0

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/133d2433-2902-4856-a4e9-8800363db0ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.