Adds twitter_username to Speaker

This change is based on the PyOhio fork located at: https://github.com/PyCon/pycon/search?utf8=%E2%9C%93&q=twitter_username
This commit is contained in:
Jeff Triplett 2016-03-14 22:24:14 -05:00
parent 2717e4c819
commit c7ce7fe020
4 changed files with 33 additions and 1 deletions

View file

@ -5,5 +5,5 @@ from symposion.speakers.models import Speaker
admin.site.register(Speaker,
list_display=["name", "email", "created"],
list_display=["name", "email", "created", "twitter_username"],
search_fields=["name"])

View file

@ -12,4 +12,11 @@ class SpeakerForm(forms.ModelForm):
"name",
"biography",
"photo",
"twitter_username",
]
def clean_twitter_username(self):
value = self.cleaned_data["twitter_username"]
if value.startswith("@"):
value = value[1:]
return value

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-15 03:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('symposion_speakers', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='speaker',
name='twitter_username',
field=models.CharField(blank=True, help_text='Your Twitter account', max_length=15),
),
]

View file

@ -30,6 +30,11 @@ class Speaker(models.Model):
"Markdown</a>."), verbose_name=_("Biography"))
biography_html = models.TextField(blank=True)
photo = models.ImageField(upload_to="speaker_photos", blank=True, verbose_name=_("Photo"))
twitter_username = models.CharField(
max_length=15,
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"))