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 8346633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:05:03+00:00 2026-06-09T07:05:03+00:00

Django Guardian has two forms defined in admin.py, GroupManage and UserManage: https://github.com/lukaszb/django-guardian/blob/master/guardian/admin.py#L368 I would

  • 0

Django Guardian has two forms defined in admin.py, GroupManage and UserManage: https://github.com/lukaszb/django-guardian/blob/master/guardian/admin.py#L368

I would like to add auto-completion to these two forms, and the best way I assume to make that happen is to overwrite the group and user’s field widgets (my first attempt uses django autocomplete_light.) The goal is to not need to fork django guardian.

So in my app’s models.py, I added the following code

GroupManage.__class__.group = forms.CharField(max_length=81,
    error_messages={'does_not_exist':
    "This group does not exist!"}, widget=ChoiceWidget(True))

I also tried using setattr to no avail. In the django shell it acts like this should be working, but when the admin page gets loaded the old group variable is restored, with the default CharField widget.

  • 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-06-09T07:05:06+00:00Added an answer on June 9, 2026 at 7:05 am

    The fields defined for the class are stored in the dictionary base_fields.

    GroupManage.base_fields['group'] = forms.CharField(max_length=81,
    error_messages={'does_not_exist':
    "This group does not exist!"}, widget=ChoiceWidget(True))
    

    Sometimes, it might be easier to alter a field attribute instead of replacing the entire field:

    GroupManage.base_fields['group'].help_text = "New help text"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

django guardian https://github.com/lukaszb/django-guardian is a really well written object-level permissions app; and I have
Django has the StackedInline-Feature for the Admin-Backend - is there any equivalent for django.forms?
Trying to edit object permissions using django-guardian in the admin site I get this
I've found 3 row-level permission solutions for Django 1.2+ django-object-permissions django-guardian django-authority Could someone
Django has the concept of filters that allow you to format values in views.
Django has a decorator function called @transaction.commit_manually . I am attempting to pass a
django's manager docs has a paragraph overwritten with DO NOT FILTER AWAY ANY RESULTS
django forms seem to be oriented for rerdirecting the user to a different page
Django has a DATE_FORMAT and a DATE_TIME_FORMAT options that allow us to choose which
I'm currently writing a site which uses django-guardian to assign object-level permissions which are

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.