Browse Source

Automaticke doplnovani cisla reseni u uloh

remotes/origin/feincms
Tomas Gavenciak 10 years ago
parent
commit
4bf299bf25
  1. 12
      seminar/models.py

12
seminar/models.py

@ -29,12 +29,6 @@ class SeminarModelBase(models.Model):
def verejne(self):
return False
# def public_url(self):
# if self.Meta.url_name:
# return reverse(self.Meta.url_name,
# kwargs={'id': self.id, 'pk': self.id})
# return None
def get_absolute_url(self):
return self.verejne_url() # TODO "absolute"
@ -440,6 +434,12 @@ class Reseni(SeminarModelBase):
return force_unicode(u"%s: %s (%sb)" % (self.resitel.plne_jmeno(), self.problem.nazev, self.body))
# NOTE: Potenciální DB HOG (bez select_related)
def save(self, *args, **kwargs):
if ((self.cislo_body is None) and (self.problem.cislo_reseni) and
(self.problem.typ == Problem.TYP_ULOHA)):
self.cislo_body = self.problem.cislo_reseni
super(Reseni, self).save(*args, **kwargs)
# PrilohaReseni method
def generate_filename(self, filename):

Loading…
Cancel
Save