]> git.parisson.com Git - mezzo.git/commitdiff
add links, start project, add magazine module
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 23 Jun 2016 20:58:25 +0000 (22:58 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 23 Jun 2016 20:58:25 +0000 (22:58 +0200)
app/magazine/__init__.py [new file with mode: 0644]
app/magazine/admin.py [new file with mode: 0644]
app/magazine/apps.py [new file with mode: 0644]
app/magazine/migrations/__init__.py [new file with mode: 0644]
app/magazine/models.py [new file with mode: 0644]
app/magazine/tests.py [new file with mode: 0644]
app/magazine/views.py [new file with mode: 0644]
app/organization/models.py
app/project/models.py

diff --git a/app/magazine/__init__.py b/app/magazine/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/magazine/admin.py b/app/magazine/admin.py
new file mode 100644 (file)
index 0000000..8c38f3f
--- /dev/null
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/app/magazine/apps.py b/app/magazine/apps.py
new file mode 100644 (file)
index 0000000..f4f5391
--- /dev/null
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+
+from django.apps import AppConfig
+
+
+class MagazineConfig(AppConfig):
+    name = 'magazine'
diff --git a/app/magazine/migrations/__init__.py b/app/magazine/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/magazine/models.py b/app/magazine/models.py
new file mode 100644 (file)
index 0000000..bd4b2ab
--- /dev/null
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+from django.db import models
+
+# Create your models here.
diff --git a/app/magazine/tests.py b/app/magazine/tests.py
new file mode 100644 (file)
index 0000000..7ce503c
--- /dev/null
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/app/magazine/views.py b/app/magazine/views.py
new file mode 100644 (file)
index 0000000..91ea44a
--- /dev/null
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
index 6edb0dba8b620324878befad84925e4c56f545a6..650551f6a255029c0d78233556e19ed51214f4a4 100644 (file)
@@ -107,6 +107,8 @@ class Person(Displayable, RichText, AdminThumbMixin):
 
     user = models.ForeignKey('User', verbose_name=_('user'), blank=True, null=True, on_delete=models.SET_NULL)
     title = models.CharField(_('Title'), max_length=16, choices=TITLE_CHOICES, blank=True)
+    first_name = models.CharField(_('first name'), max_length=255, blank=True, null=True, help="If no User linked")
+    last_name = models.CharField(_('last name'), max_length=255, blank=True, null=True)
     organization = models.ForeignKey('Organization', verbose_name=_('organization'), blank=True, null=True, on_delete=models.SET_NULL)
     bio = RichTextField(_('biography'), blank=True)
     photo = FileField(_('photo'), upload_to='images/photos', max_length=1024, blank=True, format="Image")
@@ -115,11 +117,48 @@ class Person(Displayable, RichText, AdminThumbMixin):
     photo_description = models.TextField(_('photo description'), blank=True)
     photo_featured = FileField(_('photo featured'), upload_to='images/photos', max_length=1024, blank=True, format="Image")
     photo_featured_credits = models.CharField(_('photo featured credits'), max_length=255, blank=True, null=True)
+    link = models.URLField(_('Link'), blank=True, null=True)
 
     def __unicode__(self):
         return ' '.join((self.user.first_name, self.user.last_name))
 
 
+class Link(models.Model):
+    """A person can have many links."""
+
+    person = models.ForeignKey(Person, verbose_name=_('Person'))
+    link_type = models.ForeignKey(LinkType, verbose_name=_('Link type'))
+    url = models.URLField(verbose_name=_('URL'))
+
+    def __str__(self):
+        return self.url
+
+
+class LinkType(TranslatableModel):
+    """
+    A link type could be ``Facebook`` or ``Twitter`` or ``Website``.
+    This is masterdata that should be created by the admins when the site is
+    deployed for the first time.
+    :ordering: Enter numbers here if you want links to be displayed in a
+      special order.
+    """
+
+    name=models.CharField(max_length=256, verbose_name=_('Name'))
+    slug = models.SlugField(max_length=256, verbose_name=_('Slug'), help_text=_(
+            'Use this field to define a simple identifier that can be used'
+            ' to style the different link types (i.e. assign social media'
+            ' icons to them)'),
+        blank=True,
+    )
+    ordering = models.PositiveIntegerField(verbose_name=_('Ordering'), null=True, blank=True)
+
+    class Meta:
+        ordering = ['ordering', ]
+
+    def __str__(self):
+        return self.name
+
+
 class Activity(models.Model):
     """(Activity description)"""
 
index 0d091e53aa86d6c73bc9559e7a97c6dd957098c4..ef1e267e74d1947d61a155f4ee3c4899bfab161b 100644 (file)
@@ -1,3 +1,16 @@
 from __future__ import unicode_literals
 
 from django.db import models
+
+from organization import Person
+
+
+
+
+class Project(Displayable, RichText):
+    """(Project description)"""
+
+    persons = models.ManyToManyField('Person', verbose_name=_('persons'))
+
+    def __unicode__(self):
+        return title