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

Commit

Permalink
Allow NULLable fields to be blank
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tkw1536 committed Oct 29, 2017
1 parent b1f4140 commit 72a1425
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 8 deletions.
55 changes: 55 additions & 0 deletions dreamjub/migrations/0004_auto_20171029_1427.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-29 14:27
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dreamjub', '0003_auto_20161204_2258'),
]

operations = [
migrations.AlterField(
model_name='student',
name='building',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='student',
name='college',
field=models.CharField(blank=True, choices=[('Krupp', 'Krupp College'), ('Mercator', 'Mercator College'), ('C3', 'College III'), ('Nordmetall', 'College Nordmetall')], max_length=255, null=True),
),
migrations.AlterField(
model_name='student',
name='country',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='student',
name='degree',
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),
),
migrations.AlterField(
model_name='student',
name='majorShort',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='student',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='faces/%Y/%m/%d/'),
),
migrations.AlterField(
model_name='student',
name='status',
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),
),
migrations.AlterField(
model_name='student',
name='year',
field=models.PositiveIntegerField(blank=True, null=True),
),
]
16 changes: 8 additions & 8 deletions dreamjub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def fullName(self):
return '%s %s' % (self.firstName, self.lastName)

# Colorfoul Info
country = models.TextField(null=True) #: Country of origin
picture = models.ImageField(null=True, upload_to='faces/%Y/%m/%d/') #:
country = models.TextField(blank=True, null=True) #: Country of origin
picture = models.ImageField(blank=True, null=True, upload_to='faces/%Y/%m/%d/') #:
# Picture (if available)

# College Contact Info
Expand All @@ -45,13 +45,13 @@ def fullName(self):
(MERCATOR, 'Mercator College'),
(COLLEGE_III, 'College III'),
(COLLEGE_NORDMETALL, 'College Nordmetall')
), null=True, max_length=255)
), blank=True, null=True, max_length=255)

# Physical contact information
phone = models.TextField(blank=True, null=True)
isCampusPhone = models.BooleanField(default=False)
room = models.TextField(blank=True, null=True)
building = models.CharField(null=True, max_length=255)
building = models.CharField(blank=True, null=True, max_length=255)

# Types of people
isStudent = models.BooleanField()
Expand All @@ -78,7 +78,7 @@ def fullName(self):

(WINTER, 'Winter School Student'),
(GUEST, 'Guest Student')
), null=True, max_length=255) #: current student status
), blank=True, null=True, max_length=255) #: current student status

#: Degree Status
BACHELOR_OF_SCIENCE = 'Bachelor of Science'
Expand All @@ -94,12 +94,12 @@ def fullName(self):
(MASTER_OF_ART, 'Master of Art'),

(PHD_DEGREE, 'PhD')
), null=True, max_length=255)
), blank=True, null=True, max_length=255)

# year and major
year = models.PositiveIntegerField(
null=True) #: (Last known) year of Graduation
majorShort = models.CharField(null=True, max_length=255)
blank=True, null=True) #: (Last known) year of Graduation
majorShort = models.CharField(blank=True, null=True, max_length=255)

# TODO: Fill this
MAJOR_NAMES_MAP = {
Expand Down

0 comments on commit 72a1425

Please sign in to comment.