From 0c09039e7c8a645279818adec3664fcbb9bc2468 Mon Sep 17 00:00:00 2001 From: Emilie Date: Thu, 7 Jul 2016 12:05:18 +0200 Subject: [PATCH] adding article custome type and merge --- .../migrations/0005_auto_20160706_1803.py | 30 --- .../migrations/0006_auto_20160706_1839.py | 23 -- .../migrations/0007_auto_20160706_1841.py | 25 --- .../migrations/0008_auto_20160707_1047.py | 30 --- app/custom/models.py | 28 --- app/magazine/migrations/0001_initial.py | 50 ----- .../migrations/0002_article_sub_title.py | 20 -- .../migrations/0003_auto_20160706_1810.py | 25 --- .../migrations/0004_auto_20160706_1820.py | 19 -- .../migrations/0005_auto_20160706_1831.py | 19 -- .../migrations/0006_auto_20160706_1839.py | 23 -- .../migrations/0007_auto_20160706_1841.py | 25 --- .../migrations/0008_auto_20160706_1852.py | 19 -- .../migrations/0009_auto_20160707_1047.py | 30 --- .../migrations/0010_auto_20160707_1115.py | 23 -- .../migrations/0011_auto_20160707_1125.py | 25 --- app/organization/core/admin.py | 5 - .../magazine/migrations/0002_article.py | 30 +++ app/organization/magazine/models.py | 3 +- .../magazine/translation.py} | 2 +- app/organization/project/admin.py | 2 +- app/settings.py | 1 - app/structure/models.py | 198 ------------------ 23 files changed, 33 insertions(+), 622 deletions(-) delete mode 100644 app/custom/migrations/0005_auto_20160706_1803.py delete mode 100644 app/custom/migrations/0006_auto_20160706_1839.py delete mode 100644 app/custom/migrations/0007_auto_20160706_1841.py delete mode 100644 app/custom/migrations/0008_auto_20160707_1047.py delete mode 100644 app/custom/models.py delete mode 100644 app/magazine/migrations/0001_initial.py delete mode 100644 app/magazine/migrations/0002_article_sub_title.py delete mode 100644 app/magazine/migrations/0003_auto_20160706_1810.py delete mode 100644 app/magazine/migrations/0004_auto_20160706_1820.py delete mode 100644 app/magazine/migrations/0005_auto_20160706_1831.py delete mode 100644 app/magazine/migrations/0006_auto_20160706_1839.py delete mode 100644 app/magazine/migrations/0007_auto_20160706_1841.py delete mode 100644 app/magazine/migrations/0008_auto_20160706_1852.py delete mode 100644 app/magazine/migrations/0009_auto_20160707_1047.py delete mode 100644 app/magazine/migrations/0010_auto_20160707_1115.py delete mode 100644 app/magazine/migrations/0011_auto_20160707_1125.py create mode 100644 app/organization/magazine/migrations/0002_article.py rename app/{magazine/translations.py => organization/magazine/translation.py} (91%) delete mode 100644 app/structure/models.py diff --git a/app/custom/migrations/0005_auto_20160706_1803.py b/app/custom/migrations/0005_auto_20160706_1803.py deleted file mode 100644 index 13527baa..00000000 --- a/app/custom/migrations/0005_auto_20160706_1803.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:03 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('custom', '0004_auto_20160705_1810'), - ] - - operations = [ - migrations.AlterField( - model_name='basicpage', - name='sub_title', - field=models.TextField(blank=True, max_length=1000, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='basicpage', - name='sub_title_en', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='basicpage', - name='sub_title_fr', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/custom/migrations/0006_auto_20160706_1839.py b/app/custom/migrations/0006_auto_20160706_1839.py deleted file mode 100644 index c8422e85..00000000 --- a/app/custom/migrations/0006_auto_20160706_1839.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:39 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('custom', '0005_auto_20160706_1803'), - ] - - operations = [ - migrations.RemoveField( - model_name='basicpage', - name='sub_title_en', - ), - migrations.RemoveField( - model_name='basicpage', - name='sub_title_fr', - ), - ] diff --git a/app/custom/migrations/0007_auto_20160706_1841.py b/app/custom/migrations/0007_auto_20160706_1841.py deleted file mode 100644 index 38bd79ba..00000000 --- a/app/custom/migrations/0007_auto_20160706_1841.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:41 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('custom', '0006_auto_20160706_1839'), - ] - - operations = [ - migrations.AddField( - model_name='basicpage', - name='sub_title_en', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AddField( - model_name='basicpage', - name='sub_title_fr', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/custom/migrations/0008_auto_20160707_1047.py b/app/custom/migrations/0008_auto_20160707_1047.py deleted file mode 100644 index a781714d..00000000 --- a/app/custom/migrations/0008_auto_20160707_1047.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-07 08:47 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('custom', '0007_auto_20160706_1841'), - ] - - operations = [ - migrations.AlterField( - model_name='basicpage', - name='sub_title', - field=models.CharField(blank=True, max_length=1000, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='basicpage', - name='sub_title_en', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='basicpage', - name='sub_title_fr', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/custom/models.py b/app/custom/models.py deleted file mode 100644 index 922db293..00000000 --- a/app/custom/models.py +++ /dev/null @@ -1,28 +0,0 @@ -from django.db import models -from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse, reverse_lazy -from mezzanine.pages.models import Page, RichText -from mezzanine.core.fields import RichTextField, OrderField, FileField -from django.conf import settings - - -ALIGNMENT_CHOICES = (('left', _('left')), ('right', _('right'))) -MEDIA_BASE_URL = getattr(settings, 'MEDIA_BASE_URL', 'http://medias.ircam.fr/embed/media/') - -# class SubTitle(models.Model): -# -# sub_title = models.TextField(_('sub title'), blank=True, max_length=1000) -# class Meta: -# abstract = True - - -class BasicPage(Page, RichText): - - sub_title = models.CharField(_('sub title'), blank=True, max_length=1000) - # description = models.TextField(_('description'), blank=True) - photo = FileField(_('photo'), upload_to='images/photos', max_length=1024, blank=True, format="Image") - photo_credits = models.CharField(_('photo credits'), max_length=255, blank=True, null=True) - photo_alignment = models.CharField(_('photo alignment'), choices=ALIGNMENT_CHOICES, max_length=32, default="left", blank=True) - 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) diff --git a/app/magazine/migrations/0001_initial.py b/app/magazine/migrations/0001_initial.py deleted file mode 100644 index bf9fec82..00000000 --- a/app/magazine/migrations/0001_initial.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 15:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('blog', '0003_auto_20151223_1313'), - ] - - operations = [ - migrations.CreateModel( - name='Article', - fields=[ - ('blogpost_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='blog.BlogPost')), - ], - options={ - 'abstract': False, - }, - bases=('blog.blogpost',), - ), - migrations.CreateModel( - name='Category', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=512, verbose_name='name')), - ('description', models.TextField(blank=True, verbose_name='description')), - ], - options={ - 'verbose_name': 'category', - }, - ), - migrations.CreateModel( - name='Topic', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=512, verbose_name='name')), - ('description', models.TextField(blank=True, verbose_name='description')), - ], - options={ - 'verbose_name': 'topic', - }, - ), - ] diff --git a/app/magazine/migrations/0002_article_sub_title.py b/app/magazine/migrations/0002_article_sub_title.py deleted file mode 100644 index 7cf39221..00000000 --- a/app/magazine/migrations/0002_article_sub_title.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:07 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='article', - name='sub_title', - field=models.TextField(blank=True, max_length=1000, verbose_name='sub title'), - ), - ] diff --git a/app/magazine/migrations/0003_auto_20160706_1810.py b/app/magazine/migrations/0003_auto_20160706_1810.py deleted file mode 100644 index 8085487e..00000000 --- a/app/magazine/migrations/0003_auto_20160706_1810.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:10 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0002_article_sub_title'), - ] - - operations = [ - migrations.AddField( - model_name='article', - name='sub_title_en', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AddField( - model_name='article', - name='sub_title_fr', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/magazine/migrations/0004_auto_20160706_1820.py b/app/magazine/migrations/0004_auto_20160706_1820.py deleted file mode 100644 index 6c8cba82..00000000 --- a/app/magazine/migrations/0004_auto_20160706_1820.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:20 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0003_auto_20160706_1810'), - ] - - operations = [ - migrations.AlterModelOptions( - name='article', - options={'verbose_name': 'article'}, - ), - ] diff --git a/app/magazine/migrations/0005_auto_20160706_1831.py b/app/magazine/migrations/0005_auto_20160706_1831.py deleted file mode 100644 index 5835bf9f..00000000 --- a/app/magazine/migrations/0005_auto_20160706_1831.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:31 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0004_auto_20160706_1820'), - ] - - operations = [ - migrations.AlterModelOptions( - name='article', - options={}, - ), - ] diff --git a/app/magazine/migrations/0006_auto_20160706_1839.py b/app/magazine/migrations/0006_auto_20160706_1839.py deleted file mode 100644 index 4123d5be..00000000 --- a/app/magazine/migrations/0006_auto_20160706_1839.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:39 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0005_auto_20160706_1831'), - ] - - operations = [ - migrations.RemoveField( - model_name='article', - name='sub_title_en', - ), - migrations.RemoveField( - model_name='article', - name='sub_title_fr', - ), - ] diff --git a/app/magazine/migrations/0007_auto_20160706_1841.py b/app/magazine/migrations/0007_auto_20160706_1841.py deleted file mode 100644 index 19d320f3..00000000 --- a/app/magazine/migrations/0007_auto_20160706_1841.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:41 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0006_auto_20160706_1839'), - ] - - operations = [ - migrations.AddField( - model_name='article', - name='sub_title_en', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AddField( - model_name='article', - name='sub_title_fr', - field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/magazine/migrations/0008_auto_20160706_1852.py b/app/magazine/migrations/0008_auto_20160706_1852.py deleted file mode 100644 index d3c2b121..00000000 --- a/app/magazine/migrations/0008_auto_20160706_1852.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-06 16:52 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0007_auto_20160706_1841'), - ] - - operations = [ - migrations.AlterModelOptions( - name='article', - options={'verbose_name': 'article'}, - ), - ] diff --git a/app/magazine/migrations/0009_auto_20160707_1047.py b/app/magazine/migrations/0009_auto_20160707_1047.py deleted file mode 100644 index cf8c6f75..00000000 --- a/app/magazine/migrations/0009_auto_20160707_1047.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-07 08:47 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0008_auto_20160706_1852'), - ] - - operations = [ - migrations.AlterField( - model_name='article', - name='sub_title', - field=models.CharField(blank=True, max_length=1000, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='article', - name='sub_title_en', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AlterField( - model_name='article', - name='sub_title_fr', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/magazine/migrations/0010_auto_20160707_1115.py b/app/magazine/migrations/0010_auto_20160707_1115.py deleted file mode 100644 index 99f5b9c0..00000000 --- a/app/magazine/migrations/0010_auto_20160707_1115.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-07 09:24 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0009_auto_20160707_1047'), - ] - - operations = [ - migrations.RemoveField( - model_name='article', - name='sub_title_en', - ), - migrations.RemoveField( - model_name='article', - name='sub_title_fr', - ), - ] diff --git a/app/magazine/migrations/0011_auto_20160707_1125.py b/app/magazine/migrations/0011_auto_20160707_1125.py deleted file mode 100644 index 44cb3285..00000000 --- a/app/magazine/migrations/0011_auto_20160707_1125.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-07-07 09:25 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('magazine', '0010_auto_20160707_1115'), - ] - - operations = [ - migrations.AddField( - model_name='article', - name='sub_title_en', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - migrations.AddField( - model_name='article', - name='sub_title_fr', - field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'), - ), - ] diff --git a/app/organization/core/admin.py b/app/organization/core/admin.py index 7c1ae9bc..082f871a 100644 --- a/app/organization/core/admin.py +++ b/app/organization/core/admin.py @@ -3,12 +3,7 @@ from copy import deepcopy from mezzanine.pages.models import Page from mezzanine.pages.admin import PageAdmin from mezzanine.pages.models import RichTextPage -<<<<<<< HEAD:app/organization/core/admin.py from organization.core.models import BasicPage -======= -from mezzanine.core.admin import DisplayableAdmin -from custom.models import BasicPage ->>>>>>> article:app/custom/admin.py # class SubTitleAdmin(DisplayableAdmin): diff --git a/app/organization/magazine/migrations/0002_article.py b/app/organization/magazine/migrations/0002_article.py new file mode 100644 index 00000000..63704801 --- /dev/null +++ b/app/organization/magazine/migrations/0002_article.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-07 10:01 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0003_auto_20151223_1313'), + ('organization magazine', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Article', + fields=[ + ('blogpost_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='blog.BlogPost')), + ('sub_title', models.CharField(blank=True, max_length=1000, verbose_name='sub title')), + ('sub_title_fr', models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title')), + ('sub_title_en', models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title')), + ], + options={ + 'verbose_name': 'article', + }, + bases=('blog.blogpost',), + ), + ] diff --git a/app/organization/magazine/models.py b/app/organization/magazine/models.py index 1897fbae..53dd878a 100644 --- a/app/organization/magazine/models.py +++ b/app/organization/magazine/models.py @@ -6,11 +6,10 @@ from mezzanine.blog.models import BlogPost from organization.core.models import Named class Article(BlogPost): -from organization.core.models import Named sub_title = models.CharField(_('sub title'), blank=True, max_length=1000) - class Meta: + class Meta: verbose_name = _('article') class Category(Named): diff --git a/app/magazine/translations.py b/app/organization/magazine/translation.py similarity index 91% rename from app/magazine/translations.py rename to app/organization/magazine/translation.py index ba743be2..db66e9b1 100644 --- a/app/magazine/translations.py +++ b/app/organization/magazine/translation.py @@ -4,7 +4,7 @@ from modeltranslation.translator import TranslationOptions from mezzanine.core.translation import (TranslatedSlugged, TranslatedDisplayable, TranslatedRichText) -from magazine.models import Article +from organization.magazine.models import Article @register(Article) #class ArticleTranslationOptions(TranslatedDisplayable, TranslatedRichText): diff --git a/app/organization/project/admin.py b/app/organization/project/admin.py index 1ea6c2ff..988416d5 100644 --- a/app/organization/project/admin.py +++ b/app/organization/project/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin from mezzanine.blog.admin import BlogPostAdmin -from magazine.models import Article +from organization.magazine.models import Article #from custom.admin import SubTitleAdmin from copy import deepcopy diff --git a/app/settings.py b/app/settings.py index f0fbaf50..eaa2f40d 100644 --- a/app/settings.py +++ b/app/settings.py @@ -220,7 +220,6 @@ INSTALLED_APPS = [ "mezzanine.accounts", # "mezzanine.mobile", # "eve", - "magazine", 'djangobower', "meta", "mezzanine_agenda", diff --git a/app/structure/models.py b/app/structure/models.py deleted file mode 100644 index ec2b748d..00000000 --- a/app/structure/models.py +++ /dev/null @@ -1,198 +0,0 @@ -from __future__ import unicode_literals - -import os -import re -import pwd -import time -import urllib -import string -import datetime -import mimetypes - -from django.db import models -from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse, reverse_lazy -from django.conf import settings -from django.contrib.auth.models import User - -from mezzanine.core.models import RichText, Displayable, Slugged -from mezzanine.core.fields import RichTextField, OrderField, FileField -from mezzanine.utils.models import AdminThumbMixin, upload_to - -from django_countries.fields import CountryField - -from organization.media.models import Photos - - -# Hack to have these strings translated -mr = _('Mr') -mrs = _('Ms') - -GENDER_CHOICES = [ - ('male', _('male')), - ('female', _('female')), -] - -TITLE_CHOICES = [ - ('Dr', _('Dr')), - ('Prof', _('Prof')), - ('Prof Dr', _('Prof Dr')), -] - -ALIGNMENT_CHOICES = (('left', _('left')), ('right', _('right'))) - - -class Named(models.Model): - """Named object with description""" - - name = models.CharField(_('name'), max_length=512) - description = models.TextField(_('description'), blank=True) - - class Meta: - abstract = True - - def __unicode__(self): - return self.name - - @property - def slug(self): - return slugify(self.__unicode__()) - - -class AddressMixin(models.Model): - """(Address description)""" - - address = models.TextField(_('description'), blank=True) - postal_code = models.CharField(_('postal code'), max_length=16, blank=True) - country = CountryField(_('country')) - - def __unicode__(self): - return u"Address" - - class Meta: - abstract = True - - -class Organization(Named, AddressMixin): - """(Organization description)""" - - type = models.ForeignKey('OrganizationType', verbose_name=_('organization type'), blank=True, null=True, on_delete=models.SET_NULL) - url = models.URLField(_('URL'), max_length=512, blank=True) - - def __unicode__(self): - return self.name - - class Meta: - verbose_name = _('organization') - - -class OrganizationType(Named): - """(OrganizationType description)""" - - class Meta: - verbose_name = _('organization type') - - -class Department(Named): - """(Department description)""" - - organization = models.ForeignKey('Organization', verbose_name=_('organization')) - url = models.URLField(_('URL'), max_length=512, blank=True) - weaving_class = models.CharField(_('weaving class'), max_length=64, blank=True) - - def __unicode__(self): - return self.name - - class Meta: - verbose_name = _('department') - - -class Team(Named): - """(Team description)""" - - department = models.ForeignKey('Department', verbose_name=_('department'), blank=True, null=True, on_delete=models.SET_NULL) - - def __unicode__(self): - return u"Team" - - -class Person(Displayable, RichText, AdminThumbMixin, Photos): - """(Person description)""" - - 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) - gender = models.CharField(_('gender'), max_length=16, choices=GENDER_CHOICES, blank=True) - first_name = models.CharField(_('first name'), max_length=255, blank=True, null=True) - last_name = models.CharField(_('last name'), max_length=255, blank=True, null=True) - birthday = models.DateField(_('birthday'), blank=True) - organization = models.ForeignKey('Organization', verbose_name=_('organization'), blank=True, null=True, on_delete=models.SET_NULL) - - def __unicode__(self): - return ' '.join((self.user.first_name, self.user.last_name)) - - -class Nationality(models.Model): - """(Nationality description)""" - - name = models.CharField(_('name')) - - def __unicode__(self): - return self.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(models.Model): - """ - 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)""" - - person = models.ForeignKey('Person', verbose_name=_('person')) - teams = models.ManyToManyField('Team', verbose_name=_('teams')) - date_begin = models.DateField(_('begin date'), null=True, blank=True) - date_end = models.DateField(_('end date'), null=True, blank=True) - role = models.CharField(_('role'), blank=True, max_length=512) - work = models.TextField(_('work'), blank=True) - - def __unicode__(self): - return ' - '.join((self.person, self.role, self.date_begin, self.date_end)) - - -class Modelname(models.Model): - """( description)""" - - - def __unicode__(self): - return u"" -- 2.39.5