default.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from __future__ import unicode_literals
  2. from django.utils.translation import ugettext_lazy as _
  3. from . import basefields
  4. class BioField(basefields.UrlifiedTextareaProfileField):
  5. fieldname = 'bio'
  6. label = _("Bio")
  7. class FullNameField(basefields.TextProfileField):
  8. fieldname = 'fullname'
  9. label = _("Full name")
  10. class LocationField(basefields.TextProfileField):
  11. fieldname = 'location'
  12. label = _("Location")
  13. class GenderField(basefields.ChoiceProfileField):
  14. fieldname = 'gender'
  15. label = _("Gender")
  16. choices = (
  17. ('', _('Not specified')),
  18. ('secret', _('Not telling')),
  19. ('f', _('Female')),
  20. ('f', _('Male')),
  21. )
  22. class WebsiteField(basefields.UrlProfileField):
  23. fieldname = 'website'
  24. label = _("Website")
  25. class SkypeHandleField(basefields.TextProfileField):
  26. fieldname = 'skype'
  27. label = _("Skype ID")
  28. class TwitterHandleField(basefields.SlugProfileField):
  29. fieldname = 'twitter'
  30. label = _("Twitter handle")
  31. help_text = _('Without leading "@" sign.')
  32. def get_display_data(self, request, user, data):
  33. return {
  34. 'text': '@{}'.format(data),
  35. 'url': 'https://twitter.com/{}'.format(data),
  36. }