Hello guys,
I have a question about the django CBV DeleteView, I want to use it but not 
delete the element, i just want to set a delete_date so that it isn't 
visible anymore.

With FBV my view looked like this:

def delete(request, customer_id):
    customer = get_object_or_404(Customer, pk=customer_id)
    if customer.date_deleted is not None:
        raise Http404
    now = datetime.datetime.utcnow().replace(tzinfo=utc)
    customer.date_deleted = now.strftime("%Y-%m-%d %H:%M:%S")
    customer.save()
    return HttpResponseRedirect()

but know I want to change all my Views with CBVs but I really don't 
understand how I could change the default query on DeleteView. Is there 
somebody who could help me with it?

I mean it is way easier than to Delete items, since I have one DeleteView 
where I could use to Delete all items.

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to