From 6340b1bb7411e1bd0a2fded020407a52932ce304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sun, 24 Aug 2014 18:03:44 +0200 Subject: [PATCH] Public user profiles now working. Basically the same as the one we had but with modified urls and some behaviour is changed. --- shelfzilla/apps/users/urls.py | 10 ++-- shelfzilla/apps/users/views.py | 29 ++++----- shelfzilla/locale/es/LC_MESSAGES/django.mo | Bin 4768 -> 4720 bytes shelfzilla/locale/es/LC_MESSAGES/django.po | 56 ++++++++++-------- .../themes/bootflat/templates/_layout.html | 6 +- .../bootflat/templates/homepage/home.html | 4 +- .../templates/users/profile-pjax.html | 2 +- .../bootflat/templates/users/profile.html | 20 +++++-- .../templates/users/profile/collection.html | 4 +- .../templates/users/profile/summary.html | 4 +- .../templates/users/profile/wishlist.html | 4 +- 11 files changed, 74 insertions(+), 65 deletions(-) diff --git a/shelfzilla/apps/users/urls.py b/shelfzilla/apps/users/urls.py index 937d4e4..6722565 100644 --- a/shelfzilla/apps/users/urls.py +++ b/shelfzilla/apps/users/urls.py @@ -1,17 +1,17 @@ from django.conf.urls import patterns, url -from .views import LoginView, LogoutView, ProfileView +from .views import LoginView, LogoutView,UserProfileView urlpatterns = patterns( '', url(r'^login/$', LoginView.as_view(), name="login"), url(r'^logout/$', LogoutView.as_view(), name="logout"), url( - r'^profile/$', - ProfileView.as_view(), + r'^user/(?P[\w\d\-\.]+)/$', + UserProfileView.as_view(), name="profile"), url( - r'^profile/(?P
\w+)/$', - ProfileView.as_view(), + r'^user/(?P[\w\d\-\.]+)/(?P
\w+)/$', + UserProfileView.as_view(), name="profile"), ) diff --git a/shelfzilla/apps/users/views.py b/shelfzilla/apps/users/views.py index 99298e8..d43aa74 100644 --- a/shelfzilla/apps/users/views.py +++ b/shelfzilla/apps/users/views.py @@ -1,6 +1,6 @@ from django.views.generic import View from django.template import RequestContext -from django.shortcuts import render_to_response +from django.shortcuts import render_to_response, get_object_or_404 from django.contrib.auth import logout from django.utils.translation import ugettext as _ from django.http import HttpResponseRedirect, Http404 @@ -62,25 +62,22 @@ class LogoutView(View): return HttpResponseRedirect('/') -class ProfileView(View): +class UserProfileView(View): tempalte = 'users/profile.html' template_section = 'users/profile/{}.html' - def get(self, request, section='summary'): - if request.user.is_authenticated(): - data = { - 'item': User.objects.get(pk=request.user.pk) - } - if section != 'summary': - template = self.template_section.format(section) - else: - template = self.tempalte - data = self.get_context_from_section(request, section, data) - - ctx = RequestContext(request, data) - return render_to_response(template, context_instance=ctx) + def get(self, request, username, section='summary'): + data = { + 'item': get_object_or_404(User, username=username) + } + if section != 'summary': + template = self.template_section.format(section) else: - raise Http404 + template = self.tempalte + data = self.get_context_from_section(request, section, data) + + ctx = RequestContext(request, data) + return render_to_response(template, context_instance=ctx) def get_summary(self, request, context): context['SUMMARY'] = 'Y' diff --git a/shelfzilla/locale/es/LC_MESSAGES/django.mo b/shelfzilla/locale/es/LC_MESSAGES/django.mo index 28cbdad685256ee72af182c18043ed55df861874..be1642a967c727023dc156d0df6499ce8c3520ea 100644 GIT binary patch delta 1500 zcmYMzTS!z<7>40BIi4C1rDd67CS#JMh*sJGBBYRPCbc~J<}jhJ0TA-!Myl#KJN!`^Fs`(Jzdb7z9yhZKLe<8Lqj znfy;KP|vw5(f?gcvx9yz_F)1(#6*0Garg?OZ~{~D4aVSC4B#v-!FgPWsZ7%JTo#Qi z27>6vaR4QivKs0Era7Cq$SF7u`NP8+{&_Te(d?_)ZSqSkwdG3@U?+XXXb z9IKMdWg|mwH6~$!xdj!p5*1_*>be>mKY%Ip524mMhYEHcbzK|saaSe#yB-?x*pFIp z5LMzwsH9`oe~nsT3KeMD`rpl8sEwo8O##zTCC@;nToLO2GE}gw=xJg*jdd8pYP^Ul z)mzlr&!W!OPs&9YXQpF5{e0vSSB=_WKkB|PF2xqqJ{_nd?M4N?6Honh;|K#KIEsb% z4fO;$ltW4L%mUO|mf$L^#0)%+%drhrncH~N=iCtLWeibHRk9WpumKhDOak>+fOZD7 zVHfI#9#rB7$Qo`KSK_Gkr;v>93zp&>D(G4sPa71Yo^T_oV!Kf5>_Y{tN3GxD(a;T2 zi7wehkJ*oU!U5E;29b-itYS50BwEs!|(xTve_b_3}2Lf}KWHsvXzs_uorH3r(8u zF^&Ew%*LOnv&-asWF9I|G3v-R^QCtngoW6OdKZSxC#Xt2Lj`+@dY7ivSE3l|6vSN2 z#hsBG(IdXVsmAcZaAWvHUAQR{j(r~GFWXd9+?5{){%J(20s}r@d1OAJ*_YUq{qN$# KwUKK{$^PGg#EJs| delta 1548 zcmYMzT}V_x7{>8gUB7bOH8VAeb<6dpK$6T2!J8lmQwc;gA;{JhH!;8peE_2iK>vsIMbqw;y&A!~!HUvl)40%F&ONsD!FfZ`6cJxD}O9J8J%6JKl#m^iQGU4WJSnM9mwTK|hp6gjTk}yH2T=)@qDo(mEHS%K^Xt%2W=;0N zJ}jf(hV?jvD%mg88OS0#ed9vR#v*GOZlu2hnQA&w8}y*ooy66636;Pos*?9JsJ}9u zVn7RD;})F967*9By+I`^(e2iqs83ak>#-Hr;yEn9VN_+F;Gl;?iaL~Slv9;Fj!N)? zkNPXaeg>4l2x`N7s0A)6_)v{1FB*NP;q)u z37&OmXoCUNf+18w!*+baI)!?}7pPy$XH-c&MA5o@)bk)J@d`U$i(ICjn+|OYvea~< z&V+Mm$}MK3Ei\n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -76,13 +76,13 @@ msgstr "Avanzado" #: apps/manga/admin.py:78 apps/manga/models.py:118 apps/manga/models.py:119 #: themes/bootflat/templates/_layout.html:33 -#: themes/bootflat/templates/manga/publishers/detail.html:18 +#: themes/bootflat/templates/manga/publishers/detail.html:24 #: themes/bootflat/templates/manga/series/list.html:4 msgid "Series" msgstr "Series" #: apps/manga/admin.py:93 apps/manga/admin.py:121 apps/manga/models.py:150 -#: themes/bootflat/templates/manga/publishers/detail.html:21 +#: themes/bootflat/templates/manga/publishers/detail.html:27 msgid "Volumes" msgstr "Volúmenes" @@ -177,7 +177,7 @@ msgid "wants" msgstr "quiere" #: apps/manga/views/search.py:11 apps/manga/views/search.py:13 -#: themes/bootflat/templates/_layout.html:71 +#: themes/bootflat/templates/_layout.html:72 #: themes/bootflat/templates/_admin/volumes/includes/cover.html:6 #: themes/bootflat/templates/_admin/volumes/includes/cover.html:15 msgid "Search" @@ -227,7 +227,7 @@ msgstr "Has accedido correctamente." msgid "Logged out successfully" msgstr "Sesión finalizada." -#: settings/base.py:121 +#: settings/base.py:124 msgid "Spanish" msgstr "Español" @@ -251,25 +251,18 @@ msgstr "" msgid "Toggle navigation" msgstr "Mostrar/Ocultar navegación" -#: themes/bootflat/templates/_layout.html:48 +#: themes/bootflat/templates/_layout.html:42 +#: themes/bootflat/templates/_layout.html:50 #: themes/bootflat/templates/users/profile-pjax.html:4 #: themes/bootflat/templates/users/profile.html:4 msgid "Profile" msgstr "Perfil" -#: themes/bootflat/templates/_layout.html:51 -msgid "My collection" -msgstr "Mi colección" - -#: themes/bootflat/templates/_layout.html:52 -msgid "My wishlist" -msgstr "Mi lista de deseados" - #: themes/bootflat/templates/_layout.html:55 msgid "Logout" msgstr "Cerrar sesión" -#: themes/bootflat/templates/_layout.html:61 +#: themes/bootflat/templates/_layout.html:62 msgid "Log in" msgstr "Entrar" @@ -324,22 +317,23 @@ msgstr "Buscando..." msgid "No results" msgstr "Sin resultados" -#: themes/bootflat/templates/manga/publishers/detail.html:14 -#: themes/bootflat/templates/manga/publishers/detail.html:43 +#: themes/bootflat/templates/manga/publishers/detail.html:10 +#: themes/bootflat/templates/manga/series/detail.html:10 +#: themes/bootflat/templates/manga/series/includes/volume.html:42 +msgid "Edit in admin" +msgstr "Editar en el admin" + +#: themes/bootflat/templates/manga/publishers/detail.html:20 +#: themes/bootflat/templates/manga/publishers/detail.html:49 #: themes/bootflat/templates/manga/series/detail.html:25 #: themes/bootflat/templates/manga/series/includes/volume.html:25 msgid "Requires review" msgstr "Requiere revisión" -#: themes/bootflat/templates/manga/publishers/detail.html:25 +#: themes/bootflat/templates/manga/publishers/detail.html:31 msgid "Homepage" msgstr "Página principal" -#: themes/bootflat/templates/manga/series/detail.html:10 -#: themes/bootflat/templates/manga/series/includes/volume.html:42 -msgid "Edit in admin" -msgstr "Editar en el admin" - #: themes/bootflat/templates/manga/series/detail.html:29 msgid "Status" msgstr "Estado" @@ -375,17 +369,21 @@ msgstr "Entrar" #: themes/bootflat/templates/users/profile.html:30 #: themes/bootflat/templates/users/profile/collection.html:4 msgid "Collection" -msgstr "Mi colección" +msgstr "Colección" #: themes/bootflat/templates/users/profile.html:34 #: themes/bootflat/templates/users/profile/wishlist.html:4 msgid "Wishlist" msgstr "Lista de deseados" -#: themes/bootflat/templates/users/profile.html:44 +#: themes/bootflat/templates/users/profile.html:46 msgid "Edit my profile" msgstr "Editar mi perfil" +#: themes/bootflat/templates/users/profile.html:50 +msgid "My preferences" +msgstr "Mis preferencias" + #: themes/bootflat/templates/users/profile/achievements.html:4 msgid "Achievements" msgstr "Logros" @@ -398,6 +396,12 @@ msgstr "Volúmenes" msgid "Volumes wishlisted" msgstr "Deseados" +#~ msgid "My collection" +#~ msgstr "Mi colección" + +#~ msgid "My wishlist" +#~ msgstr "Mi lista de deseados" + #~ msgid "all" #~ msgstr "todos" diff --git a/shelfzilla/themes/bootflat/templates/_layout.html b/shelfzilla/themes/bootflat/templates/_layout.html index 59a9b6d..544d051 100644 --- a/shelfzilla/themes/bootflat/templates/_layout.html +++ b/shelfzilla/themes/bootflat/templates/_layout.html @@ -39,18 +39,18 @@ {% endif %}