e.add(opts,'"%s": You can\'t use "id" as a field name, because each model automatically gets an "id" field if none of the fields have primary_key=True. You need to either remove/rename your "id" field or add primary_key=True to a field.'%f.name)
e.add(opts,'"%s": %s cannot have a "max_length" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).'%(f.name,f.__class__.__name__,'.'.join([str(n)fornindb_version[:3]])))
e.add(opts,"Accessor for field '%s' clashes with field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
ifr.name==rel_query_name:
e.add(opts,"Reverse query name for field '%s' clashes with field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
e.add(opts,"Accessor for field '%s' clashes with m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
ifr.name==rel_query_name:
e.add(opts,"Reverse query name for field '%s' clashes with m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
e.add(opts,"Accessor for field '%s' clashes with related m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
ifr.get_accessor_name()==rel_query_name:
e.add(opts,"Reverse query name for field '%s' clashes with related m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
forrinrel_opts.get_all_related_objects():
ifr.fieldisnotf:
ifr.get_accessor_name()==rel_name:
e.add(opts,"Accessor for field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
ifr.get_accessor_name()==rel_query_name:
e.add(opts,"Reverse query name for field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
e.add(opts,"Accessor for m2m field '%s' clashes with field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
ifr.name==rel_query_name:
e.add(opts,"Reverse query name for m2m field '%s' clashes with field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
e.add(opts,"Accessor for m2m field '%s' clashes with m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
ifr.name==rel_query_name:
e.add(opts,"Reverse query name for m2m field '%s' clashes with m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.name,f.name))
e.add(opts,"Accessor for m2m field '%s' clashes with related m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
ifr.get_accessor_name()==rel_query_name:
e.add(opts,"Reverse query name for m2m field '%s' clashes with related m2m field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
forrinrel_opts.get_all_related_objects():
ifr.get_accessor_name()==rel_name:
e.add(opts,"Accessor for m2m field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
ifr.get_accessor_name()==rel_query_name:
e.add(opts,"Reverse query name for m2m field '%s' clashes with related field '%s.%s'. Add a related_name argument to the definition for '%s'."%(f.name,rel_opts.object_name,r.get_accessor_name(),f.name))
# Check admin attribute.
ifopts.adminisnotNone:
ifnotisinstance(opts.admin,models.AdminOptions):
e.add(opts,'"admin" attribute, if given, must be set to a models.AdminOptions() instance.')
e.add(opts,'"ordering" refers to "%s", a field that doesn\'t exist.'%field_name)
# Check core=True, if needed.
forrelatedinopts.get_followed_related_objects():
ifnotrelated.edit_inline:
continue
try:
forfinrelated.opts.fields:
iff.core:
raiseStopIteration
e.add(related.opts,"At least one field in %s should have core=True, because it's being edited inline by %s.%s."%(related.opts.object_name,opts.module_name,opts.object_name))
exceptStopIteration:
pass
# Check unique_together.
forutinopts.unique_together:
forfield_nameinut:
try:
f=opts.get_field(field_name,many_to_many=True)
exceptmodels.FieldDoesNotExist:
e.add(opts,'"unique_together" refers to %s, a field that doesn\'t exist. Check your syntax.'%field_name)
else:
ifisinstance(f.rel,models.ManyToManyRel):
e.add(opts,'"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.'%f.name)