d2d3792ee7993d349143e1b11e88773c9842e55b
[qcg-portal.git] / filex / models.py
1 # coding=utf-8
2 from django.conf import settings
3 from django.db import models
4
5
6 class Favorite(models.Model):
7     owner = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u"Właściciel", related_name='favorites')
8     host = models.CharField(u"Host", max_length=256)
9     path = models.CharField(u"Ścieżka", max_length=1024, default='~')
10
11     created = models.DateTimeField(u"Utworzono", auto_now_add=True)
12     updated = models.DateTimeField(u"Uaktualniono", auto_now=True)
13
14     class Meta:
15         verbose_name = u"Ulubiona lokalizacja"
16         verbose_name_plural = u"Ulubione lokalizacje"
17         unique_together = ('owner', 'host', 'path')
18
19     def __unicode__(self):
20         return u'{}{} ({})'.format(self.host, self.path, self.owner)