On Dec 4, 8:37 pm, Phlip <phlip2...@gmail.com> wrote:
> Django users:
>
> I only ask the question to help improve my esthetics, but others might
> need a performance boost here.
>
> How to delete every record in a table?
>
> A related question - how to delete every record matching a filter, out
> of one internal SQL command?
>
> The brute-force way:
>
>   for p in Plutocrat.objects.all():  p.delete()
>
> Is there a way to do that in one method call? and could such a method
> call only send one SQL command?
>

Yes:
Plutocrat.objects.all().delete()

--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to