Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango: xyz.fieldsets[0][1]['fields'] refers to field '123' that is missing from the form
    text
    copied!<p>I have little doubt that this will be a really stupid question. But I really can't figure it out so I'll ask it anyway.</p> <p>In /svsite/src/svsite/member/models/svuser.py (a little unusual location, see this question <a href="https://stackoverflow.com/questions/6144631/place-django-admin-forms-in-different-files">Place Django admin forms in different files</a>).</p> <pre><code>from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin, UserChangeForm as DjangoUserChangeForm from svsite.member.models.svuser import svUser class UserChangeForm(DjangoUserChangeForm): class Meta: pass class svUserAdmin(UserAdmin): form = UserChangeForm readonly_fields = ('date_joined', 'last_login', 'last_update', ) fieldsets = \ ( ( 'Login', { 'classes': ('collapse', ), 'fields': ( 'username', 'password', 'is_active', 'email_verified', 'awaiting_user_confirmation', ), } ), ( 'Personal info', { 'fields': ( 'first_name', 'middle_name', 'last_name', ), } ), ) [...] </code></pre> <p>In the model I have at /svsite/src/svsite/member/admin/svuser.py:</p> <pre><code>from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User, UserManager class svUser(User): email_verified = models.BooleanField(default = False) awaiting_user_confirmation = models.BooleanField( _('approved by board'), default = False, help_text=_('This user\'s identity was confirmed by the board or another authority.')) [...] </code></pre> <p>The error I get:</p> <pre><code>'svUserAdmin.fieldsets[0][1]['fields']' refers to field 'password' that is missing from the form. </code></pre> <p>If I comment password, the error moves to the next field. Independent if it's a default user model field or one I added in the svUser inherited from user. Very surprisingly (to me), username seems to be the only field that works, no problems on that one.</p> <p>I found this question <a href="https://stackoverflow.com/questions/3516799/django-modeladmin-fieldsets-field-date-missing-from-the-form">Django ModelAdmin - fieldsets ... field &#39;date&#39; missing from the form</a> and even though the fields are not auto_now, I added them to readonly_fields and that made the error go away. Obviously though, making all fields read-only is not an option.</p> <p>It's probably something stupid not really related to code but I really can't find it, seems to me it really should be working. Any help is greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload