From 5e8b759b42d747cb3435f2d7502344f334b3c033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Tue, 1 Sep 2015 00:05:20 +0200 Subject: [PATCH 001/106] Base allauth installation --- amiibofindr/settings/base.py | 19 +++++++ amiibofindr/templates/_layout.html | 24 +++++++-- amiibofindr/templates/account/login.html | 66 ++++++++++++++++++++++++ amiibofindr/urls.py | 1 + requirements/base.txt | 3 ++ 5 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 amiibofindr/templates/account/login.html diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index 8a47569..b528ddf 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -33,6 +33,7 @@ ALLOWED_HOSTS = [] INSTALLED_APPS = ( 'suit', 'django.contrib.admin', + 'django.contrib.sites', # For allauth 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -45,6 +46,12 @@ INSTALLED_APPS = ( 'easy_thumbnails', 'django_extensions', + # Auth + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.socialaccount.providers.twitter', + # own apps 'amiibofindr.apps.core', 'amiibofindr.apps.amiibo', @@ -127,3 +134,15 @@ STATICFILES_DIRS = ( ) MEDIA_URL = '/media/' + + +# Auth +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'allauth.account.auth_backends.AuthenticationBackend', +) + + +# Sites and social auth +SITE_ID = 1 +LOGIN_REDIRECT_URL = '/account/profile/' diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index 4760872..72ce011 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -1,7 +1,8 @@ -{% load static i18n %} +{% load static i18n account %} +{% user_display user as user_display %} + - @@ -52,7 +53,24 @@ {% endcomment %} - +
diff --git a/amiibofindr/templates/account/login.html b/amiibofindr/templates/account/login.html new file mode 100644 index 0000000..b68fdf2 --- /dev/null +++ b/amiibofindr/templates/account/login.html @@ -0,0 +1,66 @@ +{% extends '_layout.html' %} + +{% load i18n %} +{% load account socialaccount %} + +{% block page_title %}{% trans "Sign In" %} {{ block.super }}{% endblock %} + +{% block main_content %} + {% get_providers as socialaccount_providers %} + +
+
+

{% trans "Sign In" %}

+ + {% if socialaccount_providers %} +
+

{% blocktrans with site.name as site_name %}Please sign in with one + of your existing social accounts. Or, sign up + for a {{ site_name }} account and sign in below.{% endblocktrans %}

+ +
+ +
+ {% for provider in socialaccount_providers %} + {% if provider.id == "openid" %} + {% for brand in provider.get_brands %} + + {% endfor %} + {% endif %} + + {% endfor %} +
+
+
+ + {% include "socialaccount/snippets/login_extra.html" %} + + {% else %} +

{% blocktrans %}If you have not created an account yet, then please + sign up first.{% endblocktrans %}

+ {% endif %} + +
+

If you already have an account, please sign in here:

+ +
+
+
+{% endblock %} diff --git a/amiibofindr/urls.py b/amiibofindr/urls.py index 1f6e860..8bb2f92 100644 --- a/amiibofindr/urls.py +++ b/amiibofindr/urls.py @@ -28,6 +28,7 @@ handler500 = 'amiibofindr.apps.core.views.error500' urlpatterns = patterns( '', url(r'^amiibofindr-admin/', include(admin.site.urls)), + url(r'^account/', include('allauth.urls')), url(r'^', include('amiibofindr.apps.amiibo.urls', namespace='amiibo')), url(r'^', include('amiibofindr.apps.home.urls', namespace='home')), ) diff --git a/requirements/base.txt b/requirements/base.txt index 81dedfa..84e09d2 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -38,3 +38,6 @@ django-htmlmin==0.7.0 # External services tweepy==3.3.0 + +# auth +django-allauth==0.23.0 From 16b4a9ef0d195c9dce19c2b8e297d91213894d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Tue, 1 Sep 2015 20:25:22 +0200 Subject: [PATCH 002/106] Added login/register buttons to navbar --- amiibofindr/settings/base.py | 4 +++- amiibofindr/templates/_layout.html | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index b528ddf..259063e 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -144,5 +144,7 @@ AUTHENTICATION_BACKENDS = ( # Sites and social auth +ACCOUNT_LOGOUT_ON_GET = True + SITE_ID = 1 -LOGIN_REDIRECT_URL = '/account/profile/' +LOGIN_REDIRECT_URL = '/' diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index 72ce011..d0ffb61 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -66,8 +66,11 @@
{% else %} - From 46a0f04718ac8331c0134063e17acfc3797a69dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Tue, 1 Sep 2015 20:26:01 +0200 Subject: [PATCH 003/106] Login layout with errors --- amiibofindr/templates/account/login.html | 50 +++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/amiibofindr/templates/account/login.html b/amiibofindr/templates/account/login.html index b68fdf2..58dabce 100644 --- a/amiibofindr/templates/account/login.html +++ b/amiibofindr/templates/account/login.html @@ -50,15 +50,55 @@ {% endif %}
-

If you already have an account, please sign in here:

-
From 7db4bafbe184391d008fca995824afc8b01ac498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 08:30:51 +0200 Subject: [PATCH 004/106] console email backend for devel settings --- amiibofindr/settings/devel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/amiibofindr/settings/devel.py b/amiibofindr/settings/devel.py index 8cd51e1..1ae8ac5 100644 --- a/amiibofindr/settings/devel.py +++ b/amiibofindr/settings/devel.py @@ -21,6 +21,8 @@ DATABASES = { MEDIA_URL = '/media/' MEDIA_ROOT = '/vagrant/media' +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + try: from local_settings import * except ImportError as e: From 5af677f3a765b10b1d8394d7efa2ebaf865de5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 22:48:40 +0200 Subject: [PATCH 005/106] Ignore emacs ~ files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 35ed792..c4b9084 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,5 @@ media/ bower_components/ node_modules/ amiibofindr/static/css + +*~ \ No newline at end of file From f70d4f0aa868bfe9fc98ef303cfe391894ffac0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 22:49:03 +0200 Subject: [PATCH 006/106] Added emails, password set and password change pages --- amiibofindr/templates/_layout.html | 13 ++- amiibofindr/templates/account/_layout.html | 1 + amiibofindr/templates/account/email.html | 88 +++++++++++++++++++ .../templates/account/password_change.html | 62 +++++++++++++ .../templates/account/password_set.html | 57 ++++++++++++ 5 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 amiibofindr/templates/account/_layout.html create mode 100644 amiibofindr/templates/account/email.html create mode 100644 amiibofindr/templates/account/password_change.html create mode 100644 amiibofindr/templates/account/password_set.html diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index d0ffb61..e85c35d 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -117,7 +117,18 @@ {% endblock %} - + + {% if messages %} +
+
+ {% for message in messages %} +
{{ message }}
+ {% endfor %} + +
+
+ {% endif %} + {% block main_content %}{% endblock %}

diff --git a/amiibofindr/templates/account/_layout.html b/amiibofindr/templates/account/_layout.html new file mode 100644 index 0000000..0e893d8 --- /dev/null +++ b/amiibofindr/templates/account/_layout.html @@ -0,0 +1 @@ +{% extends "_layout.html" %} diff --git a/amiibofindr/templates/account/email.html b/amiibofindr/templates/account/email.html new file mode 100644 index 0000000..f15012e --- /dev/null +++ b/amiibofindr/templates/account/email.html @@ -0,0 +1,88 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Account" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "E-mail Addresses" %}

+ + {% if user.emailaddress_set.all %} +
+ +

{% trans 'The following e-mail addresses are associated with your account:' %}

+ + +
+ {% else %} +

{% trans 'Warning:'%} {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}

+ {% endif %} + +

{% trans "Add E-mail Address" %}

+
+
+ {% csrf_token %} + +
+ {{ form.email.label_tag }} + {{ form.email }} + + {% if form.errors.email %} +
+ {% for error in form.errors.email %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + +
+
+
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_change.html b/amiibofindr/templates/account/password_change.html new file mode 100644 index 0000000..b544ac1 --- /dev/null +++ b/amiibofindr/templates/account/password_change.html @@ -0,0 +1,62 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Change Password" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Change Password" %}

+ +
+
+ {% csrf_token %} + +
+ {{ form.oldpassword.label_tag }} + {{ form.oldpassword }} + + {% if form.errors.oldpassword %} +
+ {% for error in form.errors.oldpassword %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+ {{ form.password1.label_tag }} + {{ form.password1 }} + + {% if form.errors.password1 %} +
+ {% for error in form.errors.password1 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + +
+ {{ form.password2.label_tag }} + {{ form.password2 }} + + {% if form.errors.password2 %} +
+ {% for error in form.errors.password2 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + + +
+
+
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_set.html b/amiibofindr/templates/account/password_set.html new file mode 100644 index 0000000..ed2f269 --- /dev/null +++ b/amiibofindr/templates/account/password_set.html @@ -0,0 +1,57 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Set Password" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Set Password" %}

+ +
+ {% csrf_token %} + + {% comment %} + {% if form.errors %} +
+ {% for field_name, errors in form.errors.items %} + {% for error in errors %} +

{{ error }}

+ {% endfor %} + {% endfor %} +
+ {% endif %} + {% endcomment %} + +
+ {{ form.password1.label_tag }} + {{ form.password1 }} + + {% if form.errors.password1 %} +
+ {% for error in form.errors.password1 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + +
+ {{ form.password2.label_tag }} + {{ form.password2 }} + {% if form.errors.password2 %} +
+ {% for error in form.errors.password2 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + +
+
+
+{% endblock %} From edd6403d80136b1309a91dcb259e7312950edb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 23:29:25 +0200 Subject: [PATCH 007/106] Finished password layouts --- .../templates/account/password_change.html | 4 +- .../templates/account/password_reset.html | 46 +++++++++++ .../account/password_reset_done.html | 24 ++++++ .../account/password_reset_from_key.html | 60 ++++++++++++++ .../account/password_reset_from_key_done.html | 16 ++++ .../templates/account/password_set.html | 81 ++++++++++--------- 6 files changed, 190 insertions(+), 41 deletions(-) create mode 100644 amiibofindr/templates/account/password_reset.html create mode 100644 amiibofindr/templates/account/password_reset_done.html create mode 100644 amiibofindr/templates/account/password_reset_from_key.html create mode 100644 amiibofindr/templates/account/password_reset_from_key_done.html diff --git a/amiibofindr/templates/account/password_change.html b/amiibofindr/templates/account/password_change.html index b544ac1..bc47337 100644 --- a/amiibofindr/templates/account/password_change.html +++ b/amiibofindr/templates/account/password_change.html @@ -39,7 +39,6 @@ {% endif %}
-
{{ form.password2.label_tag }} {{ form.password2 }} @@ -53,7 +52,8 @@ {% endif %}
- + diff --git a/amiibofindr/templates/account/password_reset.html b/amiibofindr/templates/account/password_reset.html new file mode 100644 index 0000000..b663d20 --- /dev/null +++ b/amiibofindr/templates/account/password_reset.html @@ -0,0 +1,46 @@ +{% extends "account/_layout.html" %} + +{% load account %} +{% load i18n %} + +{% block page_title %}{% trans "Password Reset" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Password Reset" %}

+ +
+ {% if user.is_authenticated %} +
+ {% include "account/snippets/already_logged_in.html" %} +
+

{% trans 'Go back to the homepage' %}

+ {% else %} +

{% trans "Have you forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

+ +
+ {% csrf_token %} +
+ {{ form.email.label_tag }} + {{ form.email }} + + {% if form.errors.email %} +
+ {% for error in form.errors.email %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+
+

{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

+ {% endif %} +
+ + +
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_reset_done.html b/amiibofindr/templates/account/password_reset_done.html new file mode 100644 index 0000000..d26a524 --- /dev/null +++ b/amiibofindr/templates/account/password_reset_done.html @@ -0,0 +1,24 @@ +{% extends "account/_layout.html" %} + +{% load account %} +{% load i18n %} + +{% block page_title %}{% trans "Password Reset" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Password Reset" %}

+ + {% if user.is_authenticated %} +
+ {% include "account/snippets/already_logged_in.html" %} +
+ {% else %} +
+

{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

+
+ {% endif %} +
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_reset_from_key.html b/amiibofindr/templates/account/password_reset_from_key.html new file mode 100644 index 0000000..7e8b019 --- /dev/null +++ b/amiibofindr/templates/account/password_reset_from_key.html @@ -0,0 +1,60 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Change Password" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

+ + {% if token_fail %} + {% url 'account_reset_password' as passwd_reset_url %} +
+

{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a new password reset.{% endblocktrans %}

+
+ {% else %} +
+ {% if form %} +
+ {% csrf_token %} + +
+ {{ form.password1.label_tag }} + {{ form.password1 }} + + {% if form.errors.password1 %} +
+ {% for error in form.errors.password1 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+ {{ form.password2.label_tag }} + {{ form.password2 }} + + {% if form.errors.password2 %} +
+ {% for error in form.errors.password2 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + +
+ {% else %} +
+

{% trans 'Your password is now changed.' %}

+
+ {% endif %} +
+ {% endif %} +
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_reset_from_key_done.html b/amiibofindr/templates/account/password_reset_from_key_done.html new file mode 100644 index 0000000..1d86edb --- /dev/null +++ b/amiibofindr/templates/account/password_reset_from_key_done.html @@ -0,0 +1,16 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Change Password" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Change Password" %}

+
+

{% trans 'Your password is now changed.' %}

+
+
+
+{% endblock %} diff --git a/amiibofindr/templates/account/password_set.html b/amiibofindr/templates/account/password_set.html index ed2f269..f67954c 100644 --- a/amiibofindr/templates/account/password_set.html +++ b/amiibofindr/templates/account/password_set.html @@ -5,53 +5,56 @@ {% block page_title %}{% trans "Set Password" %} | {{ block.super }}{% endblock %} {% block main_content %} -
-
+
+

{% trans "Set Password" %}

-
- {% csrf_token %} +
+ + {% csrf_token %} - {% comment %} - {% if form.errors %} -
- {% for field_name, errors in form.errors.items %} - {% for error in errors %} -

{{ error }}

+ {% comment %} + {% if form.errors %} +
+ {% for field_name, errors in form.errors.items %} + {% for error in errors %} +

{{ error }}

+ {% endfor %} {% endfor %} - {% endfor %} +
+ {% endif %} + {% endcomment %} + +
+ {{ form.password1.label_tag }} + {{ form.password1 }} + + {% if form.errors.password1 %} +
+ {% for error in form.errors.password1 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %}
- {% endif %} - {% endcomment %} - -
- {{ form.password1.label_tag }} - {{ form.password1 }} - - {% if form.errors.password1 %} -
- {% for error in form.errors.password1 %} -

{{ error }}

- {% endfor %} -
- {% endif %} -
-
- {{ form.password2.label_tag }} - {{ form.password2 }} - {% if form.errors.password2 %} -
- {% for error in form.errors.password2 %} -

{{ error }}

- {% endfor %} -
- {% endif %} -
+
+ {{ form.password2.label_tag }} + {{ form.password2 }} + {% if form.errors.password2 %} +
+ {% for error in form.errors.password2 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
- - + + +
{% endblock %} From c48659f7187ad71c2e35e252760953ab169f0ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 23:29:42 +0200 Subject: [PATCH 008/106] Fixed bad redirect on password set, updated settings --- amiibofindr/settings/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index 259063e..a172ca6 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -145,6 +145,8 @@ AUTHENTICATION_BACKENDS = ( # Sites and social auth ACCOUNT_LOGOUT_ON_GET = True +ACCOUNT_USERNAME_MIN_LENGTH = 3 SITE_ID = 1 LOGIN_REDIRECT_URL = '/' +LOGIN_URL = '/account/login/' From fa3e256de6bb0a87b153effe6726d738138d6a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Wed, 2 Sep 2015 23:44:36 +0200 Subject: [PATCH 009/106] Added social management layout --- .../templates/socialaccount/_layout.html | 1 + .../templates/socialaccount/connections.html | 63 +++++++++++++++++++ .../socialaccount/snippets/provider_list.html | 21 +++++++ 3 files changed, 85 insertions(+) create mode 100644 amiibofindr/templates/socialaccount/_layout.html create mode 100644 amiibofindr/templates/socialaccount/connections.html create mode 100644 amiibofindr/templates/socialaccount/snippets/provider_list.html diff --git a/amiibofindr/templates/socialaccount/_layout.html b/amiibofindr/templates/socialaccount/_layout.html new file mode 100644 index 0000000..ca9a9e1 --- /dev/null +++ b/amiibofindr/templates/socialaccount/_layout.html @@ -0,0 +1 @@ +{% extends '_layout.html' %} diff --git a/amiibofindr/templates/socialaccount/connections.html b/amiibofindr/templates/socialaccount/connections.html new file mode 100644 index 0000000..cf9a382 --- /dev/null +++ b/amiibofindr/templates/socialaccount/connections.html @@ -0,0 +1,63 @@ +{% extends "socialaccount/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Account Connections" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Account Connections" %}

+ +
+ {% if form.accounts %} +

{% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}

+ +
+ {% csrf_token %} + + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} + {{ error }} + {% endfor %} +
+ {% endif %} + +
+ {% for base_account in form.accounts %} + {% with base_account.get_provider_account as account %} +
+
+ +
+
+ {% endwith %} + {% endfor %} +
+ +
+ +
+
+ + {% else %} +

{% trans 'You currently have no social network accounts connected to this account.' %}

+ {% endif %} +
+ +

{% trans 'Add a 3rd Party Account' %}

+ +
+ {% include "socialaccount/snippets/provider_list.html" with process="connect" %} + {% include "socialaccount/snippets/login_extra.html" %} +
+
+
+{% endblock %} diff --git a/amiibofindr/templates/socialaccount/snippets/provider_list.html b/amiibofindr/templates/socialaccount/snippets/provider_list.html new file mode 100644 index 0000000..45216b9 --- /dev/null +++ b/amiibofindr/templates/socialaccount/snippets/provider_list.html @@ -0,0 +1,21 @@ +{% load socialaccount %} + +{% get_providers as socialaccount_providers %} + +{% for provider in socialaccount_providers %} + {% if provider.id == "openid" %} + {% for brand in provider.get_brands %} + + {% endfor %} + {% endif %} + +{% endfor %} From 9022478f2d500cb18e7524a9483b9aae52598477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Thu, 3 Sep 2015 18:01:42 +0200 Subject: [PATCH 010/106] Register layout --- amiibofindr/templates/account/signup.html | 83 +++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 amiibofindr/templates/account/signup.html diff --git a/amiibofindr/templates/account/signup.html b/amiibofindr/templates/account/signup.html new file mode 100644 index 0000000..584c750 --- /dev/null +++ b/amiibofindr/templates/account/signup.html @@ -0,0 +1,83 @@ +{% extends "account/_layout.html" %} + +{% load i18n %} + +{% block page_title %}{% trans "Signup" %} | {{ block.super }}{% endblock %} + +{% block main_content %} +
+
+

{% trans "Sign Up" %}

+ +
+
+

{% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}

+
+ +
+ + {% csrf_token %} + +
+ {{ form.username.label_tag }} + {{ form.username }} + + {% if form.errors.username %} +
+ {% for error in form.errors.username %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+ {{ form.email.label_tag }} + {{ form.email }} + + {% if form.errors.email %} +
+ {% for error in form.errors.email %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+ {{ form.password1.label_tag }} + {{ form.password1 }} + + {% if form.errors.password1 %} +
+ {% for error in form.errors.password1 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ +
+ {{ form.password2.label_tag }} + {{ form.password2 }} + + {% if form.errors.password2 %} +
+ {% for error in form.errors.password2 %} +

{{ error }}

+ {% endfor %} +
+ {% endif %} +
+ + {% if redirect_field_value %} + + {% endif %} + +
+ +
+
+
+{% endblock %} From 8d3cd83f0bd4af06464a070f917e19d610653262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Thu, 3 Sep 2015 18:37:41 +0200 Subject: [PATCH 011/106] Added Spanish locale. --- amiibofindr/locale/es/LC_MESSAGES/django.po | 337 +++++++++++++++++++ amiibofindr/settings/base.py | 11 +- amiibofindr/templates/amiibo/collection.html | 2 +- 3 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 amiibofindr/locale/es/LC_MESSAGES/django.po diff --git a/amiibofindr/locale/es/LC_MESSAGES/django.po b/amiibofindr/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000..b9df52c --- /dev/null +++ b/amiibofindr/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,337 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-03 18:47+0200\n" +"PO-Revision-Date: 2015-09-03 18:47+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.4\n" + +#: amiibofindr/templates/404.html:10 +msgid "Not found!" +msgstr "No encontrado." + +#: amiibofindr/templates/404.html:12 +#, python-format +msgid "" +"\n" +"\t\t\t\tOoooopsie. We didn't find what you're looking for. Go back to the home page.\n" +"\t\t\t" +msgstr "" +"\n" +"Ooops. No hemos podido encontrar lo que estabas buscando. Volver a la home." + +#: amiibofindr/templates/500.html:9 +msgid "Server error" +msgstr "Error de servidor" + +#: amiibofindr/templates/500.html:12 +#, python-format +msgid "" +"\n" +"\t\t\t\tThere was a server issue. Our developers have been informed of this. " +"Please try refreshing the page or go back to the " +"home page.\n" +"\t\t\t" +msgstr "" +"\n" +"Ha habido un problema en nuestro servidor. Nuestros desarrolladores han sido " +"informados. Por favor, prueba refrescando la página o vuelve a la home." + +#: amiibofindr/templates/_layout.html:33 amiibofindr/templates/_layout.html:91 +msgid "Figures" +msgstr "Figuras" + +#: amiibofindr/templates/_layout.html:36 amiibofindr/templates/_layout.html:93 +msgid "All" +msgstr "Todas" + +#: amiibofindr/templates/_layout.html:63 +#: amiibofindr/templates/account/password_reset_from_key.html:49 +msgid "Change password" +msgstr "Cambiar contraseña" + +#: amiibofindr/templates/_layout.html:64 +msgid "Emails" +msgstr "Emails" + +#: amiibofindr/templates/_layout.html:66 +msgid "Log out" +msgstr "Cerrar sesión" + +#: amiibofindr/templates/_layout.html:71 +msgid "Login" +msgstr "Iniciar sesión" + +#: amiibofindr/templates/_layout.html:74 +msgid "Register" +msgstr "Registrarse" + +#: amiibofindr/templates/_layout.html:138 +msgid "Select desired currency" +msgstr "Seleccionar moneda" + +#: amiibofindr/templates/account/email.html:5 +msgid "Account" +msgstr "Mi cuenta" + +#: amiibofindr/templates/account/email.html:10 +msgid "E-mail Addresses" +msgstr "Cuentas de email" + +#: amiibofindr/templates/account/email.html:15 +msgid "The following e-mail addresses are associated with your account:" +msgstr "Los siguientes emails están asociados a tu cuenta:" + +#: amiibofindr/templates/account/email.html:37 +msgid "Verified" +msgstr "Verificada" + +#: amiibofindr/templates/account/email.html:39 +msgid "Unverified" +msgstr "Sin verificar" + +#: amiibofindr/templates/account/email.html:42 +msgid "Primary" +msgstr "Primaria" + +#: amiibofindr/templates/account/email.html:51 +msgid "Make Primary" +msgstr "Hacer primaria" + +#: amiibofindr/templates/account/email.html:53 +msgid "Re-send Verification" +msgstr "Re-enviar verificación" + +#: amiibofindr/templates/account/email.html:55 +#: amiibofindr/templates/socialaccount/connections.html:46 +msgid "Remove" +msgstr "Eliminar" + +#: amiibofindr/templates/account/email.html:60 +msgid "Warning:" +msgstr "Alerta:" + +#: amiibofindr/templates/account/email.html:60 +msgid "" +"You currently do not have any e-mail address set up. You should really add " +"an e-mail address so you can receive notifications, reset your password, etc." +msgstr "" +"Actualmente no tienes ningún email asociado a tu cuenta. Deberías añadir uno " +"para que puedas recibir notificaciones, restablecer tu contraseña, etc." + +#: amiibofindr/templates/account/email.html:63 +msgid "Add E-mail Address" +msgstr "Añadir una dirección de email" + +#: amiibofindr/templates/account/email.html:83 +msgid "Add E-mail" +msgstr "Añadir email" + +#: amiibofindr/templates/account/login.html:6 +#: amiibofindr/templates/account/login.html:13 +#: amiibofindr/templates/account/login.html:101 +msgid "Sign In" +msgstr "Iniciar sesión" + +#: amiibofindr/templates/account/login.html:17 +#, python-format +msgid "" +"Please sign in with one\n" +" of your existing social accounts. Or, sign up\n" +" for a %(site_name)s account and sign in below." +msgstr "" +"Por favor inicia sesión con una de tus redes sociales. O, registrate para crear una cuenta en %(site_name)s e " +"inicia sesión más abajo." + +#: amiibofindr/templates/account/login.html:48 +#, python-format +msgid "" +"If you have not created an account yet, then please\n" +" sign up first." +msgstr "" +"Si aún no has creado una cuenta, por favor, regístrate primero." + +#: amiibofindr/templates/account/login.html:53 +msgid "If you already have an account, please sign in here:" +msgstr "Si ya tienes una cuenta, inicia sesión aquí:" + +#: amiibofindr/templates/account/login.html:91 +msgid "Remember me" +msgstr "Recordarme" + +#: amiibofindr/templates/account/login.html:100 +msgid "Forgot Password?" +msgstr "He olvidado mi contraseña" + +#: amiibofindr/templates/account/password_change.html:5 +#: amiibofindr/templates/account/password_change.html:10 +#: amiibofindr/templates/account/password_reset_from_key.html:5 +#: amiibofindr/templates/account/password_reset_from_key.html:10 +#: amiibofindr/templates/account/password_reset_from_key_done.html:5 +#: amiibofindr/templates/account/password_reset_from_key_done.html:10 +msgid "Change Password" +msgstr "Cambiar contraseña" + +#: amiibofindr/templates/account/password_change.html:56 +#: amiibofindr/templates/account/password_set.html:56 +msgid "Set password" +msgstr "Establecer una contraseña" + +#: amiibofindr/templates/account/password_reset.html:6 +#: amiibofindr/templates/account/password_reset.html:11 +#: amiibofindr/templates/account/password_reset_done.html:6 +#: amiibofindr/templates/account/password_reset_done.html:11 +msgid "Password Reset" +msgstr "Respetar mi contraseña" + +#: amiibofindr/templates/account/password_reset.html:18 +msgid "Go back to the homepage" +msgstr "Volver a la página principal" + +#: amiibofindr/templates/account/password_reset.html:20 +msgid "" +"Have you forgotten your password? Enter your e-mail address below, and we'll " +"send you an e-mail allowing you to reset it." +msgstr "" +"¿Has olvidado tu contraseña? Introduce tu dirección de correo y te " +"enviaremos instrucciones de como restablecerla." + +#: amiibofindr/templates/account/password_reset.html:36 +msgid "Reset My Password" +msgstr "Restablecer mi contraseña" + +#: amiibofindr/templates/account/password_reset.html:39 +msgid "Please contact us if you have any trouble resetting your password." +msgstr "" +"Por favor contacta con nosotros si tienes algún problema restablecer tu " +"contraseña." + +#: amiibofindr/templates/account/password_reset_done.html:19 +msgid "" +"We have sent you an e-mail. Please contact us if you do not receive it " +"within a few minutes." +msgstr "" +"Te hemos enviado un correo electrónico. Contacta con nosotros si no lo has " +"recibido en unos minutos." + +#: amiibofindr/templates/account/password_reset_from_key.html:10 +msgid "Bad Token" +msgstr "Token invalido" + +#: amiibofindr/templates/account/password_reset_from_key.html:15 +#, python-format +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" +"El enlace para restablecer tu contraseña es invalido, probablemente porque " +"ya haya sido usado. Por favor, vuelve a " +"restablecer tu contraseña." + +#: amiibofindr/templates/account/password_reset_from_key.html:53 +#: amiibofindr/templates/account/password_reset_from_key_done.html:12 +msgid "Your password is now changed." +msgstr "Tu contraseña ha sido cambiada." + +#: amiibofindr/templates/account/password_set.html:5 +#: amiibofindr/templates/account/password_set.html:10 +msgid "Set Password" +msgstr "Establecer contraseña" + +#: amiibofindr/templates/account/signup.html:5 +msgid "Signup" +msgstr "Registrarse" + +#: amiibofindr/templates/account/signup.html:10 +#: amiibofindr/templates/account/signup.html:77 +msgid "Sign Up" +msgstr "Registrarse" + +#: amiibofindr/templates/account/signup.html:14 +#, python-format +msgid "" +"Already have an account? Then please sign in." +msgstr "¿Ya tienes una cuenta? Inicia sesión." + +#: amiibofindr/templates/amiibo/amiibo.html:4 +#: amiibofindr/templates/amiibo/amiibo.html:6 +#: amiibofindr/templates/amiibo/amiibo.html:7 +#, python-format +msgid "%(amiibo)s amiibo from %(collection)s in " +msgstr "%(amiibo)s amiibo de %(collection)s en " + +#: amiibofindr/templates/amiibo/amiibo.html:60 +msgid "Shop" +msgstr "Tienda" + +#: amiibofindr/templates/amiibo/amiibo.html:61 +msgid "Price" +msgstr "Precio" + +#: amiibofindr/templates/amiibo/amiibo.html:76 +msgid "Updated " +msgstr "Actualizado" + +#: amiibofindr/templates/amiibo/amiibo.html:82 +msgid "This is a pack of various items" +msgstr "Este es un pack que contiene varios artículos" + +#: amiibofindr/templates/amiibo/amiibo.html:93 +msgid "No stock" +msgstr "Sin stock" + +#: amiibofindr/templates/amiibo/collection.html:4 +#: amiibofindr/templates/amiibo/collection.html:6 +#: amiibofindr/templates/amiibo/collection.html:7 +#, python-format +msgid "%(collection)s amiibos in " +msgstr "Amiibos de %(collection)s en " + +#: amiibofindr/templates/amiibo/collection.html:18 +msgid "All amiibo" +msgstr "Todos los amiibo" + +#: amiibofindr/templates/amiibo/collection.html:29 +msgid "Search..." +msgstr "Buscar…" + +#: amiibofindr/templates/socialaccount/connections.html:5 +#: amiibofindr/templates/socialaccount/connections.html:10 +msgid "Account Connections" +msgstr "Conexiones con mi cuenta" + +#: amiibofindr/templates/socialaccount/connections.html:14 +msgid "" +"You can sign in to your account using any of the following third party " +"accounts:" +msgstr "" +"Puedes iniciar sesión en tu cuenta usando una de las siguientes redes " +"sociales:" + +#: amiibofindr/templates/socialaccount/connections.html:51 +msgid "" +"You currently have no social network accounts connected to this account." +msgstr "No tienes redes sociales asociadas a tu cuenta." + +#: amiibofindr/templates/socialaccount/connections.html:55 +msgid "Add a 3rd Party Account" +msgstr "Asociar una red social" diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index a172ca6..5903ae4 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -1,3 +1,4 @@ +# coding: utf-8 """ Django settings for amiibofindr project. @@ -115,7 +116,12 @@ DATABASES = { # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'es' + +LANGUAGES = ( + ('en-us', u'English'), + ('es', u'Español'), +) TIME_ZONE = 'Europe/Madrid' @@ -125,6 +131,9 @@ USE_L10N = True USE_TZ = True +LOCALE_PATHS = ( + os.path.join(BASE_DIR, 'locale'), +) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ diff --git a/amiibofindr/templates/amiibo/collection.html b/amiibofindr/templates/amiibo/collection.html index dc5548e..f7c49b9 100644 --- a/amiibofindr/templates/amiibo/collection.html +++ b/amiibofindr/templates/amiibo/collection.html @@ -26,7 +26,7 @@
{% if selected_collection.name %}

{{ selected_collection.name }}

{% endif %}
- +
From 946c14530a282e8ff238ec975a4dc270aac5846b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Sat, 5 Sep 2015 21:24:04 +0200 Subject: [PATCH 012/106] Added i18n patterns and language list to template --- amiibofindr/settings/base.py | 5 +++-- amiibofindr/templates/_layout.html | 14 +++++++++++++- amiibofindr/urls.py | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index 5903ae4..b187fd0 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -66,6 +66,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', @@ -116,10 +117,10 @@ DATABASES = { # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ -LANGUAGE_CODE = 'es' +LANGUAGE_CODE = 'en' LANGUAGES = ( - ('en-us', u'English'), + ('en', u'English'), ('es', u'Español'), ) diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index e85c35d..8b7c5f5 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -140,7 +140,19 @@ {% endfor %}
-
+
+

{% trans "Language" %}

+ + {% get_available_languages as languages %} + + +

AmiiboFindr

diff --git a/amiibofindr/urls.py b/amiibofindr/urls.py index 8bb2f92..1142519 100644 --- a/amiibofindr/urls.py +++ b/amiibofindr/urls.py @@ -19,6 +19,7 @@ from django.conf.urls import include, url, patterns from django.contrib import admin from django.conf import settings from django.conf.urls.static import static +from django.conf.urls.i18n import i18n_patterns handler404 = 'amiibofindr.apps.core.views.error404' @@ -28,6 +29,9 @@ handler500 = 'amiibofindr.apps.core.views.error500' urlpatterns = patterns( '', url(r'^amiibofindr-admin/', include(admin.site.urls)), +) + +urlpatterns += i18n_patterns( url(r'^account/', include('allauth.urls')), url(r'^', include('amiibofindr.apps.amiibo.urls', namespace='amiibo')), url(r'^', include('amiibofindr.apps.home.urls', namespace='home')), From d3c71ba13f4b2e2228180c0b4f8a35d2c8d0c03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Mon, 7 Sep 2015 20:53:54 +0200 Subject: [PATCH 013/106] Language and selected currency class now match --- amiibofindr/static/app/money.js | 4 ++-- amiibofindr/templates/_layout.html | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/amiibofindr/static/app/money.js b/amiibofindr/static/app/money.js index 119c9c3..dddbe4a 100644 --- a/amiibofindr/static/app/money.js +++ b/amiibofindr/static/app/money.js @@ -61,8 +61,8 @@ var self = this; if (this.currencies.indexOf(currency) !== -1) { if (this.DEBUG) console.log('[money] set user currency: ' + currency) - $('[data-currency-change]').removeClass('underlined'); - $('[data-currency-change="' + currency + '"]').addClass('underlined'); + $('[data-currency-change]').removeClass('active'); + $('[data-currency-change="' + currency + '"]').addClass('active'); window.localStorage.setItem('currency', currency); this.currency = currency; this.convertPrices(); diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index 8b7c5f5..ee8d5b2 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -1,5 +1,6 @@ {% load static i18n account %} {% user_display user as user_display %} +{% get_current_language as LANGUAGE_CODE %} @@ -148,7 +149,7 @@ From 5ff3bce5e2ba4ad153208698fc3aec2b612301f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Mon, 7 Sep 2015 21:02:21 +0200 Subject: [PATCH 014/106] Added i18n to 'all' amiibo list --- amiibofindr/apps/amiibo/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amiibofindr/apps/amiibo/views.py b/amiibofindr/apps/amiibo/views.py index 5eeb47d..d34f4ea 100644 --- a/amiibofindr/apps/amiibo/views.py +++ b/amiibofindr/apps/amiibo/views.py @@ -3,6 +3,7 @@ # django from django.shortcuts import render, get_object_or_404 from django.views.generic.base import View +from django.utils.translation import gettext as _ # amiibo from amiibofindr.apps.amiibo.models import Collection, Amiibo @@ -10,9 +11,10 @@ from amiibofindr.apps.amiibo.models import Collection, Amiibo class CollectionView(View): template = 'amiibo/collection.html' + all_word = _('all') def get(self, request, collection='all'): - if collection != 'all': + if collection != self.all_word: collection = get_object_or_404(Collection, slug=collection) amiibo_list = collection.amiibos else: From 23c3405a00b9e082dd2609b64fe3c9abbb4fdda8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Mon, 7 Sep 2015 21:20:39 +0200 Subject: [PATCH 015/106] Added language switcher and fixed main link --- amiibofindr/apps/core/context_processors.py | 15 +++++++++++++ amiibofindr/apps/home/urls.py | 2 +- amiibofindr/settings/base.py | 1 + amiibofindr/templates/_layout.html | 25 +++++++++++---------- amiibofindr/urls.py | 3 ++- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/amiibofindr/apps/core/context_processors.py b/amiibofindr/apps/core/context_processors.py index 9a6c7a8..f9edea0 100644 --- a/amiibofindr/apps/core/context_processors.py +++ b/amiibofindr/apps/core/context_processors.py @@ -18,3 +18,18 @@ def files(request): 'MEDIA_URL': settings.MEDIA_URL, 'STATIC_URL': settings.STATIC_URL, } + + +def i18n(request): + result = [] + for lang_code, name in settings.LANGUAGES: + this = { + 'code': lang_code, + 'name': name, + 'url': request.path.replace(request.LANGUAGE_CODE, lang_code) + } + result.append(this) + + return { + 'LANGUAGES': result + } diff --git a/amiibofindr/apps/home/urls.py b/amiibofindr/apps/home/urls.py index a8d1cb6..1e7e33a 100644 --- a/amiibofindr/apps/home/urls.py +++ b/amiibofindr/apps/home/urls.py @@ -9,5 +9,5 @@ from .views import HomeView urlpatterns = patterns( '', - url(r'^$', HomeView.as_view()), + url(r'^$', HomeView.as_view(), name='redirect'), ) diff --git a/amiibofindr/settings/base.py b/amiibofindr/settings/base.py index b187fd0..86e7a47 100644 --- a/amiibofindr/settings/base.py +++ b/amiibofindr/settings/base.py @@ -95,6 +95,7 @@ TEMPLATES = [ 'amiibofindr.apps.amiibo.context_processors.currencies', 'amiibofindr.apps.core.context_processors.debug', 'amiibofindr.apps.core.context_processors.files', + 'amiibofindr.apps.core.context_processors.i18n', ], }, }, diff --git a/amiibofindr/templates/_layout.html b/amiibofindr/templates/_layout.html index ee8d5b2..2468c1d 100644 --- a/amiibofindr/templates/_layout.html +++ b/amiibofindr/templates/_layout.html @@ -1,6 +1,8 @@ {% load static i18n account %} {% user_display user as user_display %} {% get_current_language as LANGUAGE_CODE %} +{% get_available_languages as languages %} +{% trans 'all' as all_word %} @@ -29,12 +31,12 @@
diff --git a/amiibofindr/templates/amiibo/amiibo-card.html b/amiibofindr/templates/amiibo/amiibo-card.html index dd7a195..c09fe2f 100644 --- a/amiibofindr/templates/amiibo/amiibo-card.html +++ b/amiibofindr/templates/amiibo/amiibo-card.html @@ -1,104 +1,6 @@ -{% extends "_layout.html" %} -{% load i18n staticfiles thumbnail %} +{% extends "amiibo/amiibo-figure.html" %} +{% load thumbnail %} -{% block page_title %}{% blocktrans with collection=selected_collection.name amiibo=amiibo.name %}{{ amiibo }} amiibo from {{ collection }} in {% endblocktrans %}{{ block.super }}{% endblock %} - -{% block meta_twitter_title %}{% blocktrans with collection=selected_collection.name amiibo=amiibo.name %}{{ amiibo }} amiibo from {{ collection }} in {% endblocktrans %}{{ block.super }}{% endblock %} -{% block meta_og_title %}{% blocktrans with collection=selected_collection.name amiibo=amiibo.name %}{{ amiibo }} amiibo from {{ collection }} in {% endblocktrans %}{{ block.super }}{% endblock %} - -{% block meta_twitter_image %}{% thumbnail amiibo.statue 300x300 %}{% endblock %} -{% block meta_og_image %}{% thumbnail amiibo.statue 300x300 %}{% endblock %} - -{% block meta_twitter_url %}{{ amiibo.get_absolute_url }}{% endblock %} -{% block meta_og_url %}{{ amiibo.get_absolute_url }}{% endblock %} - -{% block js_views %}money,time{% endblock %} - -{% block breadcrumb %} - {{ block.super }} - - {{ selected_collection.name }} - - {{ amiibo.name }} -{% endblock %} - -{% block main_content %} -
-
-
- - - -
- - -
{{ amiibo.name }}
- - -
- -
-
-
- {% if amiibo.shops_set.exists %} - - - - - - - - - {% for relation in amiibo.shops_set.all %} - - {% with price=relation.last_price.price stock=relation.last_price.stock currency=relation.last_price.currency %} - {% spaceless %} - - {% endspaceless %} - - {% endwith %} - - {% endfor %} - -
{% trans "Shop" %}{% trans "Price" %}
- - {{ relation.shop.name }} - - {% if relation.last_price.date %} - - - {% endif %} - {% if relation.is_pack %} - - - {% endif %} - - {% if stock and price %} - - {{ price }} {{ relation.last_price.currency }} - - {% else %} - {% trans "No stock" %} - {% endif %} -
- {% endif %} -
-
+{% block amiibo_image %} + {% endblock %} diff --git a/amiibofindr/templates/amiibo/amiibo-figure.html b/amiibofindr/templates/amiibo/amiibo-figure.html index 87cc7ee..4d39bb0 100644 --- a/amiibofindr/templates/amiibo/amiibo-figure.html +++ b/amiibofindr/templates/amiibo/amiibo-figure.html @@ -62,7 +62,9 @@ AMIIBO FIGURE
- + {% block amiibo_image %} + + {% endblock %}
diff --git a/amiibofindr/templates/amiibo/collection-cards.html b/amiibofindr/templates/amiibo/collection-cards.html new file mode 100644 index 0000000..a3156c1 --- /dev/null +++ b/amiibofindr/templates/amiibo/collection-cards.html @@ -0,0 +1,21 @@ +{% extends "amiibo/collection.html" %} +{% load i18n staticfiles %} + +{% block main_content %} +
+
+ {% if selected_collection.name %}

{{ selected_collection.name }}

{% endif %} +
+ + +
+
+
+
+ {% for amiibo in amiibo_list %} + {% include "amiibo/widgets/amiibo-card.html" with amiibo=amiibo only %} + {% endfor %} +
+
+
+{% endblock %} diff --git a/amiibofindr/templates/amiibo/widgets/amiibo-card.html b/amiibofindr/templates/amiibo/widgets/amiibo-card.html index 7224108..a71d9f6 100644 --- a/amiibofindr/templates/amiibo/widgets/amiibo-card.html +++ b/amiibofindr/templates/amiibo/widgets/amiibo-card.html @@ -2,7 +2,11 @@