88 lines
2.4 KiB
Python
88 lines
2.4 KiB
Python
from django.db import models
|
|
from admin_ordering.models import OrderableModel
|
|
from core.utils import SingletonModel
|
|
|
|
# Create your models here.
|
|
|
|
|
|
class AttachmentModel(OrderableModel):
|
|
upload_to = 'zalaczniki'
|
|
title = models.CharField('Tytuł', max_length=250)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
def _upload_to(self, filename):
|
|
return f'zarzad_{self.upload_to}/{filename}'
|
|
|
|
attachment = models.FileField('Plik pdf', upload_to=_upload_to)
|
|
|
|
class Meta(OrderableModel.Meta):
|
|
abstract = True
|
|
|
|
|
|
class Announcement(AttachmentModel):
|
|
upload_to = 'ogloszenia'
|
|
|
|
class Meta(OrderableModel.Meta):
|
|
verbose_name = 'Ogłoszenie'
|
|
verbose_name_plural = 'Ogłoszenia'
|
|
|
|
|
|
class Member(OrderableModel):
|
|
name = models.CharField('Imię i nazwisko', max_length=512)
|
|
contact = models.CharField('Dane kontaktowe', max_length=512)
|
|
function = models.CharField('Funkcja', max_length=512)
|
|
|
|
def __str__(self):
|
|
return f'{self.function} - {self.name}'
|
|
|
|
class Meta(OrderableModel.Meta):
|
|
verbose_name = 'Członek'
|
|
verbose_name_plural = 'Członkowie'
|
|
|
|
|
|
class Protocol(AttachmentModel):
|
|
upload_to = 'protokolyuchwaly'
|
|
extra = models.TextField('Dodatkowy opis', default='', blank=True)
|
|
year = models.IntegerField('Rok', blank=True, null=True)
|
|
|
|
class Meta(OrderableModel.Meta):
|
|
verbose_name = 'Protokół / Uchwała'
|
|
verbose_name_plural = 'Protokoły / Uchwały'
|
|
ordering = ['-year', 'ordering']
|
|
|
|
|
|
class Regulation(AttachmentModel):
|
|
upload_to = 'regulaminy'
|
|
|
|
class Meta(OrderableModel.Meta):
|
|
verbose_name = 'Regulamin'
|
|
verbose_name_plural = 'Regulaminy'
|
|
|
|
|
|
class RODO(models.Model):
|
|
who = models.CharField(
|
|
'Przez kogo przetwarzane dane osobowe?', max_length=512)
|
|
attachment = models.FileField('Plik pdf', upload_to='zarzad_rodo')
|
|
|
|
def __str__(self):
|
|
return f'RODO - {self.who}'
|
|
|
|
class Meta:
|
|
verbose_name = 'Dokument RODO'
|
|
verbose_name_plural = 'Dokumenty RODO'
|
|
|
|
|
|
class Statute(SingletonModel):
|
|
title = models.CharField('Tytuł', max_length=250)
|
|
attachment = models.FileField('Plik pdf', upload_to='zarzad_statuty')
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
class Meta:
|
|
verbose_name = 'Statut'
|
|
verbose_name_plural = 'Statut'
|