Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

How to override queryset for newly added fieldset in Django Admin Panel

I have added "permissions" fieldset in my User model on Admin Panel, but when I try to add a User it takes a lot of queries due to permissions (500) in my case, I am not able to optimize the ...
Ali Hassan's user avatar
0 votes
1 answer
238 views

Django "django-modeladmin-reorder" library does not work for side navigation/nav bar of admin

I have a django project, which contains several models with natural grouping, as well as some off-the-shelf models from install libraries. I am trying to have this natural grouping reflected in the ...
Svestis's user avatar
  • 353
1 vote
0 answers
123 views

How to set date_hierarchy to an annotation field

I have a Model and its Manager. I created an annotated field date (which returns not null date from start or set date). class TimerManager(models.Manager): def get_queryset(self): return ( ...
Vitalii Korniichuk's user avatar
0 votes
1 answer
109 views

Django list display of foreign key attribute that is boolean field using check or cross icons

My problem is similar to this thread: Can "list_display" in a Django ModelAdmin display attributes of ForeignKey fields?. I want to display a foreign key attribute from the list display. ...
Nikko's user avatar
  • 1,572
0 votes
1 answer
633 views

Django SimpleListFilter: ValueError not enough values to unpack (expected 2, got 0)

Context: I'm creating a custom input filter in Django using the SimpleListFilter class. I've followed the steps in here https://hakibenita.com/how-to-add-a-text-filter-to-django-admin, but I'm ...
Alex Anadon's user avatar
2 votes
1 answer
186 views

how to validation fields for TabularInline in django admin?

I create a BaseInlineFormSet like this: class ProductPictureRequiredFormSet(forms.models.BaseInlineFormSet): def clean(self): if self.cleaned_data["image"] == None: ...
Mahdi Kh's user avatar
0 votes
1 answer
46 views

How to filter the latest amended laws in django admin site?

below is the description of the models: I have a Law model Each law has many Versions Each version has many Translations Each translation has many annotations I want to get the latest amended laws ...
Mahdi Jafari's user avatar
0 votes
2 answers
162 views

BooleanField Model not showing the default False value but '-' instead

I have a model class where the variable completed_application should default to False when creating a new user (to show that the user hasn't completed an application yet). However, by default when a ...
Olney1's user avatar
  • 782
0 votes
0 answers
553 views

django custom model admin get current request in get_urls method

I am trying to implement a django solo kind of custom model admin where each user has his own solo object to change. So the instance id should change when user logs in admin panel. Change view is ...
Mahmud Abdur Rahman's user avatar
0 votes
1 answer
220 views

Test for custom ModelAdmin function with GET parameters

I'm trying to write a test for the following modelAdmin function: def response_add(self, request, obj, post_url_continue=None): """ Redirects to the public profile details ...
Josh's user avatar
  • 285
1 vote
0 answers
207 views

Hide one of the User.ModelAdmin.fieldsets if User role changes in django

Hi I want to hide some fieldsets in admin if user role changes. In get_queryset() I'm changing queryset if role == 'CMS' I also want to hide Permission fieldset for same role. Here is my admin: Note: ...
Rajat Jog's user avatar
  • 317
0 votes
2 answers
582 views

Django admin do not display all fields

This question is created to help other people with similar problem. I know how to fix the issue, but I'm also interested Why this happens. In my models.py I've had a model class CEOSetting(models....
David's user avatar
  • 282
1 vote
3 answers
3k views

Django Admin Panel: Show/Hide Fields If Specific Value Is Selected In A Dropdown

What am I doing wrong? In django admin-panel I want to show/hide field(s) based on the choice dropdown. Also the, choice dropdown lies on parent foreign-key related model and the fields that are to be ...
kiliman13's user avatar
  • 101
1 vote
2 answers
2k views

Show created and edited fields in Django admin form

I have this model class Volunteer(models.Model): STATUSES = ( ('Active', 'Active'), ('Paused', 'Paused'), ('Inactive', 'Inactive'), ) first_name = models.CharField(max_length=50) last_name ...
user avatar
4 votes
2 answers
1k views

Django Admin exclude model from index and app page

I want to hide some models from admin index page and app page. For example, these that I have visible in inlines as related objects. One more point, I want to keep the ability to work with change_view ...
wowkin2's user avatar
  • 6,385

15 30 50 per page
1
2 3 4 5