Move source names to a model.
[wolnelektury.git] / apps / catalogue / models / source.py
diff --git a/apps/catalogue/models/source.py b/apps/catalogue/models/source.py
new file mode 100644 (file)
index 0000000..f530e07
--- /dev/null
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+
+class Source(models.Model):
+    """A collection of books, which might be defined before publishing them."""
+    netloc = models.CharField(_('network location'), max_length=120, primary_key=True)
+    name = models.CharField(_('name'), max_length=120)
+
+    class Meta:
+        ordering = ('netloc',)
+        verbose_name = _('source')
+        verbose_name_plural = _('sources')
+        app_label = 'catalogue'
+
+    def __unicode__(self):
+        return self.netloc