Monday, January 20, 2014

Re: Fast and Easy way to check if an instance of an Model exists in the Database

well you have a problem then, the database is the one holding the data, if you want to know if the data exists will would need to ask the one responsible for it, if not the DB then who?

you could keep a copy in memory but then you will have two problems. are you actually having problems with exists() or is this just premature optimization?


On Mon, Jan 20, 2014 at 6:13 PM, Johannes Schneider <johannes.schneider@galileo-press.de> wrote:
I don't do, because I don't want do to have a query against the database.


On 20.01.2014 16:25, Kelly Nicholes wrote:
Wait-- Why aren't you using exists()?  Don't even check the pk.  Model.query.exists() was made for this.



--
Johannes Schneider
Webentwicklung
johannes.schneider@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52DD4B1B.9020508%40galileo-press.de.

For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tLNikRya2Fyji_WSgFd9QE9qDNmrhNEsUDj2hQd2t7ieQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment