Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Na edição do perfil, o item "imagem" virar "foto de perfil" #584

Merged
merged 5 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified locale/pt_BR/LC_MESSAGES/django.mo
Binary file not shown.
76 changes: 73 additions & 3 deletions locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Generated-By: Babel 2.5.3\n"
"X-Generator: Poedit 1.8.7.1\n"
"X-Generator: Poedit 2.0.6\n"

#: docs/_templates/layout.html:3
msgid "Documentation"
Expand Down Expand Up @@ -484,6 +484,21 @@ msgstr ""
"<strong>Nota:</strong> você ainda poe <a href=\"%(email_url)s\">mudar seu "
"endereço de email</a>."

<<<<<<< HEAD
#: src/ej_boards/apps.py:7 src/ej_boards/models.py:49
msgid "Boards"
msgstr "Murais"

#: src/ej_boards/models.py:16
msgid "Slug"
msgstr "Identificador"

#: src/ej_boards/models.py:26 src/ej_conversations/models/conversation.py:57
msgid "Title"
msgstr "Título"

#: src/ej_boards/models.py:30 src/ej_clusters/models.py:127
=======
#: src/ej_boards/apps.py:7 src/ej_boards/models.py:45
msgid "Boards"
msgstr "Murais"
Expand All @@ -497,11 +512,16 @@ msgid "Title"
msgstr "Título"

#: src/ej_boards/models.py:31 src/ej_clusters/models.py:127
>>>>>>> develop
gag2502 marked this conversation as resolved.
Show resolved Hide resolved
#: src/ej_clusters/models.py:194
msgid "Description"
msgstr "Descrição"

<<<<<<< HEAD
#: src/ej_boards/models.py:48
=======
#: src/ej_boards/models.py:44
>>>>>>> develop
msgid "Board"
msgstr "Mural"

Expand All @@ -513,18 +533,31 @@ msgstr "Essa URL já existe."
msgid "Stereotypes"
msgstr "Estereótipos"

<<<<<<< HEAD
#: src/ej_boards/validators.py:11
#, fuzzy
=======
#: src/ej_boards/routes.py:170
msgid "Create board"
msgstr "Criar mural"

#: src/ej_boards/validators.py:9
>>>>>>> develop
msgid "Invalid slug."
msgstr "URL inválida."

#: src/ej_boards/validators.py:11
msgid "Slug cannot contain a backslash character."
msgstr "O identificador não pode conter uma barra."

<<<<<<< HEAD
#: src/ej_boards/validators.py:20
#, fuzzy
msgid "Slug already exists."
msgstr "Essa URL já existe."

=======
>>>>>>> develop
#: src/ej_clusters/apps.py:7 src/ej_clusters/routes.py:40
msgid "Clusters"
msgstr "Grupos"
Expand Down Expand Up @@ -874,28 +907,45 @@ msgid "non-moderated comments cannot receive votes"
msgstr "comentários não-moderados não podem receber votos"

#: src/ej_conversations/roles.py:78
<<<<<<< HEAD
#: src/ej_conversations/routes/conversations.py:80
=======
#: src/ej_conversations/routes/conversations.py:81
>>>>>>> develop
msgid "login"
msgstr "entrar"

#: src/ej_conversations/routes/comments.py:17
msgid "List conversations"
msgstr "Listar conversas"

<<<<<<< HEAD
#: src/ej_conversations/routes/conversations.py:21
=======
#: src/ej_conversations/routes/conversations.py:22
>>>>>>> develop
msgid ""
"A space for adolescents to discuss actions that promote, guarantee and "
"defend their rights"
msgstr ""
"Um espaço para adolescentes debaterem ações que promovam, garantam e "
"defendam seus direitos"

<<<<<<< HEAD
#: src/ej_conversations/routes/conversations.py:22
msgid "Public conversations"
msgstr "Conversas públicas"

#: src/ej_conversations/routes/conversations.py:23
#: src/ej_conversations/routes/conversations.py:24
=======
#: src/ej_conversations/routes/conversations.py:23
msgid "Public conversations"
msgstr "Conversas públicas"

#: src/ej_conversations/routes/conversations.py:24
#: src/ej_conversations/routes/conversations.py:25
>>>>>>> develop
msgid ""
"Participate of conversations and give your opinion with comments and votes!"
msgstr "Participe das conversas e dê sua opinião com comentários e votos!"
Expand Down Expand Up @@ -1095,8 +1145,8 @@ msgid "Political activity"
msgstr "Atividade política"

#: src/ej_profiles/models.py:44
msgid "Image"
msgstr "Imagem"
msgid "Profile Photo"
msgstr "Foto de Perfil"

#: src/ej_profiles/models.py:167
msgid "Root"
Expand Down Expand Up @@ -1432,6 +1482,7 @@ msgstr "Painel"
#: src/ej/templates/jinja2/components/generic/page_header.jinja2:109
#: src/ej/templates/jinja2/components/generic/page_header.jinja2:110
#: src/ej/templates/jinja2/components/generic/page_menu.jinja2:30
#, fuzzy
msgid "Profile"
msgstr "Perfil"

Expand Down Expand Up @@ -1949,6 +2000,19 @@ msgid "There are no comments left to vote :)"
msgstr "Não há comentários para votar :)"

#: src/ej_conversations/jinja2/ej_conversations/detail.jinja2:18
<<<<<<< HEAD
#, fuzzy
msgid "You have {} comment{} under moderation."
msgstr "Você criou essa conversa"

#: src/ej_conversations/jinja2/ej_conversations/detail.jinja2:20
msgid "Click here"
msgstr ""

#: src/ej_conversations/jinja2/ej_conversations/detail.jinja2:21
msgid "to see {}."
msgstr ""
=======
msgid "You have {} comment{} under moderation."
msgstr "Você tem {} comentário{} aguardando moderação."

Expand All @@ -1959,6 +2023,7 @@ msgstr "Clique aqui"
#: src/ej_conversations/jinja2/ej_conversations/detail.jinja2:21
msgid "to see {}."
msgstr "para ver {}."
>>>>>>> develop

#: src/ej_conversations/jinja2/ej_conversations/edit.jinja2:53
msgid "Manage stereotypes"
Expand Down Expand Up @@ -2193,6 +2258,10 @@ msgstr "Tente novamente"
msgid "Update"
msgstr "Atualizar"

<<<<<<< HEAD
#~ msgid "Image"
#~ msgstr "Imagem"
=======
#~ msgid "%s' conversations"
#~ msgstr "%s"

Expand Down Expand Up @@ -2224,6 +2293,7 @@ msgstr "Atualizar"

#~ msgid "OneSignal Id"
#~ msgstr "Id OneSignal"
>>>>>>> develop

#, fuzzy
#~ msgid ""
Expand Down
4 changes: 2 additions & 2 deletions src/ej_profiles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from . import models

EDITABLE_FIELDS = ['city', 'state', 'country', 'gender', 'race', 'ethnicity', 'political_activity',
'biography', 'birth_date', 'occupation', 'education', 'image']
'biography', 'birth_date', 'occupation', 'education', 'profile_photo']
EXCLUDE_EDITABLE_FIELDS = settings.EJ_EXCLUDE_PROFILE_FIELDS


Expand Down Expand Up @@ -36,4 +36,4 @@ class Meta:
class ProfileImageForm(ModelForm):
class Meta:
model = models.Profile
fields = ['image']
fields = ['profile_photo']
6 changes: 3 additions & 3 deletions src/ej_profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Profile(models.Model):
biography = models.TextField(_('Biography'), blank=True)
occupation = models.CharField(_('Occupation'), blank=True, max_length=50)
political_activity = models.TextField(_('Political activity'), blank=True)
image = models.ImageField(_('Image'), blank=True, null=True, upload_to='profile_images')
profile_photo = models.ImageField(_('Profile Photo'), blank=True, null=True, upload_to='profile_images')

name = delegate_to('user')
email = delegate_to('user')
Expand Down Expand Up @@ -85,7 +85,7 @@ def token(self):
@property
def image_url(self):
try:
return self.image.url
return self.profile_photo.url
except ValueError:
for account in SocialAccount.objects.filter(user=self.user):
picture = account.get_avatar_url()
Expand All @@ -94,7 +94,7 @@ def image_url(self):

@property
def has_image(self):
return self.image or SocialAccount.objects.filter(user_id=self.id)
return self.profile_photo or SocialAccount.objects.filter(user_id=self.id)

@property
def is_filled(self):
Expand Down
4 changes: 2 additions & 2 deletions src/ej_profiles/tests/test_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def test_user_logged_access_edit_profile(self, logged_client):
def test_user_logged_edit_profile_picture(self, logged_client):
avatar = create_image('avatar.png')
avatar_file = SimpleUploadedFile('front.png', avatar.getvalue())
form_data = {'name': 'Maurice', 'image': avatar_file, 'gender': 0, 'race': 0}
form_data = {'name': 'Maurice', 'profile_photo': avatar_file, 'gender': 0, 'race': 0}

response = logged_client.post('/profile/edit/', form_data)
assert response.status_code == 302 and response.url == '/profile/'
user = User.objects.get(email='email@server.com')
assert user.profile.image.name
assert user.profile.profile_photo.name

def test_user_logged_edit_profile_basic_info(self, logged_client):
def rand_str(size):
Expand Down
2 changes: 1 addition & 1 deletion src/ej_profiles/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestProfile:
def profile(self):
return Profile(
user=User(email='user@domain.com', name='name'),
image='image',
profile_photo='profile_photo',
birth_date=date(1996, 1, 17),
country='country',
city='city',
Expand Down