Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7192763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:00:48+00:00 2026-05-28T20:00:48+00:00

I have the following in models.py: class Choices(models.Model): description = models.CharField(max_length=300) def __unicode__(self): return

  • 0

I have the following in models.py:

class Choices(models.Model):
    description = models.CharField(max_length=300)

    def __unicode__(self):
        return self.description

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    fullname = models.CharField(_('Full Name'), max_length=50)
    birthdate = models.DateTimeField(_('Birthday'))
    url = models.URLField(_('Website'), blank=True)
    company = models.CharField(_('Company'), max_length=50)
    CATEGORY_CHOICES = (
            ('M',_('Male')),
            ('F',_('Female')),
            )
    gender = models.CharField(_('Gender'), max_length=200, choices = CATEGORY_CHOICES)
    picture = models.ImageField(_('Picture/Avatar'), upload_to='profile_photo', blank=True)
    bio = models.TextField()
    planguages = models.ManyToManyField(Choices)

Now, I want to be able to edit both user profile in admin, as well as option to populate choices users can pick from when creating profile. Being a django newb I am, I managed to make options for editing users profiles only, but didn’t manage to populate Choices. Anyhow, I can do it, but I don’t know how to have both.

EDITED:
Here’s my current admin.py

class ChoicesAdmin(admin.ModelAdmin):
    list_display = ['description']

class ProfilesAdmin(admin.ModelAdmin):
    list_display = ['user']

admin.site.register(UserProfile, ProfilesAdmin)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:00:49+00:00Added an answer on May 28, 2026 at 8:00 pm

    What you are looking for is filter_horizontal

    class ChoicesAdmin(admin.ModelAdmin):
        list_display = ['description']
    
    class ProfilesAdmin(admin.ModelAdmin):
        list_display = ['user']
        filter_horizontal = ['planguages']
    
    admin.site.register(UserProfile, ProfilesAdmin)
    admin.site.register(Choices, ChoicesAdmin)
    

    This will allow you to add languages to a user.

    Also, you must have the ChoicesAdmin class registered in order to see the green + link to add choices.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following model. class Comment(models.Model): type = models.CharField(max_length=21, choices=OBJECT_TYPE_CHOICES) program = models.ForeignKey(Program, db_column='object_id',
I have the following models class Book(models.Model): name = models.CharField(max_length=140) class UserProfile(models.Model): favorites =
I have the following models class Person(models.Model): name = models.CharField(max_length=100) class Employee(Person): job =
I have the following models: class City(models.Model): name = models.CharField(max_length=100) class Pizza(models.Model): name =
i have the following models setup class Player(models.Model): #slug = models.slugField(max_length=200) Player_Name = models.CharField(max_length=100)
I have the following abstract Django models: class Food(models.Model): name = models.CharField(max_length=100) class Meta:
I have the following model class DNS(models.Model): domain = models.ForeignKey(Domain) host_start = models.CharField(max_length=150, blank=True,
I have the following models: class Territory(models.Model): name = models.CharField(max_length=30) power = models.ForeignKey(Power, null=True,
I have the following models: class Category(models.Model): name = models.CharField(max_length=40) class Item(models.Model): name =
I have the following model.py : class FinancialProduct(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=20)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.