maybe I I formulated it not precise enough.
I need to check if some instance of a model comes from some database
query (e.g. via get(..)) or is instanciated 'by hand'. and not jet
written to the database.
In this case I don't need to know, if there is an related object (e.g.
with the same pk or same values for its attributes) in the database.
bg,
Johannes
On 20.01.2014 18:21, Avraham Serour wrote:
> 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....@galileo-press.de
> <mailto:
johannes....@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
> <mailto:
johannes....@galileo-press.de>
> Tel.:
+49.228.42150 <tel:%2B49.228.42150>.xxx
>
> Galileo Press GmbH
> Rheinwerkallee 4 - 53227 Bonn - Germany
> Tel.: +49.228.42.150.0 <tel:%2B49.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
> <mailto:
django-users%2Bunsu...@googlegroups.com>.
> <mailto:
django...@googlegroups.com>.
> Visit this group at
http://groups.google.com/__group/django-users
> <
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
> <
https://groups.google.com/d/msgid/django-users/52DD4B1B.9020508%40galileo-press.de>.
>
> For more options, visit
https://groups.google.com/__groups/opt_out
> <
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...@googlegroups.com.
>
https://groups.google.com/d/msgid/django-users/CAFWa6tLNikRya2Fyji_WSgFd9QE9qDNmrhNEsUDj2hQd2t7ieQ%40mail.gmail.com.
Gesch�ftsf�hrer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn