Admin-Optionen
This commit is contained in:
@@ -40,4 +40,4 @@ Statt `python3 manage.py` müsste auch der direkte Aufruf des Skripts funktionie
|
|||||||
## Im- und Export
|
## Im- und Export
|
||||||
|
|
||||||
- YAML exportieren: `./manage.py dumpdata --format yaml --indent 2 -o ../fixtures/fixture.yaml`
|
- YAML exportieren: `./manage.py dumpdata --format yaml --indent 2 -o ../fixtures/fixture.yaml`
|
||||||
- `authors.yaml` importieren: `./manage.py import_authors <Pfad>`
|
- `authors.yml` importieren: `./manage.py import_authors <Pfad>`
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ from django.contrib.contenttypes.admin import GenericTabularInline, GenericStack
|
|||||||
# TODO: Links zu Suchseiten mit Vorbelegungen
|
# TODO: Links zu Suchseiten mit Vorbelegungen
|
||||||
|
|
||||||
|
|
||||||
|
## Inlines
|
||||||
|
|
||||||
|
|
||||||
class IdentityInline(admin.TabularInline):
|
class IdentityInline(admin.TabularInline):
|
||||||
model = Identity
|
model = Identity
|
||||||
ordering_field = ['alias',]
|
ordering_field = ['alias',]
|
||||||
@@ -42,10 +45,14 @@ class MediumInline(admin.TabularInline):
|
|||||||
#show_change_link = True
|
#show_change_link = True
|
||||||
|
|
||||||
|
|
||||||
|
## ModelAdmins
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Person)
|
@admin.register(Person)
|
||||||
class PersonAdmin(admin.ModelAdmin):
|
class PersonAdmin(admin.ModelAdmin):
|
||||||
list_display = Person.list_display
|
list_display = Person.list_display
|
||||||
search_fields = ('name', 'full_name', 'name_native', 'birth_name')
|
search_fields = ('name', 'full_name', 'name_native', 'birth_name')
|
||||||
|
list_editable = ('details_secret',)
|
||||||
inlines = [
|
inlines = [
|
||||||
IdentityInline,
|
IdentityInline,
|
||||||
AuthorIDInline,
|
AuthorIDInline,
|
||||||
@@ -58,7 +65,7 @@ class PersonAdmin(admin.ModelAdmin):
|
|||||||
class IdentityAdmin(admin.ModelAdmin):
|
class IdentityAdmin(admin.ModelAdmin):
|
||||||
list_display = Identity.list_display
|
list_display = Identity.list_display
|
||||||
search_fields = ('alias', 'organization')
|
search_fields = ('alias', 'organization')
|
||||||
list_filter = ['person', 'organization', TaggitListFilter]
|
list_filter = ['organization', TaggitListFilter]
|
||||||
exclude = ('tags',)
|
exclude = ('tags',)
|
||||||
inlines = [
|
inlines = [
|
||||||
TaggitTabularInline,
|
TaggitTabularInline,
|
||||||
@@ -68,12 +75,15 @@ class IdentityAdmin(admin.ModelAdmin):
|
|||||||
@admin.register(AuthorID)
|
@admin.register(AuthorID)
|
||||||
class AuthorIDAdmin(admin.ModelAdmin):
|
class AuthorIDAdmin(admin.ModelAdmin):
|
||||||
list_display = AuthorID.list_display
|
list_display = AuthorID.list_display
|
||||||
|
list_editable = ('key','value',)
|
||||||
|
list_filter = ('key',)
|
||||||
search_fields = ('value',)
|
search_fields = ('value',)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(AuthorURL)
|
@admin.register(AuthorURL)
|
||||||
class AuthorURLAdmin(admin.ModelAdmin):
|
class AuthorURLAdmin(admin.ModelAdmin):
|
||||||
list_display = AuthorURL.list_display
|
list_display = AuthorURL.list_display
|
||||||
|
list_editable = ('name','url',)
|
||||||
search_fields = ('url',)
|
search_fields = ('url',)
|
||||||
|
|
||||||
|
|
||||||
@@ -81,6 +91,7 @@ class AuthorURLAdmin(admin.ModelAdmin):
|
|||||||
class ContactAdmin(admin.ModelAdmin):
|
class ContactAdmin(admin.ModelAdmin):
|
||||||
date_hierarchy = 'last_try'
|
date_hierarchy = 'last_try'
|
||||||
list_display = Contact.list_display
|
list_display = Contact.list_display
|
||||||
|
list_editable = ('last_try','user','success',)
|
||||||
search_fields = ('name', 'address', 'remarks')
|
search_fields = ('name', 'address', 'remarks')
|
||||||
#prepopulated_fields = {'user': ('',)}
|
#prepopulated_fields = {'user': ('',)}
|
||||||
inlines = [
|
inlines = [
|
||||||
@@ -91,4 +102,6 @@ class ContactAdmin(admin.ModelAdmin):
|
|||||||
@admin.register(Medium)
|
@admin.register(Medium)
|
||||||
class MediumAdmin(admin.ModelAdmin):
|
class MediumAdmin(admin.ModelAdmin):
|
||||||
list_display = Medium.list_display
|
list_display = Medium.list_display
|
||||||
|
list_editable = ('key','value',)
|
||||||
|
list_filter = ('key',)
|
||||||
search_fields = ('value',)
|
search_fields = ('value',)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Person(models.Model):
|
|||||||
verbose_name_plural = 'Personen'
|
verbose_name_plural = 'Personen'
|
||||||
ordering = ['name','birth_year']
|
ordering = ['name','birth_year']
|
||||||
|
|
||||||
list_display = ['name', 'full_name', 'birth_year']
|
list_display = ['name', 'full_name', 'details_secret', 'birth_year']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@@ -211,6 +211,9 @@ class Contact(models.Model):
|
|||||||
models.Index(fields=["content_type", "object_id"]),
|
models.Index(fields=["content_type", "object_id"]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return str(self.content_object)
|
||||||
|
|
||||||
list_display = ['content_object', 'name', 'last_try', 'user', 'success']
|
list_display = ['content_object', 'name', 'last_try', 'user', 'success']
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user