SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit ebd5b883 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add AlternativeEmail

parent d3d4a083
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-09-30 05:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles', '0002_auto_20180916_1643'),
]
operations = [
migrations.CreateModel(
name='AlternativeEmail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=254)),
('still_valid', models.BooleanField(default=True)),
],
),
migrations.AlterField(
model_name='profile',
name='email',
field=models.EmailField(max_length=254),
),
migrations.AddField(
model_name='alternativeemail',
name='profile',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='profiles.Profile'),
),
]
......@@ -36,7 +36,7 @@ class Profile(models.Model):
title = models.CharField(max_length=4, choices=TITLE_CHOICES)
first_name = models.CharField(max_length=64)
last_name = models.CharField(max_length=64)
email = models.EmailField(unique=True)
email = models.EmailField()
discipline = models.CharField(max_length=20, choices=SCIPOST_DISCIPLINES,
default=DISCIPLINE_PHYSICS, verbose_name='Main discipline')
expertises = ChoiceArrayField(
......@@ -54,3 +54,16 @@ class Profile(models.Model):
def __str__(self):
return '%s, %s %s' % (self.last_name, self.get_title_display(), self.first_name)
class AlternativeEmail(models.Model):
"""
It is often the case that somebody has multiple email addresses.
The 'email' field of a given Profile, Contributor or other person-based object
is then interpreted as representing the current address.
An AlternativeEmail is bound to a Profile and holds info on eventual
secondary email addresses.
"""
profile = models.ForeignKey(Profile, on_delete=models.CASCADE)
email = models.EmailField()
still_valid = models.BooleanField(default=True)
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