1
 from django.contrib.auth import Group class Plan name = models.CharField(max_length=100, unique=True, null=False) description = models.TextField(blank=True) group = models.ForeignKey(Group, null=False, blank=False) 

When I attempt to save a 2nd instance of plan in django admin, setting the group to the same group as the previous plan object that I saved, I get an error traceback:-

duplicate key value violates unique constraint "plans_plan_group_id_key" DETAIL: Key (group_id)=(1) already exists. 

Why is that so and how do I allow many different plans to relate to the same group object?

1 Answer 1

1

This 3rd party app I am using some how fails to have a migration file that removes an originally specified unique=True. I added in a new south migration to force unique=False and all is fine and dandy now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.