Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some fields on Speaker model optional. #155

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions symposion/speakers/migrations/0003_make_fields_optional.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-20 07:40
from __future__ import unicode_literals

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('symposion_speakers', '0002_speaker_twitter_username'),
]

operations = [
migrations.AlterField(
model_name='speaker',
name='annotation',
field=models.TextField(blank=True, verbose_name='Annotation'),
),
migrations.AlterField(
model_name='speaker',
name='created',
field=models.DateTimeField(default=datetime.datetime.now, editable=False, verbose_name='Created'),
),
migrations.AlterField(
model_name='speaker',
name='invite_email',
field=models.CharField(blank=True, db_index=True, default='', max_length=200, verbose_name='Invite_email'),
),
migrations.AlterField(
model_name='speaker',
name='invite_token',
field=models.CharField(blank=True, db_index=True, max_length=40, verbose_name='Invite token'),
),
migrations.AlterField(
model_name='speaker',
name='user',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='speaker_profile', to=settings.AUTH_USER_MODEL, verbose_name='User'),
),
]
8 changes: 4 additions & 4 deletions symposion/speakers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Speaker(models.Model):
(2, "Two")
]

user = models.OneToOneField(User, null=True, related_name="speaker_profile", verbose_name=_("User"))
user = models.OneToOneField(User, blank=True, null=True, related_name="speaker_profile", verbose_name=_("User"))
name = models.CharField(verbose_name=_("Name"), max_length=100,
help_text=_("As you would like it to appear in the"
" conference program."))
Expand All @@ -35,9 +35,9 @@ class Speaker(models.Model):
blank=True,
help_text=_(u"Your Twitter account")
)
annotation = models.TextField(verbose_name=_("Annotation")) # staff only
invite_email = models.CharField(max_length=200, unique=True, null=True, db_index=True, verbose_name=_("Invite_email"))
invite_token = models.CharField(max_length=40, db_index=True, verbose_name=_("Invite token"))
annotation = models.TextField(blank=True, verbose_name=_("Annotation")) # staff only
invite_email = models.CharField(blank=True, default="", max_length=200, db_index=True, verbose_name=_("Invite_email"))
invite_token = models.CharField(blank=True, max_length=40, db_index=True, verbose_name=_("Invite token"))
created = models.DateTimeField(
default=datetime.datetime.now,
editable=False,
Expand Down
2 changes: 1 addition & 1 deletion symposion/speakers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def speaker_create(request):
speaker = form.save(commit=False)
speaker.user = request.user
if not found:
speaker.invite_email = None
speaker.invite_email = ""
speaker.save()
messages.success(request, _("Speaker profile created."))
return redirect("dashboard")
Expand Down