On Saturday, January 22, 2011 6:57:46 PM UTC, TheRedRabbit wrote:
>
> Im getting this error when I run syncdb: 
>
> Error: One or more models did not validate: 
> flatpages.flatpage: Accessor for m2m field 'sites' clashes with 
> related m2m field 'Site.flatpage_set'. Add a related_name argument to 
> the definition for 'sites'. 
> my_flatpages.flatpage: Accessor for m2m field 'my_sites' clashes with 
> related m2m field 'Site.flatpage_set'. Add a related_name argument to 
> the definition for 'my_sites'. 
>
>
> Im not sure whats wrong here. I copied the flatpages app to my python 
> path so I can modify it 
> and now this is where Im at??? ;/


You haven't uninstalled the old flatpages model, so there are now two 
foreign keys pointing from a flatpages model to Site. As the error message 
clearly states, you need to add a related_name argument to the foreign key 
definition.

However, IMO you're going about this completely the wrong way. There's no 
need to copy and hack the flatpages model. If you just want to add a related 
model that you can edit in the admin, then do that: create a new model with 
a ForeignKey pointing to the original Flatpage, and register a new admin 
class for Flatpages which includes an inline for your new model (you'll need 
to call `admin.site.unregister(Flatpage)` first to get rid of the original 
admin.)
--
DR.

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

Reply via email to