Thursday, December 6, 2012

Re: Optional GIS field in a model

On Thursday, December 6, 2012 11:32:35 PM UTC+2, Nikolas Stevenson-Molnar wrote:
The reason for your syncdb error is that the table creation doesn't happen as part of the class definition (in other words, there's no error in creating your Content class). Why not add an "ENABLE_GIS" setting to your settings file? Then use your if/else:

class Content:
        ...
        if ENABLE_GIS:
                <gis fields here>
        else:
                <plain fields here>

Initially this seems to work, so thank you for this idea! I'll be very happy if the solution will be this simple. :)
I've to do some refactoring and testing now, let's see if this is the solution.

-- 
Aapo

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oZoCx_lz29cJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate