Uprava poznamek na neomez. vel., uprava inline adminu
This commit is contained in:
parent
93b66fe0ec
commit
ff0aac3d57
3 changed files with 38 additions and 28 deletions
|
@ -1,10 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from django.contrib import admin
|
||||
from django import forms
|
||||
from django.forms import widgets
|
||||
import reversion
|
||||
from solo.admin import SingletonModelAdmin
|
||||
from ckeditor.widgets import CKEditorWidget
|
||||
from django.db.models import Count
|
||||
from django.db import models
|
||||
|
||||
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici
|
||||
import autocomplete_light
|
||||
|
@ -31,6 +33,9 @@ class CisloInline(admin.TabularInline):
|
|||
fields = ['cislo', 'datum_vydani', 'datum_deadline', 'verejne_db', 'poznamka']
|
||||
readonly_fields = ['cislo']
|
||||
extra = 0
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
|
||||
def has_add_permission(self, req): return False
|
||||
|
||||
|
@ -39,16 +44,21 @@ class PrilohaReseniInline(admin.StackedInline):
|
|||
model = PrilohaReseni
|
||||
fields = ['timestamp', 'soubor', 'poznamka']
|
||||
readonly_fields = ['timestamp']
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
|
||||
extra = 0
|
||||
|
||||
|
||||
class ReseniKProblemuInline(admin.TabularInline):
|
||||
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['resitel'], fields=['resitel'])
|
||||
model = Reseni
|
||||
fields = ['resitel', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka']
|
||||
readonly_fields = ['timestamp']
|
||||
extra = 0
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(ReseniKProblemuInline, self).get_queryset(request)
|
||||
|
@ -68,6 +78,9 @@ class ReseniKResiteliInline(admin.TabularInline):
|
|||
fields = ['problem', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka']
|
||||
readonly_fields = ['timestamp', 'problem']
|
||||
extra = 0
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
|
||||
def has_add_permission(self, req): return False
|
||||
|
||||
|
@ -89,6 +102,9 @@ class Soustredeni_UcastniciInline(admin.TabularInline):
|
|||
model = Soustredeni_Ucastnici
|
||||
fields = ['resitel', 'poznamka', ]
|
||||
extra = 0
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(Soustredeni_UcastniciInline, self).get_queryset(request)
|
||||
|
|
|
@ -11,16 +11,22 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='problem',
|
||||
options={'ordering': ['nazev'], 'verbose_name': 'Probl\xe9m', 'verbose_name_plural': 'Probl\xe9my'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='reseni',
|
||||
options={'ordering': ['problem_id', 'resitel_id'], 'verbose_name': '\u0158e\u0161en\xed', 'verbose_name_plural': '\u0158e\u0161en\xed'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='skola',
|
||||
options={'ordering': ['mesto', 'nazev'], 'verbose_name': '\u0160kola', 'verbose_name_plural': '\u0160koly'},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cislo',
|
||||
name='poznamka',
|
||||
field=models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u010d\xedslu (plain text)', max_length=128, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='prilohareseni',
|
||||
name='poznamka',
|
||||
field=models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k p\u0159\xedloze \u0159e\u0161en\xed (plain text), nap\u0159. o p\u016fvodu', max_length=128, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u010d\xedslu (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
|
@ -32,25 +38,13 @@ class Migration(migrations.Migration):
|
|||
migrations.AlterField(
|
||||
model_name='reseni',
|
||||
name='poznamka',
|
||||
field=models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', max_length=128, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='resitel',
|
||||
name='poznamka',
|
||||
field=models.TextField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161iteli (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='skola',
|
||||
name='poznamka',
|
||||
field=models.TextField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka ke \u0161kole (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='soustredeni_ucastnici',
|
||||
name='poznamka',
|
||||
field=models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', max_length=128, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -98,7 +98,7 @@ class Skola(SeminarModelBase):
|
|||
je_zs = models.BooleanField(u'základní stupeň', default=True)
|
||||
je_ss = models.BooleanField(u'střední stupeň', default=True)
|
||||
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka ke škole (plain text)')
|
||||
|
||||
def __str__(self):
|
||||
|
@ -172,7 +172,7 @@ class Resitel(SeminarModelBase):
|
|||
stat = CountryField(u'stát', default='CZ',
|
||||
help_text=u'ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)')
|
||||
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka k řešiteli (plain text)')
|
||||
|
||||
# Staré (do 2015) MAMOPER.MM_RIESITELIA.ID z DAKOS -- jen u importovaných záznamů
|
||||
|
@ -268,7 +268,7 @@ class Cislo(SeminarModelBase):
|
|||
|
||||
verejne_db = models.BooleanField(u'číslo zveřejněno', db_column='verejne', default=False)
|
||||
|
||||
poznamka = models.CharField(u'neveřejná poznámka', blank=True, max_length=128, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka k číslu (plain text)')
|
||||
|
||||
def kod(self):
|
||||
|
@ -422,7 +422,7 @@ class Reseni(SeminarModelBase):
|
|||
]
|
||||
forma = models.CharField(u'forma řešení', max_length=16, choices=FORMA_CHOICES, blank=False, default=FORMA_PAPIR)
|
||||
|
||||
poznamka = models.CharField(u'neveřejná poznámka', blank=True, max_length=128, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka k řešení (plain text)')
|
||||
|
||||
def __str__(self):
|
||||
|
@ -459,7 +459,7 @@ class PrilohaReseni(SeminarModelBase):
|
|||
|
||||
soubor = models.FileField(u'soubor', upload_to = generate_filename)
|
||||
|
||||
poznamka = models.CharField(u'neveřejná poznámka', blank=True, max_length=128, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka k příloze řešení (plain text), např. o původu')
|
||||
|
||||
def __str__(self):
|
||||
|
@ -522,7 +522,7 @@ class Soustredeni_Ucastnici(models.Model):
|
|||
|
||||
soustredeni = models.ForeignKey(Soustredeni, verbose_name=u'soustředění')
|
||||
|
||||
poznamka = models.CharField(u'neveřejná poznámka', max_length=128, blank=True, default='',
|
||||
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka k účasti (plain text)')
|
||||
|
||||
def __str__(self):
|
||||
|
|
Loading…
Reference in a new issue