Commit ae817a24 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Disable board name in adminform

parent 9671bb86
......@@ -3,6 +3,7 @@ from utils.translation import TranslatedModelAdmin
from . import models
@admin.register(models.Committee)
class CommitteeAdmin(TranslatedModelAdmin):
list_filter = ('until',)
......@@ -25,6 +26,15 @@ class CommitteeAdmin(TranslatedModelAdmin):
class BoardAdmin(TranslatedModelAdmin):
exclude = ('is_board',)
fieldsets = (
(None, {
'fields': (
'description', 'photo', 'permissions',
'since', 'until'
)
}),
)
@admin.register(models.CommitteeMembership)
class CommitteeMembershipAdmin(admin.ModelAdmin):
......
......@@ -3,6 +3,7 @@ import logging
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.contrib.auth.models import Permission
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils import timezone
......@@ -104,6 +105,12 @@ class Board(Committee):
default=True,
)
def clean(self):
for lang in settings.LANGUAGES:
field_name = '{}_{}'.format('name', lang[0])
setattr(self, field_name, '{} {} - {}'
.format('Board', self.since, self.until))
def get_absolute_url(self):
return reverse('committees:board', args=[str(self.pk)])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment