Questions tagged [django-modeladmin]

132 questions
0
votes
1 answer

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 admin hope page, as well as the side navigation…
0
votes
0 answers

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 ( super() .get_queryset() …
0
votes
0 answers

Django: Updating the choices for a CharField in an AdminModel

Suppose that in a django project: ModelAdmin class "FooModelAdmin" is defined in module for model "Foo". Model "Foo" has a field named "F1", which is of type CharField. A list of choices is defined for field "F1" by the attributes…
Ofer
  • 423
  • 6
  • 11
0
votes
0 answers

Make Fields Readonly and prepopulate on InlineModelAdmin based on ModelAdmin Feilds

I have django models like this: models.py #BaseClass class FarmBaseModel(models.Model): created_at = models.DateTimeField( auto_now_add=True, editable=False, ) updated_at = models.DateTimeField(auto_now_add=True,…
Mohan
  • 4,677
  • 7
  • 42
  • 65
0
votes
1 answer

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. This attribute is a BooleanField. Normally, it would display a…
Nikko
  • 1,410
  • 1
  • 22
  • 49
0
votes
1 answer

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 encountering a ValueError when trying to use the filter.…
0
votes
1 answer

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 in the Django admin site. So, I created a proxy…
0
votes
0 answers

Django admin AttributeError: Unable to lookup `FIELD` on 'MODEL_1' on 'MODEL_2' on 'MODEL_3'

This answer didn't solve the issue for me, Generating django admin and foreignkey error. I added a new field over a MODEL_1 everything works fine when I open the table in django dashboard but when I open an entry in MODEL_1 I get the error ```Unable…
raj-kapil
  • 177
  • 1
  • 15
0
votes
1 answer

Multi-table inheritance and two many to many via through model not working in admin inline

I'm trying to create navigation menu from the django admin as per user's requirement. The Model look like this: class MenuItem(models.Model): title = models.CharField(max_length=200, help_text='Title of the item') created_at =…
DrGeneral
  • 1,844
  • 1
  • 16
  • 22
0
votes
2 answers

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 new user is created it doesn't show as False in…
Olney1
  • 572
  • 5
  • 15
0
votes
0 answers

Filter django admin list with text input

Based on django ModelAdmin document for filterize list data, exist some class in admin that making filters, like DateFieldListFilter, ChoicesFieldListFilter and etc, But dosent exist any class for text input field. I need to use several text input…
Yousef
  • 3
  • 5
0
votes
0 answers

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 working fine but after changing the field & save, it…
0
votes
1 answer

Overriding Django's default id in it's User Model

We have a working Django project in a multi-master database environment. That means the we have multiple instances of the project's database running in separate machines and that all individual changes are propagated to the other databases. Is…
rrb_bbr
  • 2,966
  • 4
  • 24
  • 26
0
votes
1 answer

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 page after creation if return=true """ if…
0
votes
1 answer

Rename Filter Label Model Admin Django

Is it possible to change this label in the list filter from model admin without creating a custom filter? I'm using the same external model for 2 different fields and user needs to filter the table using both fields (separately or combining…
Alex Anadon
  • 77
  • 3
  • 11
1 2 3
8 9