X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=filex%2Fmodels.py;h=82e73b4aafb22b7cbe51171a97a320e372dd2ba4;hb=0531413dff86618983d7c6ae2f723b5051029e1b;hp=e7e82471bb002449a9db5dec1f384d69ca4c10c5;hpb=a0feb25389615e9d2ab2b036a491a1aeeb059a52;p=qcg-portal.git diff --git a/filex/models.py b/filex/models.py index e7e8247..82e73b4 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.utils 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)