Commit c7b312d2434340c608f33953a1bc1713f80a25db

Authored by Sergio Oliveira
2 parents 12b59054 50ce8703

Merge pull request #138 from TracyWebTech/bio_field_on_userprofile

Bio and identi_ca field on userprofile - closes #117 and #90
src/accounts/forms.py
... ... @@ -49,12 +49,19 @@ class UserCreationForm(UserForm):
49 49  
50 50  
51 51 class UserUpdateForm(UserForm):
  52 + bio = forms.CharField(
  53 + widget=forms.Textarea(attrs={'rows': '6', 'maxlength': '200'}),
  54 + max_length=200,
  55 + label=_(u'Biography'),
  56 + help_text=_(u'Write something about you in 200 characters or less.'),
  57 + required=False,
  58 + )
52 59  
53 60 class Meta:
54 61 model = User
55 62 fields = ('first_name', 'last_name',
56 63 'institution', 'role', 'twitter', 'facebook',
57   - 'google_talk', 'webpage')
  64 + 'google_talk', 'identi_ca', 'webpage', 'bio')
58 65  
59 66 twitter = SocialAccountField(url='https://twitter.com/', required=False)
60 67 facebook = SocialAccountField(url='https://graph.facebook.com/', required=False)
... ...
src/accounts/migrations/0008_auto__add_field_user_bio.py 0 → 100644
... ... @@ -0,0 +1,70 @@
  1 +# -*- coding: utf-8 -*-
  2 +import datetime
  3 +from south.db import db
  4 +from south.v2 import SchemaMigration
  5 +from django.db import models
  6 +
  7 +
  8 +class Migration(SchemaMigration):
  9 +
  10 + def forwards(self, orm):
  11 + # Adding field 'User.bio'
  12 + db.add_column(u'accounts_user', 'bio',
  13 + self.gf('django.db.models.fields.CharField')(max_length=200, null=True, blank=True),
  14 + keep_default=False)
  15 +
  16 +
  17 + def backwards(self, orm):
  18 + # Deleting field 'User.bio'
  19 + db.delete_column(u'accounts_user', 'bio')
  20 +
  21 +
  22 + models = {
  23 + u'accounts.user': {
  24 + 'Meta': {'object_name': 'User'},
  25 + 'bio': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
  26 + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  27 + 'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75', 'blank': 'True'}),
  28 + 'facebook': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  29 + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  30 + 'google_talk': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
  31 + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
  32 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  33 + 'institution': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  34 + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
  35 + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  36 + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  37 + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  38 + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  39 + 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  40 + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  41 + 'role': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  42 + 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  43 + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
  44 + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
  45 + 'verification_hash': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
  46 + 'webpage': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'})
  47 + },
  48 + u'auth.group': {
  49 + 'Meta': {'object_name': 'Group'},
  50 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  51 + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
  52 + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
  53 + },
  54 + u'auth.permission': {
  55 + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
  56 + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  57 + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
  58 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  59 + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  60 + },
  61 + u'contenttypes.contenttype': {
  62 + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
  63 + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  64 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  65 + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  66 + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
  67 + }
  68 + }
  69 +
  70 + complete_apps = ['accounts']
0 71 \ No newline at end of file
... ...
src/accounts/migrations/0009_auto__add_field_user_identi_ca.py 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +# -*- coding: utf-8 -*-
  2 +import datetime
  3 +from south.db import db
  4 +from south.v2 import SchemaMigration
  5 +from django.db import models
  6 +
  7 +
  8 +class Migration(SchemaMigration):
  9 +
  10 + def forwards(self, orm):
  11 + # Adding field 'User.identi_ca'
  12 + db.add_column(u'accounts_user', 'identi_ca',
  13 + self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True),
  14 + keep_default=False)
  15 +
  16 +
  17 + def backwards(self, orm):
  18 + # Deleting field 'User.identi_ca'
  19 + db.delete_column(u'accounts_user', 'identi_ca')
  20 +
  21 +
  22 + models = {
  23 + u'accounts.user': {
  24 + 'Meta': {'object_name': 'User'},
  25 + 'bio': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
  26 + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  27 + 'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75', 'blank': 'True'}),
  28 + 'facebook': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  29 + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  30 + 'google_talk': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
  31 + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
  32 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  33 + 'identi_ca': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  34 + 'institution': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  35 + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
  36 + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  37 + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
  38 + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  39 + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  40 + 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  41 + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  42 + 'role': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  43 + 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
  44 + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
  45 + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
  46 + 'verification_hash': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
  47 + 'webpage': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'})
  48 + },
  49 + u'auth.group': {
  50 + 'Meta': {'object_name': 'Group'},
  51 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  52 + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
  53 + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
  54 + },
  55 + u'auth.permission': {
  56 + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
  57 + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  58 + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
  59 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  60 + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  61 + },
  62 + u'contenttypes.contenttype': {
  63 + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
  64 + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  65 + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  66 + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  67 + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
  68 + }
  69 + }
  70 +
  71 + complete_apps = ['accounts']
0 72 \ No newline at end of file
... ...
src/accounts/models.py
... ... @@ -20,9 +20,12 @@ class User(AbstractUser):
20 20 twitter = models.CharField(max_length=128, null=True, blank=True)
21 21 facebook = models.CharField(max_length=128, null=True, blank=True)
22 22 google_talk = models.EmailField(null=True, blank=True)
  23 + identi_ca = models.CharField(max_length=128, null=True, blank=True,
  24 + verbose_name=u'identi.ca')
23 25 webpage = models.CharField(max_length=256, null=True, blank=True)
24 26 verification_hash = models.CharField(max_length=32, null=True, blank=True)
25 27 modified = models.DateTimeField(auto_now=True)
  28 + bio = models.CharField(max_length=200, null=True, blank=True)
26 29  
27 30 def check_password(self, raw_password):
28 31  
... ...
src/accounts/templates/accounts/user_detail.html
... ... @@ -46,18 +46,29 @@
46 46 {% if request.user.is_active %}
47 47 <li>
48 48 {% if user_.twitter %}
49   - <span class="icon-twitter icon-fixed-width"></span> <a target="_blank" href="{{ user_.twitter_link }}" title="{% trans 'Twitter account' %}">{{ user_.twitter }}</a>
  49 + <span class="icon-twitter icon-fixed-width" title="{% trans 'Twitter account' %}"></span> <a target="_blank" href="{{ user_.twitter_link }}" title="{% trans 'Twitter account' %}">{{ user_.twitter }}</a>
50 50 {% endif %}
51 51 {% if user_.facebook %}
52   - <span class="icon-facebook icon-fixed-width"></span> <a target="_blank" href="{{ user_.facebook_link }}" title="{% trans 'Facebook account' %}">{{ user_.facebook }}</a>
  52 + <span class="icon-facebook icon-fixed-width" title="{% trans 'Facebook account' %}"></span> <a target="_blank" href="{{ user_.facebook_link }}" title="{% trans 'Facebook account' %}">{{ user_.facebook }}</a>
53 53 {% endif %}
54 54 </li>
55 55  
56 56 {% if user_.google_talk %}
57   - <li><span class="icon-google-plus icon-fixed-width"></span> {{ user_.google_talk }}</li>
  57 + <li><span class="icon-google-plus icon-fixed-width" title="{% trans 'Google talk account' %}"></span> {{ user_.google_talk }}</li>
58 58 {% endif %}
  59 +
  60 + {% if user_.identi_ca %}
  61 + <li><span class="icon-comments icon-fixed-width" title="{% trans 'Identi.ca account' %}"></span> {{ user_.identi_ca }}</li>
  62 + {% endif %}
  63 +
59 64 {% if user_.webpage %}
60   - <li><span class="icon-link icon-fixed-width"></span> <a target="_blank" href="{{ user_.webpage }}" title="{% trans 'Personal webpage' %}">{{ user_.webpage }}</a></li>
  65 + <li><span class="icon-link icon-fixed-width" title="{% trans 'Personal webpage' %}"></span> <a target="_blank" href="{{ user_.webpage }}" title="{% trans 'Personal webpage' %}">{{ user_.webpage }}</a></li>
  66 + {% endif %}
  67 + {% if user_.bio %}
  68 + <li class="divider">
  69 + <strong><abbr title="{% trans 'Biography' %}">{% trans 'Bio' %}</abbr></strong>
  70 + </li>
  71 + <li class="text-muted"> {{ user_.bio }}</li>
61 72 {% endif %}
62 73 {% endif %}
63 74 </ul>
... ...
src/locale/pt_BR/LC_MESSAGES/django.mo
No preview for this file type
src/locale/pt_BR/LC_MESSAGES/django.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: PACKAGE VERSION\n"
9 9 "Report-Msgid-Bugs-To: \n"
10   -"POT-Creation-Date: 2013-12-10 16:24+0000\n"
  10 +"POT-Creation-Date: 2013-12-10 17:09+0000\n"
11 11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 13 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -33,31 +33,39 @@ msgstr &quot;Datas importantes&quot;
33 33 msgid "Social account does not exist"
34 34 msgstr "Conta social não existe"
35 35  
36   -#: accounts/forms.py:65
  36 +#: accounts/forms.py:55
  37 +msgid "Biography"
  38 +msgstr "Biografia"
  39 +
  40 +#: accounts/forms.py:56
  41 +msgid "Write something about you in 200 characters or less."
  42 +msgstr "Escreva algo sobre você em 200 caracteres ou menos."
  43 +
  44 +#: accounts/forms.py:72
37 45 msgid "Mailing lists"
38 46 msgstr "Listas de e-mail"
39 47  
40   -#: accounts/forms.py:72
  48 +#: accounts/forms.py:79
41 49 msgid "Password"
42 50 msgstr "Senha"
43 51  
44   -#: accounts/forms.py:74
  52 +#: accounts/forms.py:81
45 53 msgid "Password confirmation"
46 54 msgstr "Confirmação de senha"
47 55  
48   -#: accounts/forms.py:76
  56 +#: accounts/forms.py:83
49 57 msgid "Enter the same password as above, for verification."
50 58 msgstr "Digite a mesma senha que acima, para verificação."
51 59  
52   -#: accounts/forms.py:94
  60 +#: accounts/forms.py:101
53 61 msgid "Password mismatch"
54 62 msgstr "Senhas diferentes"
55 63  
56   -#: accounts/models.py:56
  64 +#: accounts/models.py:57
57 65 msgid "Required. 30 characters or fewer. Letters, digits and ./+/-/_ only."
58 66 msgstr ""
59 67  
60   -#: accounts/models.py:61
  68 +#: accounts/models.py:62
61 69 msgid "Enter a valid username."
62 70 msgstr ""
63 71  
... ...