Hi!

In python, '==' operator is set to '__eq__' and '!=' operator is set
to '__ne__' functions.

See more details in http://jcalderone.livejournal.com/32837.html

And In order to make queries from the ORM, Django uses Managers
https://docs.djangoproject.com/en/dev/topics/db/managers/

So you can write a Manager for the model that has this custom field,
override the __eq__ and __ne__ operations on this custom field and
implement as you like.

Good days!


On Wed, Feb 19, 2014 at 1:45 PM, Johannes Schneider
<[email protected]> wrote:
> hey list,
>
> I have a custom Field implemented for one of my models. How do I implement
> the database operations (e.g. '==', '!=') for the custom field which are
> used to execute database queries?
>
> bg,
> Johannes
> --
> Johannes Schneider
> Webentwicklung
> [email protected]
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/53049967.8030907%40galileo-press.de.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
- Serdar Dalgıç <[email protected]>
FLOSS Developer, Life & Nature Hacker
twitter:
https://twitter.com/serdaroncode
https://twitter.com/serdarintowild

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAJH%2Boppn9s%3D2q%3DFQB%3DsBFXObT-sGWNDa%2BLxGNWfB-bi4F31SXA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to