From bc3c316152032fb01c6ed5c566d25665236012be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sat, 8 Nov 2014 12:52:05 +0100 Subject: [PATCH 01/11] Fixed account migration --- shelfzilla/apps/account/migrations/0001_initial.py | 1 - 1 file changed, 1 deletion(-) diff --git a/shelfzilla/apps/account/migrations/0001_initial.py b/shelfzilla/apps/account/migrations/0001_initial.py index 6eed83d..d7d8122 100644 --- a/shelfzilla/apps/account/migrations/0001_initial.py +++ b/shelfzilla/apps/account/migrations/0001_initial.py @@ -8,7 +8,6 @@ import django.utils.timezone class Migration(migrations.Migration): dependencies = [ - ('auth', '0003_auto_20141104_2302'), ] operations = [ From 87febe3e400f60f262411284a26b28062f8c2681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sat, 8 Nov 2014 12:55:05 +0100 Subject: [PATCH 02/11] Changed installed apps order --- shelfzilla/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shelfzilla/settings/base.py b/shelfzilla/settings/base.py index f87ede0..b82c226 100644 --- a/shelfzilla/settings/base.py +++ b/shelfzilla/settings/base.py @@ -33,8 +33,8 @@ ALLOWED_HOSTS = [] INSTALLED_APPS = ( # Auth - 'shelfzilla.apps.account', 'django.contrib.auth', + 'shelfzilla.apps.account', # Admin 'suit', From 31be965af9563fa12754b4c46018744586c7eb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sat, 8 Nov 2014 13:11:34 +0100 Subject: [PATCH 03/11] Fixed account migration dependencies --- shelfzilla/apps/account/migrations/0001_initial.py | 1 + 1 file changed, 1 insertion(+) diff --git a/shelfzilla/apps/account/migrations/0001_initial.py b/shelfzilla/apps/account/migrations/0001_initial.py index d7d8122..ec1a8d5 100644 --- a/shelfzilla/apps/account/migrations/0001_initial.py +++ b/shelfzilla/apps/account/migrations/0001_initial.py @@ -8,6 +8,7 @@ import django.utils.timezone class Migration(migrations.Migration): dependencies = [ + ('auth', '0001_initial'), ] operations = [ From 954251051c6b577ca3355313ce735b38bdc96f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sun, 9 Nov 2014 10:24:08 +0100 Subject: [PATCH 04/11] Avatar is now server via gravatar HTTPS --- shelfzilla/apps/account/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shelfzilla/apps/account/models.py b/shelfzilla/apps/account/models.py index a75d518..04edb85 100644 --- a/shelfzilla/apps/account/models.py +++ b/shelfzilla/apps/account/models.py @@ -23,7 +23,7 @@ class User(AbstractBaseUser, @property def avatar(self): avatar = '{}{}?s=300'.format( - 'http://www.gravatar.com/avatar/', + 'https://www.gravatar.com/avatar/', md5(self.email.lower()).hexdigest() ) return avatar From 5b33eef32ef5ba2e0aeabdf2c1f867614f19e731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Mon, 10 Nov 2014 10:11:51 +0100 Subject: [PATCH 05/11] Fixed bug with account admin --- shelfzilla/apps/account/admin.py | 60 ++++--------------------------- shelfzilla/apps/account/models.py | 7 ++-- 2 files changed, 9 insertions(+), 58 deletions(-) diff --git a/shelfzilla/apps/account/admin.py b/shelfzilla/apps/account/admin.py index a38afd8..5eca453 100644 --- a/shelfzilla/apps/account/admin.py +++ b/shelfzilla/apps/account/admin.py @@ -10,10 +10,8 @@ from __future__ import absolute_import, unicode_literals import logging # django imports -from django import forms from django.contrib import admin from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin -from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.contrib.auth.models import Permission from django.utils.translation import ugettext_lazy as _ @@ -23,56 +21,10 @@ from . import models logger = logging.getLogger(__name__) -class UserCreationForm(forms.ModelForm): - """A form for creating new users. Includes all the required - fields, plus a repeated password.""" - password1 = forms.CharField(label='Password', widget=forms.PasswordInput) - password2 = forms.CharField(label='Password confirmation', - widget=forms.PasswordInput) - - class Meta: - model = models.User - fields = ('email', 'birthdate') - - def clean_password2(self): - # Check that the two password entries match - password1 = self.cleaned_data.get("password1") - password2 = self.cleaned_data.get("password2") - if password1 and password2 and password1 != password2: - raise forms.ValidationError("Passwords don't match") - return password2 - - def save(self, commit=True): - # Save the provided password in hashed format - user = super(UserCreationForm, self).save(commit=False) - user.set_password(self.cleaned_data["password1"]) - if commit: - user.save() - return user - - -class UserChangeForm(forms.ModelForm): - """A form for updating users. Includes all the fields on - the user, but replaces the password field with admin's - password hash display field. - """ - password = ReadOnlyPasswordHashField() - - class Meta: - model = models.User - fields = ('email', 'password', 'birthdate', 'is_active', 'is_staff') - - def clean_password(self): - # Regardless of what the user provides, return the initial value. - # This is done here, rather than on the field, because the - # field does not have access to the initial value - return self.initial["password"] - - class UserAdmin(DjangoUserAdmin): # The forms to add and change user instances - form = UserChangeForm - add_form = UserCreationForm + # form = UserChangeForm + # add_form = UserCreationForm # The fields to be used in displaying the User model. # These override the definitions on the base UserAdmin @@ -84,19 +36,21 @@ class UserAdmin(DjangoUserAdmin): (None, {'fields': ('username', 'email', 'password')}), (_('Personal info'), {'fields': ( 'first_name', 'last_name', 'birthdate', 'gender', )}), - (_('Permissions'), {'fields': ('is_staff',)}), + (_('Permissions'), {'fields': ('is_staff', 'user_permissions')}), + (_('Information'), {'fields': ('date_joined', 'last_login', )}) ) # add_fieldsets is not a standard ModelAdmin attribute. UserAdmin # overrides get_fieldsets to use this attribute when creating a user. add_fieldsets = ( (None, { 'classes': ('wide',), - 'fields': ('email', 'birthdate', 'password1', 'password2') + 'fields': ('username', 'email', 'password1', 'password2') }), ) search_fields = ('email',) ordering = ('email',) - filter_horizontal = () + filter_horizontal = ('user_permissions', ) + readonly_fields = ('date_joined', 'last_login', ) # Now register the new UserAdmin... admin.site.register(models.User, UserAdmin) diff --git a/shelfzilla/apps/account/models.py b/shelfzilla/apps/account/models.py index 04edb85..bc00560 100644 --- a/shelfzilla/apps/account/models.py +++ b/shelfzilla/apps/account/models.py @@ -40,10 +40,7 @@ class User(AbstractBaseUser, verbose_name=_('Username'), max_length=128, unique=True, - blank=True, - null=True, db_index=True, - default=None, ) # personal info @@ -93,7 +90,7 @@ class User(AbstractBaseUser, ) USERNAME_FIELD = 'username' - REQUIRED_FIELDS = ('email', ) + REQUIRED_FIELDS = ('email',) objects = UserManager() @@ -101,7 +98,7 @@ class User(AbstractBaseUser, verbose_name = _('User') def __unicode__(self): - return self.username + return unicode(self.username) or unicode(self.email) @property def is_confirmed(self): From cc2a5eb2b4946d75e40ce48e3f862d9fcaf073aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Tue, 11 Nov 2014 09:03:49 +0100 Subject: [PATCH 06/11] Fixed volume badges showing even if the user is not logged in --- .../themes/bootflat/templates/manga/series/includes/volume.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html index 38bf36a..5918243 100644 --- a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html +++ b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html @@ -8,9 +8,11 @@
+ {% if request.user.is_authenticated %}
{% include "manga/series/includes/volume-badges.html" %}
+ {% endif %}
{% if type == 'slim' %} From 5cfb9adee1143cf0c70dcc897ae2bc929ae58de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Tue, 11 Nov 2014 12:13:13 +0100 Subject: [PATCH 07/11] Fixed admin account forms --- shelfzilla/apps/account/admin.py | 52 ++++++++++++++++++- .../migrations/0002_auto_20141111_1208.py | 20 +++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 shelfzilla/apps/account/migrations/0002_auto_20141111_1208.py diff --git a/shelfzilla/apps/account/admin.py b/shelfzilla/apps/account/admin.py index 5eca453..6c72074 100644 --- a/shelfzilla/apps/account/admin.py +++ b/shelfzilla/apps/account/admin.py @@ -10,8 +10,10 @@ from __future__ import absolute_import, unicode_literals import logging # django imports +from django import forms from django.contrib import admin from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin +from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.contrib.auth.models import Permission from django.utils.translation import ugettext_lazy as _ @@ -21,10 +23,56 @@ from . import models logger = logging.getLogger(__name__) +class UserCreationForm(forms.ModelForm): + """A form for creating new users. Includes all the required + fields, plus a repeated password.""" + password1 = forms.CharField(label='Password', widget=forms.PasswordInput) + password2 = forms.CharField(label='Password confirmation', + widget=forms.PasswordInput) + + class Meta: + model = models.User + fields = ('email', 'birthdate') + + def clean_password2(self): + # Check that the two password entries match + password1 = self.cleaned_data.get("password1") + password2 = self.cleaned_data.get("password2") + if password1 and password2 and password1 != password2: + raise forms.ValidationError("Passwords don't match") + return password2 + + def save(self, commit=True): + # Save the provided password in hashed format + user = super(UserCreationForm, self).save(commit=False) + user.set_password(self.cleaned_data["password1"]) + if commit: + user.save() + return user + + +class UserChangeForm(forms.ModelForm): + """A form for updating users. Includes all the fields on + the user, but replaces the password field with admin's + password hash display field. + """ + password = ReadOnlyPasswordHashField() + + class Meta: + model = models.User + fields = ('email', 'password', 'birthdate', 'is_active', 'is_staff') + + def clean_password(self): + # Regardless of what the user provides, return the initial value. + # This is done here, rather than on the field, because the + # field does not have access to the initial value + return self.initial["password"] + + class UserAdmin(DjangoUserAdmin): # The forms to add and change user instances - # form = UserChangeForm - # add_form = UserCreationForm + form = UserChangeForm + add_form = UserCreationForm # The fields to be used in displaying the User model. # These override the definitions on the base UserAdmin diff --git a/shelfzilla/apps/account/migrations/0002_auto_20141111_1208.py b/shelfzilla/apps/account/migrations/0002_auto_20141111_1208.py new file mode 100644 index 0000000..ad305e6 --- /dev/null +++ b/shelfzilla/apps/account/migrations/0002_auto_20141111_1208.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('account', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='username', + field=models.CharField(unique=True, max_length=128, verbose_name='Username', db_index=True), + preserve_default=True, + ), + ] From 82e25bdc9430c5bf412367802c5a3c24db8d14f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Tue, 11 Nov 2014 14:40:11 +0100 Subject: [PATCH 08/11] Fixed bug on users page preventing non-auth users from seeing left menu --- shelfzilla/themes/bootflat/templates/users/profile.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shelfzilla/themes/bootflat/templates/users/profile.html b/shelfzilla/themes/bootflat/templates/users/profile.html index aa86010..b65acc5 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile.html +++ b/shelfzilla/themes/bootflat/templates/users/profile.html @@ -25,11 +25,11 @@
{% trans "Summary" %} - {% if user.have_volumes.count > 0 %} + {% if item.have_volumes.count > 0 %} {% trans "Collection" %} {% endif %} - {% if user.wishlisted_volumes.count > 0 %} + {% if item.wishlisted_volumes.count > 0 %} {% trans "Wishlist" %} {% endif %} From 3f8b66058afcbb545d94eebd88ca38a71e595bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Tue, 11 Nov 2014 15:04:45 +0100 Subject: [PATCH 09/11] Added attribute to show series name in volume box --- .../bootflat/templates/manga/series/includes/volume.html | 3 +++ .../themes/bootflat/templates/users/profile/collection.html | 2 +- .../themes/bootflat/templates/users/profile/wishlist.html | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html index 5918243..05c59fc 100644 --- a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html +++ b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html @@ -14,6 +14,9 @@
{% endif %}
+ {% if show_name %} + + {% endif %} {% if type == 'slim' %}

{{ volume }}

diff --git a/shelfzilla/themes/bootflat/templates/users/profile/collection.html b/shelfzilla/themes/bootflat/templates/users/profile/collection.html index ad4c985..80515ae 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile/collection.html +++ b/shelfzilla/themes/bootflat/templates/users/profile/collection.html @@ -7,7 +7,7 @@
{% for owned_volume in item.have_volumes.all %}
- {% include "manga/series/includes/volume.html" with volume=owned_volume.volume user=item show_publisher=True %} + {% include "manga/series/includes/volume.html" with volume=owned_volume.volume user=item show_publisher=True show_name=True %}
{% if forloop.counter|divisibleby:3 %}
diff --git a/shelfzilla/themes/bootflat/templates/users/profile/wishlist.html b/shelfzilla/themes/bootflat/templates/users/profile/wishlist.html index bea8456..a5df0c0 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile/wishlist.html +++ b/shelfzilla/themes/bootflat/templates/users/profile/wishlist.html @@ -7,7 +7,7 @@
{% for wishlisted_volume in item.wishlisted_volumes.all %}
- {% include "manga/series/includes/volume.html" with volume=wishlisted_volume.volume user=item show_publisher=True %} + {% include "manga/series/includes/volume.html" with volume=wishlisted_volume.volume user=item show_publisher=True show_name=True %}
{% if forloop.counter|divisibleby:3 %}
From 1ce39125059592c138a2ef49d93b2779ef658b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Thu, 13 Nov 2014 11:14:40 +0100 Subject: [PATCH 10/11] Updated appfog cover helper to run over https --- .../bootflat/templates/_admin/volumes/includes/cover.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shelfzilla/themes/bootflat/templates/_admin/volumes/includes/cover.html b/shelfzilla/themes/bootflat/templates/_admin/volumes/includes/cover.html index 3645c18..922b633 100644 --- a/shelfzilla/themes/bootflat/templates/_admin/volumes/includes/cover.html +++ b/shelfzilla/themes/bootflat/templates/_admin/volumes/includes/cover.html @@ -36,7 +36,7 @@ submitButton.on('click', function() { $.getJSON( - 'http://google-images-api.eu01.aws.af.cm/', + 'https://google-images-api.eu01.aws.af.cm/', { q: searchQuery(), limit: searchLimit() }, function(data) { results.html(''); From 3067b5baf461426392510bd10555e0b0e7457266 Mon Sep 17 00:00:00 2001 From: Juan Manuel Parrilla Date: Fri, 14 Nov 2014 09:31:25 +0100 Subject: [PATCH 11/11] Avoiding post phase in spec file --- rpm/spec/shelfzilla.spec | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rpm/spec/shelfzilla.spec b/rpm/spec/shelfzilla.spec index 0c0420c..115c84f 100644 --- a/rpm/spec/shelfzilla.spec +++ b/rpm/spec/shelfzilla.spec @@ -55,26 +55,26 @@ cp -r %{_gitdir}/rpm/scripts/shelfzilla $RPM_BUILD_ROOT%{_app_dir}/init/ # -------------------------------------------------------------------------------------------- # %post ## Install init script -mv %{_app_dir}/init/shelfzilla %{_init_path}/ -chmod 775 %{_init_path}/shelfzilla -chkconfig --add shelfzilla -rmdir %{_app_dir}/init/ +#mv %{_app_dir}/init/shelfzilla %{_init_path}/ +#chmod 775 %{_init_path}/shelfzilla +#chkconfig --add shelfzilla +#rmdir %{_app_dir}/init/ ## Npm install -cd %{_app_dir} && npm install --production +#cd %{_app_dir} && npm install --production ## pip install -pip install -r %{_app_dir}/config/production/requirements.txt +#pip install -r %{_app_dir}/config/production/requirements.txt ## Migrate -python2.7 %{_app_dir}/manage.py migrate --no-initial-data +#python2.7 %{_app_dir}/manage.py migrate --no-initial-data ## Bower -cd %{_app_dir} -bower install --allow-root +#cd %{_app_dir} +#bower install --allow-root ## Collect static -python2.7 manage.py collectstatic --clear --noinput +#python2.7 manage.py collectstatic --clear --noinput # -------------------------------------------------------------------------------------------- # # pre-uninstall section: