diff --git a/mozillians/phonebook/forms.py b/mozillians/phonebook/forms.py index bf81091f4..defb93f6d 100644 --- a/mozillians/phonebook/forms.py +++ b/mozillians/phonebook/forms.py @@ -93,13 +93,14 @@ class Meta: model = UserProfile fields = ('full_name', 'ircname', 'website', 'bio', 'photo', 'country', 'region', 'city', 'allows_community_sites', 'tshirt', - 'allows_mozilla_sites', 'date_mozillian', 'timezone', + 'title', 'allows_mozilla_sites', + 'date_mozillian', 'timezone', 'privacy_photo', 'privacy_full_name', 'privacy_ircname', 'privacy_email', 'privacy_timezone', 'privacy_tshirt', 'privacy_website', 'privacy_bio', 'privacy_city', 'privacy_region', 'privacy_country', 'privacy_groups', 'privacy_skills', 'privacy_languages', - 'privacy_date_mozillian') + 'privacy_date_mozillian', 'privacy_title') widgets = {'bio': forms.Textarea()} def __init__(self, *args, **kwargs): diff --git a/mozillians/phonebook/templates/phonebook/edit_profile.html b/mozillians/phonebook/templates/phonebook/edit_profile.html index 9f9546af6..d0b94aae6 100644 --- a/mozillians/phonebook/templates/phonebook/edit_profile.html +++ b/mozillians/phonebook/templates/phonebook/edit_profile.html @@ -142,6 +142,11 @@

**{'label': _('When did you get involved with Mozilla?')})) }} +
+ {{ privacy_field(profile_form.privacy_title, profile.privacy_title) }} + {{ bootstrap(profile_form.title) }} +
+
{{ privacy_field(profile_form.privacy_tshirt, profile.privacy_tshirt) }} {{ bootstrap(profile_form.tshirt) }} diff --git a/mozillians/phonebook/templates/phonebook/profile.html b/mozillians/phonebook/templates/phonebook/profile.html index 863b9be2b..933bd0f14 100644 --- a/mozillians/phonebook/templates/phonebook/profile.html +++ b/mozillians/phonebook/templates/phonebook/profile.html @@ -141,9 +141,9 @@

{{ profile.display_name|default(shown_user.username, true) }}

- {# Placeholder text in

below -

I make tools for Mozillians

- #} + {% if profile.title %} +

{{ profile.title }}

+ {% endif %}
{% if profile.bio %} diff --git a/mozillians/users/managers.py b/mozillians/users/managers.py index 626823510..038684f7c 100644 --- a/mozillians/users/managers.py +++ b/mozillians/users/managers.py @@ -26,7 +26,8 @@ 'languages': Language.objects.none(), 'vouched_by': None, 'date_mozillian': None, - 'timezone': ''} + 'timezone': '', + 'title': ''} class UserProfileValuesQuerySet(ValuesQuerySet): diff --git a/mozillians/users/migrations/0036_auto__add_field_userprofile_privacy_title__add_field_userprofile_title.py b/mozillians/users/migrations/0036_auto__add_field_userprofile_privacy_title__add_field_userprofile_title.py new file mode 100644 index 000000000..2a3f22f0b --- /dev/null +++ b/mozillians/users/migrations/0036_auto__add_field_userprofile_privacy_title__add_field_userprofile_title.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'UserProfile.privacy_title' + db.add_column('profile', 'privacy_title', + self.gf('mozillians.users.models.PrivacyField')(default=3), + keep_default=False) + + # Adding field 'UserProfile.title' + db.add_column('profile', 'title', + self.gf('django.db.models.fields.CharField')(default='', max_length=70, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'UserProfile.privacy_title' + db.delete_column('profile', 'privacy_title') + + # Deleting field 'UserProfile.title' + db.delete_column('profile', 'title') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'groups.group': { + 'Meta': {'ordering': "['name']", 'object_name': 'Group'}, + 'always_auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'irc_channel': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), + 'steward': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.UserProfile']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), + 'system': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}), + 'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}), + 'wiki': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}) + }, + 'groups.language': { + 'Meta': {'ordering': "['name']", 'object_name': 'Language'}, + 'always_auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), + 'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}) + }, + 'groups.skill': { + 'Meta': {'ordering': "['name']", 'object_name': 'Skill'}, + 'always_auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'auto_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), + 'url': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'blank': 'True'}) + }, + 'users.usernameblacklist': { + 'Meta': {'ordering': "['value']", 'object_name': 'UsernameBlacklist'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_regex': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'value': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'users.userprofile': { + 'Meta': {'ordering': "['full_name']", 'object_name': 'UserProfile', 'db_table': "'profile'"}, + 'allows_community_sites': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'allows_mozilla_sites': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'basket_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}), + 'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), + 'city': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}), + 'date_mozillian': ('django.db.models.fields.DateField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}), + 'date_vouched': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}), + 'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'members'", 'blank': 'True', 'to': "orm['groups.Group']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'ircname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}), + 'is_vouched': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'languages': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'members'", 'blank': 'True', 'to': "orm['groups.Language']"}), + 'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'auto_now': 'True', 'blank': 'True'}), + 'photo': ('sorl.thumbnail.fields.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'privacy_bio': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_city': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_country': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_date_mozillian': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_email': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_full_name': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_groups': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_ircname': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_languages': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_photo': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_region': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_skills': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_timezone': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_title': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_vouched_by': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'privacy_website': ('mozillians.users.models.PrivacyField', [], {'default': '3'}), + 'region': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), + 'skills': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'members'", 'blank': 'True', 'to': "orm['groups.Skill']"}), + 'timezone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '70', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}), + 'vouched_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vouchees'", 'on_delete': 'models.SET_NULL', 'default': 'None', 'to': "orm['users.UserProfile']", 'blank': 'True', 'null': 'True'}), + 'website': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}) + } + } + + complete_apps = ['users'] \ No newline at end of file diff --git a/mozillians/users/models.py b/mozillians/users/models.py index 7e7eff788..967c0ba41 100644 --- a/mozillians/users/models.py +++ b/mozillians/users/models.py @@ -90,6 +90,7 @@ class UserProfilePrivacyModel(models.Model): privacy_timezone = PrivacyField() privacy_tshirt = PrivacyField(choices=((PRIVILEGED, 'Privileged'),), default=PRIVILEGED) + privacy_title = PrivacyField() class Meta: abstract=True @@ -141,7 +142,7 @@ class UserProfile(UserProfilePrivacyModel, SearchMixin): timezone = models.CharField(max_length=100, blank=True, default='', choices=zip(common_timezones, common_timezones)) tshirt = models.IntegerField( - blank=True, null=True, default=None, + _lazy(u'T-Shirt'), blank=True, null=True, default=None, choices=( (1, 'Fitted Small'), (2, 'Fitted Medium'), (3, 'Fitted Large'), (4, 'Fitted X-Large'), @@ -150,6 +151,8 @@ class UserProfile(UserProfilePrivacyModel, SearchMixin): (9, 'Straight-cut Large'), (10, 'Straight-cut X-Large'), (11, 'Straight-cut XX-Large'), (12, 'Straight-cut XXX-Large') )) + title = models.CharField(_lazy(u'What do you do for Mozilla?'), + max_length=70, blank=True, default='') class Meta: db_table = 'profile'