Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Django AbstractUser doesn't show model

I'm a django beginner and i want to add a booleanfield to AbstractUser, but it's not showing the booleanfield in the admin.

models.py

class CustomUser(AbstractUser):
    selected = models.BooleanField(default=False)
    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = ['selected',]

    def __str__(self):
        return self.username

admin.py

class MyUserChangeForm(UserChangeForm):
    class Meta(UserChangeForm.Meta):
        model = CustomUser

class UserAdmin(BaseUserAdmin):
    form = MyUserChangeForm
    list_display = ('username', 'first_name', 'last_name', 'email', 'is_staff', 'selected')

admin.site.register(CustomUser, UserAdmin)

settings.py

AUTH_USER_MODEL = 'football_app.CustomUser'
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

in admin.py file change class UserAdmin(BaseUserAdmin): to class UserAdmin(CustomUser):

EDIT: update your class like this

class UserAdmin(admin.ModelAdmin):
    list_display = ('username', 'first_name', 'last_name', 'email', 'is_staff', 'selected')

    class Meta:
       model = CustomUser
over 4 years ago · Santiago Trujillo Report

0

You need to unregister current User admin first.

admin.site.unregister(User)
admin.site.register(CustomUser, UserAdmin)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!