Files
@ 64b4d93470bd
Branch filter:
Location: symposion_app/vendor/symposion/speakers/models.py - annotation
64b4d93470bd
6.7 KiB
text/x-python
Add django-user-accounts app for use in place of SSO
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 2b7f5546a094 2b7f5546a094 67433cacb46f 252697b842c0 67433cacb46f 2b7f5546a094 252697b842c0 2b7f5546a094 f72490b1eb01 f72490b1eb01 a36ff64a8205 a36ff64a8205 2b7f5546a094 252697b842c0 252697b842c0 2b7f5546a094 2b7f5546a094 36ab6d599ffc 252697b842c0 252697b842c0 252697b842c0 252697b842c0 252697b842c0 252697b842c0 252697b842c0 3207621058b8 3207621058b8 e17df73dde6e 630bf4086135 630bf4086135 630bf4086135 630bf4086135 aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a a36ff64a8205 a36ff64a8205 aa56ac00c36a aa56ac00c36a 11f697d13757 aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a a36ff64a8205 a36ff64a8205 aa56ac00c36a aa56ac00c36a aa56ac00c36a 3207621058b8 aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a f72490b1eb01 f72490b1eb01 f72490b1eb01 f72490b1eb01 f72490b1eb01 f72490b1eb01 f72490b1eb01 aa56ac00c36a aa56ac00c36a aa56ac00c36a aa56ac00c36a c7ce7fe02068 c7ce7fe02068 c7ce7fe02068 c7ce7fe02068 c7ce7fe02068 630bf4086135 630bf4086135 630bf4086135 630bf4086135 630bf4086135 217f2f32c169 217f2f32c169 8cdda4242a49 8cdda4242a49 8cdda4242a49 8cdda4242a49 aa56ac00c36a 217f2f32c169 217f2f32c169 f64a7573d3e7 630bf4086135 41f6d067dd14 217f2f32c169 217f2f32c169 217f2f32c169 217f2f32c169 f64a7573d3e7 41f6d067dd14 41f6d067dd14 217f2f32c169 217f2f32c169 41f6d067dd14 41f6d067dd14 41f6d067dd14 630bf4086135 41f6d067dd14 41f6d067dd14 41f6d067dd14 41f6d067dd14 41f6d067dd14 41f6d067dd14 c0e9b90476d3 c0e9b90476d3 274f8ac966cb 128148ba20a6 274f8ac966cb 274f8ac966cb 274f8ac966cb 128148ba20a6 274f8ac966cb c0e9b90476d3 217f2f32c169 3207621058b8 3207621058b8 3207621058b8 2b7f5546a094 36ab6d599ffc 3207621058b8 3207621058b8 2b7f5546a094 40b04240d4ae 40b04240d4ae 40b04240d4ae 3207621058b8 3207621058b8 dbb4ebbb7044 36ab6d599ffc 11f697d13757 11f697d13757 aa56ac00c36a 388c722ed631 41f6d067dd14 11f697d13757 11f697d13757 a95825ede8d4 2b7f5546a094 2b7f5546a094 2b7f5546a094 a95825ede8d4 40b04240d4ae 2b7f5546a094 2b7f5546a094 36ab6d599ffc 2b7f5546a094 2b7f5546a094 2b7f5546a094 2b7f5546a094 2b7f5546a094 2b7f5546a094 36ab6d599ffc c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 c1ff1546fe43 72b5c3ff556d 72b5c3ff556d 72b5c3ff556d 72b5c3ff556d 72b5c3ff556d | import datetime
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
from timezone_field import TimeZoneField
from symposion import constants
from symposion.text_parser import parse
User = get_user_model()
class Speaker(models.Model):
user = models.OneToOneField(
User,
null=True,
related_name="speaker_profile",
verbose_name=_("User"),
on_delete=models.CASCADE,
)
name = models.CharField(verbose_name=_("Name"), max_length=100,
help_text=_("As you would like it to appear in the"
" conference programme."))
pronouns = models.CharField(verbose_name=_("Pronouns"),
max_length=20,
blank=True,
)
biography = models.TextField(
blank=True,
help_text=_("This will appear on the conference website and in the "
"programme. Please write in the third person, eg 'Alice "
"is a Moblin hacker...', 150-200 words. " +
constants.TEXT_FIELD_MONOSPACE_NOTE),
verbose_name=_("Biography"),
)
biography_html = models.TextField(blank=True)
experience = models.TextField(
blank=True,
help_text=_("Have you had any experience presenting elsewhere? If so, "
"we'd like to know. Anything you put here will only be "
"seen by the organisers and reviewers; use it to convince "
"them why they should accept your proposal. " +
constants.TEXT_FIELD_MONOSPACE_NOTE),
verbose_name=_("Speaking experience"),
)
experience_html = models.TextField(blank=True)
photo = models.ImageField(upload_to="speaker_photos", blank=True, verbose_name=_("Photo"))
telephone = models.CharField(
max_length=15,
help_text=_(u"The conference team will need this to contact you "
"during the conference week. If you don't have one, or do "
"not wish to provide it, then enter NONE in this field.")
)
local_timezone = TimeZoneField(
blank=True,
verbose_name=_("Local Timezone"),
help_text=_("Your local timezone, preferably the one you will use to "
"present from. The conference organisers will "
"use this to assist with scheduling talks.")
)
homepage = models.URLField(
blank=True,
help_text=_(u"Your home page, if you have one")
)
twitter_username = models.CharField(
max_length=15,
blank=True,
help_text=_(u"Your Twitter account")
)
mastodon_username = models.CharField(
max_length=100,
blank=True,
help_text=_(u"Your Mastodon account")
)
accessibility = models.TextField(
blank=True,
help_text=_("Let us know how we can help you during the conference, for example "
"your accessibility requirements, whether you require access to child "
"minding facilities, or anything else you think we should know about."),
verbose_name=_("Other requirements"))
accessibility_html = models.TextField(blank=True)
travel_assistance = models.BooleanField(
blank=True,
default=False,
help_text=_("Check this box if you require assistance to travel to the conference "
"in order to present your proposed sessions."),
verbose_name=_("Travel assistance required"),
)
accommodation_assistance = models.BooleanField(
blank=True,
default=False,
help_text=_("Check this box if you require us to provide you with accommodation "
"in order to present your proposed sessions."),
verbose_name=_("Accommodation assistance required"),
)
assistance = models.TextField(
blank=True,
help_text=_("We have budget set aside to provide financial assistance to "
"speakers and attendees who might otherwise find it difficult to attend. "
"Please provide details on why you require travel and/or accommodation assistance "
"in order to present your proposed sessions. "
"For travel assistance, please also tell us where you will be coming from "
"(country, state, etc) to assist with planning."),
verbose_name=_("Travel/Accommodation assistance details"))
assistance_html = models.TextField(blank=True)
agreement = models.BooleanField(
default=False,
help_text=_("I agree to the "
"<a href=\"/attend/terms-and-conditions\"> "
"terms and conditions of attendance</a>, and I have read, "
"understood, and agree to act according to the standards set "
"forth in our "
"<a href=\"/attend/code-of-conduct\">"
"Code of Conduct</a>.")
)
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"))
created = models.DateTimeField(
default=datetime.datetime.now,
editable=False,
verbose_name=_("Created")
)
class Meta:
ordering = ['name']
verbose_name = _("Speaker")
verbose_name_plural = _("Speakers")
permissions = (('can_view_contact_details', 'Can View Contact Details'),)
def save(self, *args, **kwargs):
self.biography_html = parse(self.biography)
self.experience_html = parse(self.experience)
self.accessibility_html = parse(self.accessibility)
self.assistance_html = parse(self.assistance)
return super(Speaker, self).save(*args, **kwargs)
def __str__(self):
if self.user:
return self.name
else:
return "?"
def get_absolute_url(self):
return reverse("speaker_edit")
@property
def email(self):
if self.user is not None:
return self.user.email
else:
return self.invite_email
@property
def all_presentations(self):
presentations = []
if self.presentations:
for p in self.presentations.all():
presentations.append(p)
for p in self.copresentations.all():
presentations.append(p)
return presentations
@property
def code(self):
""" A unique string that identifies this speaker. """
return f"{self.pk}"
|