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,"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,"Many-to-many fields with intermediate tables cannot be symmetrical.")
seen_from,seen_to,seen_self=False,False,0
forinter_fieldinf.rel.through_model._meta.fields:
rel_to=getattr(inter_field.rel,'to',None)
iffrom_model==to_model:# relation to self
ifrel_to==from_model:
seen_self+=1
ifseen_self>2:
e.add(opts,"Intermediary model %s has more than two foreign keys to %s, which is ambiguous and is not permitted."%(f.rel.through_model._meta.object_name,from_model._meta.object_name))
e.add(opts,"Intermediary model %s has more than one foreign key to %s, which is ambiguous and is not permitted."%(f.rel.through_model._meta.object_name,from_model._meta.object_name))
e.add(opts,"Intermediary model %s has more than one foreign key to %s, which is ambiguous and is not permitted."%(f.rel.through_model._meta.object_name,rel_to._meta.object_name))
else:
seen_to=True
iff.rel.through_modelnotinmodels.get_models():
e.add(opts,"'%s' specifies an m2m relation through model %s, which has not been installed."%(f.name,f.rel.through))
signature=(f.rel.to,cls,f.rel.through_model)
ifsignatureinseen_intermediary_signatures:
e.add(opts,"The model %s has two manually-defined m2m relations through the model %s, which is not permitted. Please consider using an extra field on your intermediary model instead."%(cls._meta.object_name,f.rel.through_model._meta.object_name))
else:
seen_intermediary_signatures.append(signature)
seen_related_fk,seen_this_fk=False,False
forfieldinf.rel.through_model._meta.fields:
iffield.rel:
ifnotseen_related_fkandfield.rel.to==f.rel.to:
seen_related_fk=True
eliffield.rel.to==cls:
seen_this_fk=True
ifnotseen_related_fkornotseen_this_fk:
e.add(opts,"'%s' has a manually-defined m2m relation through model %s, which does not have foreign keys to %s and %s"%(f.name,f.rel.through,f.rel.to._meta.object_name,cls._meta.object_name))
else:
e.add(opts,"'%s' specifies an m2m relation through model %s, which has not been installed"%(f.name,f.rel.through))
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))