Commit 692e7ba4 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg Committed by Sébastiaan Versteeg

Reference implementation of the first contribution wiki

parent 4beb598f
...@@ -29,7 +29,7 @@ class ProfileInline(admin.StackedInline): ...@@ -29,7 +29,7 @@ class ProfileInline(admin.StackedInline):
'receive_optin', 'receive_newsletter', 'birthday', 'receive_optin', 'receive_newsletter', 'birthday',
'show_birthday', 'auto_renew', 'initials', 'show_birthday', 'auto_renew', 'initials',
'nickname', 'display_name_preference', 'profile_description', 'nickname', 'display_name_preference', 'profile_description',
'website', 'photo', 'emergency_contact', 'shoe_size', 'website', 'photo', 'emergency_contact',
'emergency_contact_phone_number', 'language', 'emergency_contact_phone_number', 'language',
'event_permissions') 'event_permissions')
model = models.Profile model = models.Profile
......
...@@ -54,7 +54,7 @@ class ProfileRetrieveSerializer(serializers.ModelSerializer): ...@@ -54,7 +54,7 @@ class ProfileRetrieveSerializer(serializers.ModelSerializer):
model = Profile model = Profile
fields = ('pk', 'display_name', 'avatar', 'profile_description', fields = ('pk', 'display_name', 'avatar', 'profile_description',
'birthday', 'starting_year', 'programme', 'website', 'birthday', 'starting_year', 'programme', 'website',
'membership_type', 'achievements', 'societies') 'membership_type', 'shoe_size', 'achievements', 'societies')
pk = serializers.SerializerMethodField('_pk') pk = serializers.SerializerMethodField('_pk')
avatar = serializers.SerializerMethodField('_avatar') avatar = serializers.SerializerMethodField('_avatar')
...@@ -129,7 +129,8 @@ class ProfileEditSerializer(serializers.ModelSerializer): ...@@ -129,7 +129,8 @@ class ProfileEditSerializer(serializers.ModelSerializer):
'nickname', 'display_name_preference', 'nickname', 'display_name_preference',
'language', 'receive_optin', 'receive_newsletter', 'language', 'receive_optin', 'receive_newsletter',
'display_name', 'avatar', 'birthday', 'starting_year', 'display_name', 'avatar', 'birthday', 'starting_year',
'programme', 'membership_type', 'achievements', 'societies') 'programme', 'membership_type', 'achievements', 'societies',
'shoe_size')
read_only_fields = ('display_name', 'starting_year', 'programme', read_only_fields = ('display_name', 'starting_year', 'programme',
'birthday') 'birthday')
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-22 13:50
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0033_auto_20190428_1255'),
]
operations = [
migrations.AddField(
model_name='profile',
name='shoe_size',
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(39), django.core.validators.MaxValueValidator(47)], verbose_name='Shoe size'),
),
]
...@@ -12,6 +12,7 @@ from django.contrib.auth.models import User, UserManager ...@@ -12,6 +12,7 @@ from django.contrib.auth.models import User, UserManager
from django.core import validators from django.core import validators
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.files.storage import DefaultStorage from django.core.files.storage import DefaultStorage
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.urls import reverse from django.urls import reverse
...@@ -325,6 +326,13 @@ class Profile(models.Model): ...@@ -325,6 +326,13 @@ class Profile(models.Model):
# ---- Personal information ------ # ---- Personal information ------
shoe_size = models.IntegerField(
verbose_name=_('Shoe size'),
validators=[MinValueValidator(39), MaxValueValidator(47)],
blank=True,
null=True,
)
birthday = models.DateField( birthday = models.DateField(
verbose_name=_('Birthday'), verbose_name=_('Birthday'),
null=True null=True
......
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
</li> </li>
{% endif %} {% endif %}
{% if member.profile.shoe_size %}
<li><span>{% trans "Shoe size" %}: </span> {{ member.profile.shoe_size }}</li>
{% endif %}
{% if member.profile.show_birthday and member.profile.birthday %} {% if member.profile.show_birthday and member.profile.birthday %}
<li><strong>{% trans "Birthday" %}: </strong> {{ member.profile.birthday }}</li> <li><strong>{% trans "Birthday" %}: </strong> {{ member.profile.birthday }}</li>
{% endif %} {% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment