I am making a Django application with user users. I have outlined the key components of my problem below, missing code is indicated by the symbol "...". My user model has a foreign key relationship as follows:
class MyCustomUser(models.AbstractBaseUser, models.PermissionsMixin) ... location = models.ForeignKey(Location) class Location(models.Model) name = models.CharField(max_length=50, blank=True, null=True)
I wrote a custom form that includes this field as follows:
class MyCustomUserCreationForm(models.ModelForm) ... location = forms.ModelChoiceField(Location.objects.all())
Everything seems to work correctly, however there is no plus button to the right of the selection field for the location. I want to be able to add location when creating a user, just as you can add polls when creating options in a Django tutorial . On this issue , I do not see a green plus if I do not have permission to change the model, but I am registered as superuser with all permissions. Any idea what I'm doing wrong?
python django django-admin django-forms
Emerald owl
source share