X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=filex%2Fmodels.py;fp=filex%2Fmodels.py;h=235a3f45ec88d4ce9b8b9d8a634da1c21403f705;hb=e294545933a8f51a6c2a7f2246c010c78d92af03;hp=d2d3792ee7993d349143e1b11e88773c9842e55b;hpb=5456abffdf1fee64a216e7a8a6d09ba3fd01b3bd;p=qcg-portal.git diff --git a/filex/models.py b/filex/models.py index d2d3792..235a3f4 100644 --- a/filex/models.py +++ b/filex/models.py @@ -2,11 +2,13 @@ from django.conf import settings from django.db import models +from filex.validators import host_validator, path_validator + class Favorite(models.Model): owner = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u"Właściciel", related_name='favorites') - host = models.CharField(u"Host", max_length=256) - path = models.CharField(u"Ścieżka", max_length=1024, default='~') + host = models.CharField(u"Host", max_length=256, validators=[host_validator]) + path = models.CharField(u"Ścieżka", max_length=1024, default='~', validators=[path_validator]) created = models.DateTimeField(u"Utworzono", auto_now_add=True) updated = models.DateTimeField(u"Uaktualniono", auto_now=True) @@ -17,4 +19,4 @@ class Favorite(models.Model): unique_together = ('owner', 'host', 'path') def __unicode__(self): - return u'{}{} ({})'.format(self.host, self.path, self.owner) + return u'{}/{} ({})'.format(self.host, self.path, self.owner)