File: admin.py

package info (click to toggle)
python-django-pint 0.7.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: python: 1,531; makefile: 28; sh: 12
file content (26 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from django.contrib import admin

from .models import *  # noqa: F401, F403


class ReadOnlyEditing(admin.ModelAdmin):
    def get_readonly_fields(self, request, obj=None):
        if obj is not None:
            return list(self.get_fields(request))
        return []


admin.site.register(BigIntFieldSaveModel, ReadOnlyEditing)
admin.site.register(ChoicesDefinedInModel, ReadOnlyEditing)
admin.site.register(ChoicesDefinedInModelInt, ReadOnlyEditing)
admin.site.register(CustomUregDecimalHayBale, ReadOnlyEditing)
admin.site.register(CustomUregHayBale, ReadOnlyEditing)
admin.site.register(DecimalFieldSaveModel, ReadOnlyEditing)
admin.site.register(EmptyHayBaleBigInt, ReadOnlyEditing)
admin.site.register(EmptyHayBaleDecimal, ReadOnlyEditing)
admin.site.register(EmptyHayBaleFloat, ReadOnlyEditing)
admin.site.register(EmptyHayBaleInt, ReadOnlyEditing)
admin.site.register(FloatFieldSaveModel, ReadOnlyEditing)
admin.site.register(HayBale, ReadOnlyEditing)
admin.site.register(IntFieldSaveModel, ReadOnlyEditing)
admin.site.register(OffsetUnitFloatFieldSaveModel, ReadOnlyEditing)