SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9dcd4648 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Add static information models

Static information which is easier to track using the database,
 here the editorial college members shown on the about page,
 will be shown from the new model and not be hardcoded into the
 HTML templates.
parent e32ede58
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-03-18 20:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scipost', '0040_auto_20170317_1659'),
]
operations = [
migrations.CreateModel(
name='EditorialCollege',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('discipline', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='EditorialCollegeMember',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('title', models.CharField(blank=True, max_length=10)),
('link', models.URLField(blank=True)),
('subtitle', models.CharField(blank=True, max_length=255)),
('discipline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='member', to='scipost.EditorialCollege')),
],
),
]
...@@ -4,7 +4,6 @@ from django import forms ...@@ -4,7 +4,6 @@ from django import forms
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField
from django.db import models from django.db import models
from django.shortcuts import get_object_or_404
from django.template import Template, Context from django.template import Template, Context
from django.utils import timezone from django.utils import timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
...@@ -512,3 +511,27 @@ class SPBMembershipAgreement(models.Model): ...@@ -512,3 +511,27 @@ class SPBMembershipAgreement(models.Model):
return (str(self.partner) + return (str(self.partner) +
' [' + spb_membership_duration_dict[self.duration] + ' [' + spb_membership_duration_dict[self.duration] +
' from ' + self.start_date.strftime('%Y-%m-%d') + ']') ' from ' + self.start_date.strftime('%Y-%m-%d') + ']')
######################
# Static info models #
######################
class EditorialCollege(models.Model):
'''A SciPost Editorial College for a specific discipline.'''
discipline = models.CharField(max_length=255)
class EditorialCollegeMember(models.Model):
"""
Editorial College Members for non-functional use!
This model is used for static information purposes only.
"""
name = models.CharField(max_length=255)
title = models.CharField(max_length=10, blank=True)
link = models.URLField(blank=True)
subtitle = models.CharField(max_length=255, blank=True)
discipline = models.ForeignKey('scipost.EditorialCollege', related_name='member')
def __str__(self):
return ('%s %s' % (self.title, self.name)).strip()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment