Thank you very much for the suggestions.

So after using:

cls._meta.add_field(self, virtual=True)

instead of:

cls._meta.add_field(self)
cls._meta.virtual_fields.append(self)

The VirtualField implementation of django-hstore is much cleaner and does 
not conflict with the migration framework.

I wonder if it's possible to achieve a similar result in django 1.7?

Regarding this VirtualField implementation, in the near future I'd like to 
extract it in a separate python package. It doesn't have to be tied to 
django-hstore like it is now, it can potentially be used with any text 
field.
The idea is that you have something like a (hidden) JSONField or a 
TextField which contains the data of several other VirtualFields.

This would go in the direction of experimenting more with dynamic models in 
django.
I read something in the responses to the django community survey, so it 
seems I'm not the only one who would like to have flexible/dynamic models 
:-)

Federico


On Saturday, April 25, 2015 at 11:48:25 AM UTC+2, Federico Capoano wrote:
>
> Yes I am on 1.7 because 1.8 is not supported yet but I'm working on it.
>
> I'll come back when I'll have more info.
>
> Federico
>
>
> On Thursday, April 23, 2015 at 8:09:42 PM UTC+2, Florian Apolloner wrote:
>>
>>
>>
>> On Thursday, April 23, 2015 at 6:59:58 PM UTC+2, Federico Capoano wrote:
>>>
>>> cls._meta.add_field(self, virtual=True)
>>>
>>> gives:
>>>
>>>   File "/var/www/django-hstore/django_hstore/virtual.py", line 29, in 
>>> contribute_to_class
>>>     cls._meta.add_field(self, virtual=True)
>>> TypeError: Error when calling the metaclass bases
>>>     add_field() got an unexpected keyword argument 'virtual'
>>>
>>>
>> This should definitely work on master/1.8: 
>> https://github.com/django/django/blob/master/django/db/models/options.py#L294
>>  
>> -- seems like you are on 1.7 or something.
>>
>> cheers,
>> florian
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1d827e48-34d5-4db7-94e7-754df9f4241c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to