diff --git a/requirements.txt b/requirements.txt index 1dbfb212397ecfd37a21f1fac65f3bafd5975002..b25c7e2fba57bc091dcc0578fac5910b75817117 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,14 +10,18 @@ django-mptt==0.8.6 django-simple-captcha==0.5.3 djangorestframework==3.5.3 docutils==0.12 +factory-boy==2.7.0 +fake-factory==0.7.2 feedparser==5.2.1 imagesize==0.7.1 Jinja2==2.8 Markdown==2.6.7 MarkupSafe==0.23 +pep8==1.7.0 Pillow==3.4.2 psycopg2==2.6.2 Pygments==2.1.3 +python-dateutil==2.6.0 pytz==2016.7 requests==2.12.1 six==1.10.0 diff --git a/theses/factories.py b/theses/factories.py new file mode 100644 index 0000000000000000000000000000000000000000..926d1c192b142c5637669be954235eb013fa3fd3 --- /dev/null +++ b/theses/factories.py @@ -0,0 +1,10 @@ +import factory +from . import models + + +class ThesisLinkFactory(factory.django.DjangoModelFactory): + class Meta: + model = models.ThesisLink + + vetted = True + type = models diff --git a/theses/models.py b/theses/models.py index 21d717e98592cfe06eacdac7b2979f3941dcd27f..b2bfe6242f5dafc54fc91c40b3336a3c33ba8881 100644 --- a/theses/models.py +++ b/theses/models.py @@ -8,15 +8,18 @@ from .models import * from journals.models import * from scipost.models import * -THESIS_TYPES = ( - ('MA', 'Master\'s'), - ('PhD', 'Ph.D.'), - ('Hab', 'Habilitation'), - ) -thesis_type_dict = dict(THESIS_TYPES) - class ThesisLink(models.Model): + MASTER_THESIS = 'MA' + PHD_THESIS = 'PhD' + HABILITATION_THESIS = 'Hab' + THESIS_TYPES = ( + (MASTER_THESIS, 'Master\'s'), + (PHD_THESIS, 'Ph.D.'), + (HABILITATION_THESIS, 'Habilitation'), + ) + thesis_type_dict = dict(THESIS_TYPES) + """ An URL pointing to a thesis """ requested_by = models.ForeignKey( Contributor, blank=True, null=True, @@ -26,7 +29,7 @@ class ThesisLink(models.Model): vetted_by = models.ForeignKey( Contributor, blank=True, null=True, on_delete=models.CASCADE) - type = models.CharField(max_length=3, choices=THESIS_TYPES) + type = models.CharField(choices=THESIS_TYPES) discipline = models.CharField( max_length=20, choices=SCIPOST_DISCIPLINES, default='physics')