update: structure
This commit is contained in:
parent
a9d4ea5790
commit
d2da446009
0
src/helpers/admin/__init__.py
Normal file
0
src/helpers/admin/__init__.py
Normal file
15
src/helpers/admin/model.py
Normal file
15
src/helpers/admin/model.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from djangoql.admin import DjangoQLSearchMixin
|
||||||
|
|
||||||
|
|
||||||
|
class CustomModelAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
|
||||||
|
def get_list_display(self, request):
|
||||||
|
exclude = self.exclude if self.exclude else []
|
||||||
|
fields = [
|
||||||
|
field.name for field in self.model._meta.get_fields() if
|
||||||
|
not isinstance(field, (models.ManyToManyField, models.ManyToOneRel, models.ForeignKey))
|
||||||
|
and field.name not in exclude
|
||||||
|
]
|
||||||
|
return fields
|
0
src/helpers/models/fields/__init__.py
Normal file
0
src/helpers/models/fields/__init__.py
Normal file
@ -3,3 +3,4 @@ fastapi==0.109.0
|
|||||||
Django==5.0.2
|
Django==5.0.2
|
||||||
psycopg2
|
psycopg2
|
||||||
redis==4.6.0
|
redis==4.6.0
|
||||||
|
djangoql==0.18.1
|
Loading…
Reference in New Issue
Block a user