diff --git a/blechreiz/database.sqlite b/blechreiz/database.sqlite index ae8a44d..b979c29 100644 Binary files a/blechreiz/database.sqlite and b/blechreiz/database.sqlite differ diff --git a/blechreiz/urls.py b/blechreiz/urls.py index 775f289..258b802 100644 --- a/blechreiz/urls.py +++ b/blechreiz/urls.py @@ -2,29 +2,26 @@ from django.conf.urls import patterns, include, url from django.contrib import admin -from musicians.views import MusicianList, addressbook -from musicians.views import user_edit - import website.views import simpleforum.views import eventplanner.urls +import musicians.urls + + import settings from django.conf.urls.static import static admin.autodiscover() urlpatterns = patterns('', - url(r'$^', website.views.home_view ), - url(r'^events/', include( eventplanner.urls.urlpatterns) ), - url(r'^admin/', include(admin.site.urls) ), - url(r'^admin/doc/', include('django.contrib.admindocs.urls') ), - url(r'^musicians/$', MusicianList.as_view() ), - url(r'^musicians/(?P[\w]+)$', user_edit ), - url(r'^addressbook/$', addressbook ), - url(r'^login/$', website.views.login_view), + url(r'$^', website.views.home_view ), + url(r'^login/$', website.views.login_view), url(r'^login/usernames$', website.views.userlistForAutocompletion), - url(r'^logout/$', website.views.logout_view), - url(r'^messages/$', simpleforum.views.message_view ), - url(r'^location_field/', include('location_field.urls')), + url(r'^logout/$', website.views.logout_view), + url(r'^events/', include( eventplanner.urls.urlpatterns) ), + url(r'^musicians/', include( musicians.urls.urlpatterns) ), + url(r'^messages/$', simpleforum.views.message_view ), + url(r'^admin/', include(admin.site.urls) ), + url(r'^location_field/', include('location_field.urls')), ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/eventplanner/templates/eventplanner/events_grid.html b/eventplanner/templates/eventplanner/events_grid.html index bf68f17..1629652 100644 --- a/eventplanner/templates/eventplanner/events_grid.html +++ b/eventplanner/templates/eventplanner/events_grid.html @@ -28,9 +28,11 @@ {% addtoblock "js" %} {% endaddtoblock %} diff --git a/musicians/models.py b/musicians/models.py index 22335f7..ccc4d33 100644 --- a/musicians/models.py +++ b/musicians/models.py @@ -43,6 +43,8 @@ class Musician( models.Model ): position = models.IntegerField( null=True, verbose_name=_("Position") ) + public_description = models.TextField( blank=True, verbose_name=_("public_description") ) + @property def isDeepBrass(self): return self.instrument == 'TRB' or self.instrument == "EUPH" or self.instrument == "TUBA" or self.instrument == "HRN" @@ -51,7 +53,6 @@ class Musician( models.Model ): def isHighBrass(self): return self.instrument == 'TR' - public_description = models.TextField( blank=True, verbose_name=_("public_description") ) def __unicode__( self ): return self.user.username diff --git a/musicians/templates/musicians/musician_edit.html b/musicians/templates/musicians/musician_edit.html index 7f07fd5..f41de8c 100644 --- a/musicians/templates/musicians/musician_edit.html +++ b/musicians/templates/musicians/musician_edit.html @@ -18,19 +18,18 @@
-

{{user.first_name}} {{user.last_name}}

+

{{musician.user.first_name}} {{musician.user.last_name}}

{% csrf_token %} {{ form }}
- +
- +
-
diff --git a/musicians/tests.py b/musicians/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/musicians/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/musicians/urls.py b/musicians/urls.py new file mode 100644 index 0000000..196976c --- /dev/null +++ b/musicians/urls.py @@ -0,0 +1,11 @@ +from django.conf.urls import patterns, url + +import musicians.views + + +urlpatterns = patterns('', + url(r'^$', musicians.views.addressbook ), + url(r'^profile$', musicians.views.own_profile ), + url(r'^(?P[\w]+)$$', musicians.views.user_edit ), +) + diff --git a/musicians/views.py b/musicians/views.py index 911b1c9..129d6cf 100644 --- a/musicians/views.py +++ b/musicians/views.py @@ -36,15 +36,19 @@ class UserEditForm( forms.ModelForm ): def save(self): if self.is_valid(): super(UserEditForm,self).save() - self.instance.user.email = self.cleaned_data['email'] + self.instance.user.email = self.cleaned_data['email'] self.instance.user.save() class Meta: model = Musician - exclude = [ 'user','image', 'instrument' ] + exclude = [ 'user','image', 'small_image', 'instrument', 'position', 'public_description' ] #fields = '__all__' +def own_profile( request ): + return user_edit( request, request.user ) + + def user_edit( request, username ): musician = get_object_or_404( Musician, user__username=username ) @@ -53,11 +57,11 @@ def user_edit( request, username ): form.instance = musician if form.is_valid(): # All validation rules pass form.save() - return HttpResponseRedirect('/musicians/' + username) # Redirect after POST + return HttpResponseRedirect('/') # Redirect after POST else: form = UserEditForm( instance= musician ) - return render(request, 'musicians/musician_edit.html', { 'form': form, } ) + return render(request, 'musicians/musician_edit.html', { 'form': form, 'musician': musician } ) diff --git a/website/templates/website/base.html b/website/templates/website/base.html index 1300996..ffbc0ae 100644 --- a/website/templates/website/base.html +++ b/website/templates/website/base.html @@ -103,21 +103,20 @@ $.ajaxSetup({