Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 3f6db84

Browse files
committed
Allow NULLable fields to be blank
Several fields in the Student model were allowed to be NULL, but were still required to be non-blank in the admin interface. This commit updates the model so that all fields in the Student model which have null=True also have blank=True
1 parent b1f4140 commit 3f6db84

File tree

2 files changed

+64
-8
lines changed

2 files changed

+64
-8
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.6 on 2017-10-29 14:27
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('dreamjub', '0003_auto_20161204_2258'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='student',
17+
name='building',
18+
field=models.CharField(blank=True, max_length=255, null=True),
19+
),
20+
migrations.AlterField(
21+
model_name='student',
22+
name='college',
23+
field=models.CharField(blank=True, choices=[('Krupp', 'Krupp College'), ('Mercator', 'Mercator College'), ('C3', 'College III'), ('Nordmetall', 'College Nordmetall')], max_length=255, null=True),
24+
),
25+
migrations.AlterField(
26+
model_name='student',
27+
name='country',
28+
field=models.TextField(blank=True, null=True),
29+
),
30+
migrations.AlterField(
31+
model_name='student',
32+
name='degree',
33+
field=models.CharField(blank=True, choices=[('Bachelor of Science', 'Bachelor of Science'), ('Bachelor of Art', 'Bachelor of Art'), ('Master of Science', 'Master of Science'), ('Master of Art', 'Master of Art'), ('PhD', 'PhD')], max_length=255, null=True),
34+
),
35+
migrations.AlterField(
36+
model_name='student',
37+
name='majorShort',
38+
field=models.CharField(blank=True, max_length=255, null=True),
39+
),
40+
migrations.AlterField(
41+
model_name='student',
42+
name='picture',
43+
field=models.ImageField(blank=True, null=True, upload_to='faces/%Y/%m/%d/'),
44+
),
45+
migrations.AlterField(
46+
model_name='student',
47+
name='status',
48+
field=models.CharField(blank=True, choices=[('foundation-year', 'Foundation Year'), ('medprep', 'Medprep'), ('undergrad', 'Undergraduate'), ('master', 'Master'), ('phd-integrated', 'integrated PhD'), ('phd', 'PhD'), ('winter', 'Winter School Student'), ('guest', 'Guest Student')], max_length=255, null=True),
49+
),
50+
migrations.AlterField(
51+
model_name='student',
52+
name='year',
53+
field=models.PositiveIntegerField(blank=True, null=True),
54+
),
55+
]

dreamjub/models.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ def fullName(self):
3131
return '%s %s' % (self.firstName, self.lastName)
3232

3333
# Colorfoul Info
34-
country = models.TextField(null=True) #: Country of origin
35-
picture = models.ImageField(null=True, upload_to='faces/%Y/%m/%d/') #:
34+
country = models.TextField(blank=True, null=True) #: Country of origin
35+
picture = models.ImageField(blank=True, null=True,
36+
upload_to='faces/%Y/%m/%d/') #:
3637
# Picture (if available)
3738

3839
# College Contact Info
@@ -45,13 +46,13 @@ def fullName(self):
4546
(MERCATOR, 'Mercator College'),
4647
(COLLEGE_III, 'College III'),
4748
(COLLEGE_NORDMETALL, 'College Nordmetall')
48-
), null=True, max_length=255)
49+
), blank=True, null=True, max_length=255)
4950

5051
# Physical contact information
5152
phone = models.TextField(blank=True, null=True)
5253
isCampusPhone = models.BooleanField(default=False)
5354
room = models.TextField(blank=True, null=True)
54-
building = models.CharField(null=True, max_length=255)
55+
building = models.CharField(blank=True, null=True, max_length=255)
5556

5657
# Types of people
5758
isStudent = models.BooleanField()
@@ -78,7 +79,7 @@ def fullName(self):
7879

7980
(WINTER, 'Winter School Student'),
8081
(GUEST, 'Guest Student')
81-
), null=True, max_length=255) #: current student status
82+
), blank=True, null=True, max_length=255) #: current student status
8283

8384
#: Degree Status
8485
BACHELOR_OF_SCIENCE = 'Bachelor of Science'
@@ -94,12 +95,12 @@ def fullName(self):
9495
(MASTER_OF_ART, 'Master of Art'),
9596

9697
(PHD_DEGREE, 'PhD')
97-
), null=True, max_length=255)
98+
), blank=True, null=True, max_length=255)
9899

99100
# year and major
100101
year = models.PositiveIntegerField(
101-
null=True) #: (Last known) year of Graduation
102-
majorShort = models.CharField(null=True, max_length=255)
102+
blank=True, null=True) #: (Last known) year of Graduation
103+
majorShort = models.CharField(blank=True, null=True, max_length=255)
103104

104105
# TODO: Fill this
105106
MAJOR_NAMES_MAP = {

0 commit comments

Comments
 (0)