diff --git a/events/forms.py b/events/forms.py
index 9e6bac4..0c132e6 100644
--- a/events/forms.py
+++ b/events/forms.py
@@ -3,7 +3,8 @@ from django import forms
from django.forms.widgets import TextInput, Media
from django.utils.translation import ugettext_lazy as _
-from .models.profiles import Team
+from django.contrib.auth.models import User
+from .models.profiles import Team, UserProfile
from .models.events import Event, Place
from datetime import time
@@ -207,3 +208,13 @@ class NewPlaceForm(forms.ModelForm):
super().__init__(*args, **kwargs)
self.fields['city'].required = True
+class UserForm(forms.ModelForm):
+ class Meta:
+ model = User
+ fields = ['email']
+
+class UserProfileForm(forms.ModelForm):
+ class Meta:
+ model = UserProfile
+ fields = ['realname', 'avatar']
+
diff --git a/events/models/profiles.py b/events/models/profiles.py
index ac3b921..9bb2f2f 100644
--- a/events/models/profiles.py
+++ b/events/models/profiles.py
@@ -15,7 +15,7 @@ class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
realname = models.CharField(_("Real Name"), max_length=150, blank=True)
tz = models.CharField(max_length=32, verbose_name=_('Timezone'), default='UTC', choices=[(tz, tz) for tz in pytz.all_timezones], blank=False, null=False, help_text=_('The most commonly used timezone for this User.'))
- avatar = models.URLField(verbose_name=_("Photo"), max_length=150, blank=True, null=True)
+ avatar = models.URLField(verbose_name=_("Photo Image"), max_length=150, blank=True, null=True)
web_url = models.URLField(verbose_name=_('Website URL'), blank=True, null=True)
twitter = models.CharField(verbose_name=_('Twitter Name'), max_length=32, blank=True, null=True)
diff --git a/events/templates/events/profile_form.html b/events/templates/events/profile_form.html
new file mode 100644
index 0000000..c8fd498
--- /dev/null
+++ b/events/templates/events/profile_form.html
@@ -0,0 +1,4 @@
+
+{{ user_form }}
+{{ profile_form }}
+
diff --git a/get_together/templates/get_together/base.html b/get_together/templates/get_together/base.html
index aa03b60..3bfcefa 100644
--- a/get_together/templates/get_together/base.html
+++ b/get_together/templates/get_together/base.html
@@ -68,7 +68,7 @@ form {
Welcome {{ request.user.username }}
diff --git a/get_together/templates/get_together/users/edit_profile.html b/get_together/templates/get_together/users/edit_profile.html
new file mode 100644
index 0000000..5e0b1e1
--- /dev/null
+++ b/get_together/templates/get_together/users/edit_profile.html
@@ -0,0 +1,13 @@
+{% extends "get_together/base.html" %}
+
+{% block content %}
+Profile: {{request.user}}
+
+
+{% endblock %}
+
diff --git a/get_together/urls.py b/get_together/urls.py
index f6c6fab..a8288aa 100644
--- a/get_together/urls.py
+++ b/get_together/urls.py
@@ -33,6 +33,8 @@ urlpatterns = [
path('api/spr/', event_views.spr_list),
path('api/cities/', event_views.city_list),
+ path('profile/+edit', views.edit_profile, name='edit-profile'),
+
path('events/', views.events_list, name='events'),
path('+create-team/', views.create_team, name='create-team'),
path('teams/', views.teams_list, name='teams'),
diff --git a/get_together/views/new_user.py b/get_together/views/new_user.py
new file mode 100644
index 0000000..7f23429
--- /dev/null
+++ b/get_together/views/new_user.py
@@ -0,0 +1,24 @@
+from django.utils.translation import ugettext_lazy as _
+
+from django.contrib import messages
+from django.contrib.auth import logout as logout_user
+from django.shortcuts import render, redirect
+from django.http import HttpResponse, JsonResponse
+
+from events.models.profiles import Team, UserProfile, Member
+from events.forms import TeamForm, NewTeamForm, TeamEventForm, NewTeamEventForm, NewPlaceForm
+
+from events.models.events import Event, Place, Attendee
+
+import datetime
+import simplejson
+
+def new_user_confirm_profile(request):
+ pass
+
+def new_user_find_teams(request):
+ pass
+
+def new_user_find_events(request):
+ pass
+
diff --git a/get_together/views/user.py b/get_together/views/user.py
index 3c71724..217815d 100644
--- a/get_together/views/user.py
+++ b/get_together/views/user.py
@@ -6,7 +6,7 @@ from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse
from events.models.profiles import Team, UserProfile, Member
-from events.forms import TeamForm, NewTeamForm, TeamEventForm, NewTeamEventForm, NewPlaceForm
+from events.forms import UserForm, UserProfileForm
from events.models.events import Event, Place, Attendee
@@ -15,3 +15,37 @@ import simplejson
from .teams import *
from .events import *
+
+def edit_profile(request):
+ if not request.user.is_authenticated:
+ messages.add_message(request, messages.WARNING, message=_('You must be logged in to edit your profile.'))
+ return redirect('login')
+
+ user = request.user
+ profile = request.user.profile
+
+ if request.method == 'GET':
+ user_form = UserForm(instance=user)
+ profile_form = UserProfileForm(instance=profile)
+
+ context = {
+ 'user_form': user_form,
+ 'profile_form': profile_form,
+ }
+ return render(request, 'get_together/users/edit_profile.html', context)
+ elif request.method == 'POST':
+ user_form = UserForm(request.POST, instance=user)
+ profile_form = UserProfileForm(request.POST, instance=profile)
+ if user_form.is_valid() and profile_form.is_valid():
+ user = user_form.save()
+ profile = profile_form.save()
+ return redirect('home')
+ else:
+ context = {
+ 'user_form': user_form,
+ 'profile_form': profile_form,
+ }
+ return render(request, 'get_together/users/edit_profile.html', context)
+ else:
+ return redirect('home')
+