Re: custom model fields with to_python()/from_db_value() for different django version...

2015-06-17 Thread Simon Charette
ing Bug > https://code.djangoproject.com/ticket/9619 > > <https://code.djangoproject.com/ticket/9619> for: > > > > to_python not called when fetching data with .values(...) > > > > > > I update the tests and create a ticket and pu

custom model fields with to_python()/from_db_value() for different django version...

2015-06-17 Thread Jens Diemer
* https://github.com/django/django/pull/4874 > <https://github.com/django/django/pull/4874> > > I can also made pull request for v1.8.x and master... > > > > > > I also found the Solution for: "to_python() didn't call with Python

Re: Custom model fields not working?

2013-08-06 Thread Oliver Beattie
This was more than 5 years ago… wow! Sorry, I have absolutely no idea now. I would suspect that "yes," I got it sorted, but I would anticipate that the internals of Django's ORM have changed significantly since then, so even if I could remember how I did it, it wouldn't be of much use… Perhaps if

Re: Custom model fields not working?

2013-08-05 Thread joe . yuan19
Hey! I'm dealing with a similar issue. Would you be able to tell me if you managed to solve this issue? and if so, how? Thanks! Joe On Tuesday, December 11, 2007 3:42:54 PM UTC-5, oli...@obeattie.com wrote: > > Hey everyone, > > I've asked a little in the Django IRC, but nobody seems to be abl

custom model fields are always "modified" when saving from the admin change form

2010-09-10 Thread Evgeny Sizikov
Hi. I've wrote a custom model field which splits strings by commas and returns a list of values. Everything works fine except the admin - after editing a record admin treats the custom fields as modified even if they were actually not, issuing an UPDATE query for (not modified) record and adding a

Re: Custom Model Fields

2010-05-18 Thread Nuno Maltez
Hi, I think what you're trying to accomplish is more or less what django-tagging [http://code.google.com/p/django-tagging/] does, so I suggest looking at its source code. HTH, Nuno On Sun, May 9, 2010 at 11:24 PM, Nick Taylor wrote: > Hi all, > > I want to create my own "field" type for a model

Custom Model Fields

2010-05-09 Thread Nick Taylor
Hi all, I want to create my own "field" type for a model, this essentially will be a relationship to another model via a generic link model (using GenericForeignKey etc). As en example I basically want to do the following in models.py: class Pizza(models.Model): toppings = IngredientsField()

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread Alex Gaynor
On Tue, Apr 14, 2009 at 6:00 PM, gordyt wrote: > > I think I've tracked down the problem. Here is a bit of code from > django.db.models.fields.related.py: > >def get_db_prep_lookup(self, lookup_type, value): ># If we are doing a lookup on a Related Field, we must be ># compar

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Here is a dpaste link to that same bit of code that looks nicer: http://dpaste.com/hold/33474/ --gordy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
I think I've tracked down the problem. Here is a bit of code from django.db.models.fields.related.py: def get_db_prep_lookup(self, lookup_type, value): # If we are doing a lookup on a Related Field, we must be # comparing object instances. The value should be the PK of value,

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-14 Thread gordyt
Howdy Daniel! > I suspect you have not set the subclass's metaclass to > models.SubfieldBase - see > here:http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#the-s... > > You need to do this to get any of the overridden methods to be called. Thanks for the up

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread Daniel Roseman
se when the backend supports it (postgresql) and a > charfield when the backend doesn't support it (others).  I did some > tests and performance with postgresql is better with the native type > (not suprising). > > --gordon I suspect you have not set

Re: Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread gordyt
Forgot to add that I'm using the latest revision from subversion (10558)... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To u

Custom Model Fields / Multi-table inheritance / get_db_prep_value / postgresql_psycopg2

2009-04-13 Thread gordyt
Howdy Folks, I have been testing model inheritance using models that have UUIDField primary keys. It appears that when you save a new instance of a child model, the framework is not calling get_db_prep_value() to convert the UUIDField to a proper format before querying the parent entry. Let's s

Re: Writing custom model fields with Multi-table inheritance

2009-02-21 Thread gordyt
> http://code.djangoproject.com/ticket/8813 > > If you could attach the file you dpasted to that ticket and note that you > see this problem in the admin, that would probably be useful, as recreating > it in admin should be easier than recreating the user-defined form, view, > and models involved

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread Karen Tracey
On Fri, Feb 20, 2009 at 6:14 PM, gordyt wrote: > > Karen I made a small sample to illustrate the problem and posted it > here: > > http://dpaste.com/hold/123199/ > > It's an extremely simple test case and instructions are included in > the comments. I'm not sure if this error is related to the i

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
Karen I made a small sample to illustrate the problem and posted it here: http://dpaste.com/hold/123199/ It's an extremely simple test case and instructions are included in the comments. I'm not sure if this error is related to the issue that you told me about or if it is something new entirely

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
> This sounds like a problem that has been fixed.  Are you running with a > recent enough trunk or 1.0.X branch checkout so that you have this fix: > > http://code.djangoproject.com/changeset/9664 Karen I'm running build 9846. I'm going to put together a very minimal example to illustrate the pr

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread Karen Tracey
On Fri, Feb 20, 2009 at 10:21 AM, gordyt wrote: > > Howdy Viktor, > > On Feb 1, 1:36 pm, Viktor wrote: > > Hi, > > > > did you got any response or did you managed to solve your problem? > > I've just started to search for a UUIDField, and it would be great to > > have proper uuid columns for pos

Re: Writing custom model fields with Multi-table inheritance

2009-02-20 Thread gordyt
Howdy Viktor, On Feb 1, 1:36 pm, Viktor wrote: > Hi, > > did you got any response or did you managed to solve your problem? > I've just started to search for a UUIDField, and it would be great to > have proper uuid columns for postgres. > > If so do you plan to commit it to django_extensions? S

Re: Writing custom model fields with Multi-table inheritance

2009-02-01 Thread Viktor
Hi, did you got any response or did you managed to solve your problem? I've just started to search for a UUIDField, and it would be great to have proper uuid columns for postgres. If so do you plan to commit it to django_extensions? Thanks, Viktor On 2008 dec. 16, 22:53, gordyt wrote: > Howdy

Writing custom model fields with Multi-table inheritance

2008-12-16 Thread gordyt
Howdy Folks! I wanted to be able to have UUID primary keys for certain models. I found the implementation done by the django_extensions project (http://code.google.com/p/django-command-extensions/) and it works fine as is. But I wanted to be able to have a UUIDField that stored its values in an

Re: Serialization of custom model fields

2008-11-15 Thread Karen Tracey
ethods on the custom field class (subclassing > > > models.Field). > > > > > Things works more-or-less OK, but when I run dumpdata to serialize the > > > database into json, at some point to_json gets executed and the > > > returned value for rrule is 

Re: Serialization of custom model fields

2008-11-15 Thread AndyH
> > get_db_prep_value. I also have a 'value_to_string' method on the > > fiels, but this does not get executed either. > > > What am I missing about the way dumpdata handles these custom model > > fields? > > > Thanks > > Andy. --~--~

Re: Serialization of custom model fields

2008-11-15 Thread Alex Koshelev
does not get executed either. > > What am I missing about the way dumpdata handles these custom model > fields? > > Thanks > Andy. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

Serialization of custom model fields

2008-11-15 Thread AndyH
lso have a 'value_to_string' method on the fiels, but this does not get executed either. What am I missing about the way dumpdata handles these custom model fields? Thanks Andy. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: Custom model fields not working?

2007-12-11 Thread [EMAIL PROTECTED]
Never mind, I see it's to do with database backends. On Dec 11, 10:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > OK, well now, for some reason whenever I use a custom field Django > just ignores it when running syncdb. If I ask it for the raw SQL > output I can see that the field is bei

Re: Custom model fields not working?

2007-12-11 Thread [EMAIL PROTECTED]
OK, well now, for some reason whenever I use a custom field Django just ignores it when running syncdb. If I ask it for the raw SQL output I can see that the field is being omitted entirely. Even if I do something simple like: class TestField(models.TextField): pass Does anyone know what I

Re: Custom model fields not working?

2007-12-11 Thread [EMAIL PROTECTED]
You're a saint, you know that? On Dec 11, 9:04 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Dec 11, 2007 3:42 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > When I try to run syncdb on a model which uses the PickledObjectField > > (see my sample model athttp://dpaste.com/hold/27713/

Re: Custom model fields not working?

2007-12-11 Thread Marty Alchin
On Dec 11, 2007 3:42 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > When I try to run syncdb on a model which uses the PickledObjectField > (see my sample model at http://dpaste.com/hold/27713/), I get this > traceback:- Your problem is that you're importing the PickledObjectField into your c

Custom model fields not working?

2007-12-11 Thread [EMAIL PROTECTED]
Hey everyone, I've asked a little in the Django IRC, but nobody seems to be able to help. I'm trying to implement a custom model field, and I really can't figure out why I keep getting errors. My code for my fields module is at http://dpaste.com/hold/27712/ When I try to run syncdb on a model wh