python - Django: Model name clash -


I am trying to use various open source apps in my project. The problem is that two different apps have the same model names used with their own model definition

I tried to use it:

  class Meta: db_table = "db_name"  

but it does not work. Any suggestion I'm still getting the field name conflict error on syncdb

Update

I'm actually trying to integrate Satchmo with Pinax and the error is:

Error: One or more models have not been validated:

contact.contact: Field 'user contact_set' conflict with the respective M2M field for 'user accessor' Add the respective_name logic to the definition of 'user'.

friends.contact: Combine the 'User.contact_set' conflict associated with the fields related to the accessor 'M2' field for 'User', add the related name-related argument to 'Users'.

You are right, the table names are already unique. I have analyzed the model and the model 'contact' is in two models of two separate applications when one of these models It works fine, then it may work properly.

There may be an error, because both apps are in Python_PATH and when the other app defines its model with the same name, the collision occurs.

The problem is that both Saito and Penax have a contact model with a foreign model with a user. Django tries to add "contact_set" reverse relation attribute to each foreign key in the user, so there is a conflict.

The solution is to add some related_name = "pinyx_content_set" as an argument to the foreign side in Pinax's contact model, or similarly in the Satchmo contact model. For this you will need to edit the source directly for one or the other, you can find a way to do it through the capricading, but I expected it would be difficult.


Comments