+# coding=utf-8
+from django.conf import settings
from django.db import models
-# Create your models here.
+
+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='/')
+
+ created = models.DateTimeField(u"Utworzono", auto_now_add=True)
+ updated = models.DateTimeField(u"Uaktualniono", auto_now=True)
+
+ class Meta:
+ verbose_name = u"Ulubiona lokalizacja"
+ verbose_name_plural = u"Ulubione lokalizacje"
+ unique_together = ('owner', 'host', 'path')
+
+ def __unicode__(self):
+ return u'{}{} ({})'.format(self.host, self.path, self.owner)