All Questions
Tagged with django-admin django-modeladmin
70 questions
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 ...
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 ...
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 (
...
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. ...
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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: ...
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....
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 ...
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 ...
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 ...