Well, this is an "internal" project ... but a "translation" of some of the fields of some of the models would look something those below (NB this is a subset with just a few models - and any 'grammatical' errors are from the "translation" - the originals work perfectly in every respect except for the occasional sort error.)
So in the example below, if I sort the Site on 'Place' via admin, for example, then I get:
OperationalError at /admin/.../...
(1060, "Duplicate column name 'name'")
# EXAMPLE ONLY
from django.db.models import ForeignKey, Model
from django.db.models import AutoField, CharField
# in 'areas' app
class Region(Model):
"""A defined area, usually established or created by an official body.
"""
id = AutoField(primary_key=True)
name = CharField(max_length=100)
code = CharField(unique=True, max_length=25)
description = CharField(blank=True, null=True, max_length=250)
class Place(Model):
"""An owned place or area.
"""
id = AutoField(primary_key=True)
name = CharField(max_length=100)
description = CharField(blank=True, null=True, max_length=250)
region = ForeignKey(Region)
# in 'core' app
from areas.models import Place, Region
class Site(Model):
"""Contains the core details and attributes.
"""
id = AutoField(primary_key=True)
code = CharField(unique=True, max_length=100)
place = ForeignKey(Place)
On 4 September 2014 20:24, Collin Anderson <cmawebsite@gmail.com> wrote:
do you want to paste in your models?--To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/16396c5b-6b98-441d-9026-1c29c9fe73cd%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/wotonl4i01U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
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.
To post to this group, send email to django-users@googlegroups.com.
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/CAF1Wu3PmF-aZXkeRrpYsB_h4p4gnFZwiG31dC2Bo8_87cOj1Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment