From e7e4dc82a2f67629fb437db0d9ce6893bdffb762 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Wed, 7 Jan 2015 12:27:08 +0100 Subject: [PATCH] Fixes email max length --- README.md | 7 ++++- dpdapi/migrations/0003_auto_20150107_1226.py | 32 ++++++++++++++++++++ dpdapi/models.py | 6 ++-- 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 dpdapi/migrations/0003_auto_20150107_1226.py diff --git a/README.md b/README.md index 5aabb42..ea83d9f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ +# Install + virtualenv venv + . venv/bin/activate + pip install -r requirements + # TODO - Fabfile with deploy task - Alias should only allow unique (source,destination) tuples # TODO later -- Create domain dir for dovecot? \ No newline at end of file +- Create domain dir for dovecot? diff --git a/dpdapi/migrations/0003_auto_20150107_1226.py b/dpdapi/migrations/0003_auto_20150107_1226.py new file mode 100644 index 0000000..713d16c --- /dev/null +++ b/dpdapi/migrations/0003_auto_20150107_1226.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dpdapi', '0002_auto_20150107_0309'), + ] + + operations = [ + migrations.AlterField( + model_name='alias', + name='destination', + field=models.EmailField(max_length=254), + preserve_default=True, + ), + migrations.AlterField( + model_name='alias', + name='source', + field=models.EmailField(max_length=254), + preserve_default=True, + ), + migrations.AlterField( + model_name='user', + name='email', + field=models.EmailField(unique=True, max_length=254), + preserve_default=True, + ), + ] diff --git a/dpdapi/models.py b/dpdapi/models.py index 81e9287..8950e61 100644 --- a/dpdapi/models.py +++ b/dpdapi/models.py @@ -11,8 +11,8 @@ class BaseModel(models.Model): class Alias(BaseModel): - source = models.EmailField() - destination = models.EmailField() + source = models.EmailField(max_length=254) + destination = models.EmailField(max_length=254) domain = models.ForeignKey('dpdapi.Domain') active = models.BooleanField(default=True) @@ -31,7 +31,7 @@ class Domain(BaseModel): class User(BaseModel): - email = models.EmailField(unique=True) + email = models.EmailField(max_length=254, unique=True) password = models.CharField(max_length=109) domain = models.ForeignKey('dpdapi.Domain')