shacker / django-todo

A multi-user, multi-group todo/ticketing system for Django projects. Includes CSV import and integrated mail tracking.
http://django-todo.org
BSD 3-Clause "New" or "Revised" License
819 stars 285 forks source link

Failed migration #126

Open bernd-wechner opened 3 years ago

bernd-wechner commented 3 years ago

Love this. Just taking a quick spin plugging it into a development version of our tendenci site (for a club)

Following Installation here: https://django-todo.readthedocs.io/en/latest/

  1. I set SITE_ID = 1, all good
  2. I did pip install django-todo, all good
  3. I added it to INSTALLED_APPS: INSTALLED_APPS += ['todo']
  4. I tried migrating: python manage.py migrate todo

But it bombs with:

ERRORS:
contacts.Comment.creator: (fields.E304) Reverse accessor for 'Comment.creator' clashes with reverse accessor for 'Comment.author'.
    HINT: Add or change a related_name argument to the definition for 'Comment.creator' or 'Comment.author'.
todo.Comment.author: (fields.E304) Reverse accessor for 'Comment.author' clashes with reverse accessor for 'Comment.creator'.
    HINT: Add or change a related_name argument to the definition for 'Comment.author' or 'Comment.creator'.

That looks like a fairly simple issue, but surprises me immensely to see in the pip installed code. It seems simple enough to me, in that inside the Comment model:

https://github.com/shacker/django-todo/blob/20196a197f7d69ff62deddf8220d5758b8b29fdd/todo/models.py#L129

Tendenci and todo both implement a Comment model with ForeignKey to AUTH_USER_MODEL and neither specified a related_name argument so they both attempt to implement comment_set on the user. This is actually worth a fix in both apps, as neither should be attaching such a contextless comment to users.