Details
-
Type: Task
-
Status: Closed (View Workflow)
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Labels:
-
Story Points:1
-
Epic Link:
-
Sprint:Summer 2019 Sprint 12, Fall 2019 Sprint 1
Description
When we run makemigrations when standing up AppStore, the following warning gets printed:
(venv) AppStore $ python manage.py makemigrations
/var/www/vhosts/appstore/conf/mock.py:6: UserWarning: Running with local config MOCK !
warnings.warn("Running with local config MOCK !")
System check identified some issues:
WARNINGS:
?: (urls.W005) URL namespace 'social' isn't unique. You may not be able to reverse all URLs in this namespace
submit_app.AppPending.dependencies: (fields.W340) null has no effect on ManyToManyField.
For this task, investigate what is happening and propose a fix here.
Error :URL namespace 'social' isn't unique. You may not be able to reverse all URLs in this namespace
File: "users/urls.py"
Line: path(r'', include('social_django.urls', namespace='social'))
Explanation: The namespace='social' is a problem here, Usually this warning occurs when same namespace is used to define different paths. Can be solved by changing the namespace to something else other than social at on of the places where namespace is mentioned.
Error: submit_app.AppPending.dependencies: (fields.W340) null has no effect on ManyToManyField.
File: submit_app/models.py
Line: dependencies = models.ManyToManyField(Release, related_name='+', blank=True, null=True)
Explanation:
As mentioned at : https://stackoverflow.com/questions/18243039/migrating-manytomanyfield-to-null-true-blank-true-isnt-recognized
"null" doesn't mean anything at the database level when used with a ManyToManyField. The declaration of a ManyToManyField causes the creation of an intermediate table to hold the relationship, and although Django will create a standard attribute on your model instance for your convenience, there is no actual column representing it that could be nulled. By definition there can always be zero instances of the relationship.
blank=True/False, though, does have an effect on the admin app, forcing the user to choose at least one relation.
Solution: removing null=true will allow us to get rid of the warning.