diff --git a/src/profiles/forms.py b/src/profiles/forms.py deleted file mode 100644 index 81af6302..00000000 --- a/src/profiles/forms.py +++ /dev/null @@ -1,11 +0,0 @@ -from django import forms - -from . import models - - -class ProfileForm(forms.ModelForm): - email = forms.EmailField() - - class Meta: - model = models.Profile - fields = [] diff --git a/src/profiles/migrations/0002_profile_description.py b/src/profiles/migrations/0002_profile_description.py new file mode 100644 index 00000000..f53796c4 --- /dev/null +++ b/src/profiles/migrations/0002_profile_description.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-04-13 12:42 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='description', + field=models.TextField(default='', help_text='Please include any info you think could be relevant, like drivers license, first aid certificates, crafts, skills and previous experience.'), + ), + ] diff --git a/src/profiles/migrations/0003_auto_20170413_1703.py b/src/profiles/migrations/0003_auto_20170413_1703.py new file mode 100644 index 00000000..6025455d --- /dev/null +++ b/src/profiles/migrations/0003_auto_20170413_1703.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-04-13 15:03 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0002_profile_description'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='name', + field=models.CharField(blank=True, default='', help_text='Your name or handle', max_length=200), + ), + migrations.AlterField( + model_name='profile', + name='description', + field=models.TextField(blank=True, default='', help_text='Please include any info you think could be relevant, like drivers license, first aid certificates, crafts, skills and previous experience.'), + ), + ] diff --git a/src/profiles/models.py b/src/profiles/models.py index 2e85ca33..aaae85e2 100644 --- a/src/profiles/models.py +++ b/src/profiles/models.py @@ -18,6 +18,19 @@ class Profile(CreatedUpdatedModel, UUIDModel): help_text=_('The django user this profile belongs to.'), ) + name = models.CharField( + max_length=200, + default='', + blank=True, + help_text='Your name or handle' + ) + + description = models.TextField( + default='', + blank=True, + help_text='Please include any info you think could be relevant, like drivers license, first aid certificates, crafts, skills and previous experience. Please also include availability if you are not there for the full week.', + ) + @property def email(self): return self.user.email diff --git a/src/profiles/templates/account/email.html b/src/profiles/templates/account/email.html index ab5c1b26..743d9c4d 100644 --- a/src/profiles/templates/account/email.html +++ b/src/profiles/templates/account/email.html @@ -1,4 +1,4 @@ -{% extends 'profiles/profile_base.html' %} +{% extends 'profile_base.html' %} {% load i18n %} {% load bootstrap3 %} diff --git a/src/profiles/templates/account/email_confirm.html b/src/profiles/templates/account/email_confirm.html index 199d71f2..e7950cd3 100644 --- a/src/profiles/templates/account/email_confirm.html +++ b/src/profiles/templates/account/email_confirm.html @@ -1,4 +1,4 @@ -{% extends 'profiles/profile_base.html' %} +{% extends 'profile_base.html' %} {% load i18n %} {% load account %} diff --git a/src/profiles/templates/account/password_change.html b/src/profiles/templates/account/password_change.html index d2835066..00b77419 100644 --- a/src/profiles/templates/account/password_change.html +++ b/src/profiles/templates/account/password_change.html @@ -1,4 +1,4 @@ -{% extends 'profiles/profile_base.html' %} +{% extends 'profile_base.html' %} {% load account %} {% load bootstrap3 %} diff --git a/src/profiles/templates/profile_base.html b/src/profiles/templates/profile_base.html new file mode 100644 index 00000000..6f606936 --- /dev/null +++ b/src/profiles/templates/profile_base.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} + +{% load account %} +{% load bootstrap3 %} + +{% block content %} +
+ +
+ {% include 'profile_base_buttons.html' %} +
+
+ +
+ +

You are logged in as {{ request.user.email }}

+ +
+{% block profile_content %}{% endblock %} + +{% endblock %} diff --git a/src/profiles/templates/profile_base_buttons.html b/src/profiles/templates/profile_base_buttons.html new file mode 100644 index 00000000..ccf1876c --- /dev/null +++ b/src/profiles/templates/profile_base_buttons.html @@ -0,0 +1,28 @@ + + Profile + + + Change password + + + Manage emails + + {% if user.is_authenticated and user.orders.exists %} + + Orders + + {% if has_tickets %} + + Tickets + + {% endif %} + {% if user.creditnotes.exists %} + + Credit Notes + + {% endif %} + {% endif %} + + Logout + + diff --git a/src/profiles/templates/profile_detail.html b/src/profiles/templates/profile_detail.html new file mode 100644 index 00000000..f6e9d83a --- /dev/null +++ b/src/profiles/templates/profile_detail.html @@ -0,0 +1,15 @@ +{% extends 'profile_base.html' %} + +{% block profile_content %} +

The information in your profile is only visible to team responsible and organisers.

+

If you intend to join one or more teams you can use the profile to help the team responsible understand who you are and what you have to offer.

+
+

Your Profile

+
+
Name
+
{{ profile.name|default:"N/A" }}
+
Description
+
{{ profile.description|default:"N/A" }}
+
+ Edit Profile +{% endblock profile_content %} diff --git a/src/profiles/templates/profile_form.html b/src/profiles/templates/profile_form.html new file mode 100644 index 00000000..f8ebd8a0 --- /dev/null +++ b/src/profiles/templates/profile_form.html @@ -0,0 +1,12 @@ +{% extends 'profile_base.html' %} +{% load bootstrap3 %} + +{% block profile_content %} +

Update Profile

+
+ {% csrf_token %} + {% bootstrap_form form %} + + Cancel +
+{% endblock profile_content %} diff --git a/src/profiles/templates/profiles/profile_base.html b/src/profiles/templates/profiles/profile_base.html deleted file mode 100644 index f45974e3..00000000 --- a/src/profiles/templates/profiles/profile_base.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends 'base.html' %} - -{% load account %} -{% load bootstrap3 %} - -{% block content %} -
-
-

Logged in as {{ request.user.email }}

-

- - Change password - - - Manage emails - - - Logout - - - {% if user.is_authenticated and user.orders.exists %} - - Orders - - - {% if has_tickets %} - - Tickets - - {% endif %} - - {% if user.creditnotes.exists %} - - Credit Notes - - {% endif %} - - {% endif %} -

-
-
-
- {% block profile_content %}{% endblock %} - -{% endblock %} diff --git a/src/profiles/templates/profiles/profile_detail.html b/src/profiles/templates/profiles/profile_detail.html deleted file mode 100644 index f2fdfff0..00000000 --- a/src/profiles/templates/profiles/profile_detail.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends 'profiles/profile_base.html' %} - -{% block profile_content %} -{% endblock %} diff --git a/src/profiles/views.py b/src/profiles/views.py index c6213b66..f8f6f3f1 100644 --- a/src/profiles/views.py +++ b/src/profiles/views.py @@ -3,12 +3,12 @@ from django.views.generic import DetailView, UpdateView from django.core.urlresolvers import reverse_lazy from django.contrib import messages - -from . import models, forms +from . import models class ProfileDetail(LoginRequiredMixin, DetailView): model = models.Profile + template_name = 'profile_detail.html' def get_object(self, queryset=None): return models.Profile.objects.get(user=self.request.user) @@ -16,19 +16,14 @@ class ProfileDetail(LoginRequiredMixin, DetailView): class ProfileUpdate(LoginRequiredMixin, UpdateView): model = models.Profile - form_class = forms.ProfileForm + fields = ['name', 'description'] success_url = reverse_lazy('profiles:detail') + template_name = 'profile_form.html' def get_object(self, queryset=None): return models.Profile.objects.get(user=self.request.user) - def get_form_kwargs(self): - kwargs = super(ProfileUpdate, self).get_form_kwargs() - kwargs['initial'] = {'email': self.object.user.email} - return kwargs - def form_valid(self, form, **kwargs): - self.object.user.email = form.cleaned_data['email'] - self.object.user.save() messages.info(self.request, 'Your profile has been updated.') return super(ProfileUpdate, self).form_valid(form, **kwargs) + diff --git a/src/teams/templates/team_list.html b/src/teams/templates/team_list.html index 31a175c6..2549e1cd 100644 --- a/src/teams/templates/team_list.html +++ b/src/teams/templates/team_list.html @@ -8,7 +8,8 @@ Teams | {{ block.super }} {% block content %}

{{ camp.title }} Teams

-

This is a list of the teams for {{ camp.title }}. To join a team just press the Join button. You can also leave a team if you are already a member (please let the team responsible know why!).

+

This is a list of the teams for {{ camp.title }}. To join a team just press the Join button, but please put some info in your profile first, so the team responsible has some idea who you are.

+

You can also leave a team of course, but please let the team responsible know why :)

Team memberships need to be approved by a team responsible. You will receive a message when your membership has been approved.

At {{ camp.title }} all organisers and volunteers buy full tickets like everyone else. In the future our budget may allow for discounts or free tickets for volunteers, but not this year. However: Please let us know if you can't afford a ticket - we will figure something out!

We currently have {{ teams.count }} teams for {{ camp.title }}: