Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
Merge 4d76614 into 27f943a
Browse files Browse the repository at this point in the history
  • Loading branch information
rmader committed May 16, 2019
2 parents 27f943a + 4d76614 commit 3e34fbb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
3 changes: 2 additions & 1 deletion liqd_product/apps/account/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ class Meta:
'homepage',
'facebook_handle',
'twitter_handle',
'get_notifications'
'get_notifications',
'get_newsletters'
]
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ <h1 class="u-first-heading">{% trans 'Your profile' %}</h1>

{% include 'liqd_product_contrib/includes/form_checkbox_field.html' with field=form.get_notifications %}

{% include 'liqd_product_contrib/includes/form_checkbox_field.html' with field=form.get_newsletters %}

<div class="u-spacer-bottom">
<button type="submit" class="btn btn--primary">{% trans 'Save changes'%}</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion liqd_product/apps/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def signup(self, request, user):
class Meta:
model = User
fields = ('email', 'username', 'password1', 'password2',
'terms_of_use')
'terms_of_use', 'get_newsletters')
20 changes: 20 additions & 0 deletions liqd_product/apps/users/migrations/0005_user_get_newsletters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-15 14:47
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('liqd_product_users', '0004_use_url_field_for_homepage'),
]

operations = [
migrations.AddField(
model_name='user',
name='get_newsletters',
field=models.BooleanField(default=False, help_text='Designates whether you want to receive newsletters. Unselect if you do not want to receive newsletters.', verbose_name='Send me newsletters'),
),
]
8 changes: 8 additions & 0 deletions liqd_product/apps/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ class User(auth_models.AbstractBaseUser, auth_models.PermissionsMixin):
'Unselect if you do not want to receive notifications.')
)

get_newsletters = models.BooleanField(
verbose_name=_('Send me newsletters'),
default=False,
help_text=_(
'Designates whether you want to receive newsletters. '
'Unselect if you do not want to receive newsletters.')
)

bio = models.TextField(
blank=True,
max_length=255,
Expand Down
11 changes: 10 additions & 1 deletion liqd_product/templates/account/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>{% trans "Register" %}</h1>
{{ form.non_field_errors }}
{% csrf_token %}
{% for field in form %}
{% if not forloop.last %}
{% if field is not form.terms_of_use and field is not form.get_newsletters %}
{% include 'liqd_product_contrib/includes/form_field.html' with field=field %}
{% endif %}
{% endfor %}
Expand All @@ -26,6 +26,15 @@ <h1>{% trans "Register" %}</h1>
</label>
{{ form.terms_of_use.errors }}
</div>
<div class="form-check">
<label class="form-check__label">
{{ form.get_newsletters }}
{% blocktrans %}
Send me newsletters
{% endblocktrans %}
</label>
{{ form.get_newsletters.errors }}
</div>
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
Expand Down

0 comments on commit 3e34fbb

Please sign in to comment.