Addressbook
- location field.. has to be refactored
This commit is contained in:
@@ -7,7 +7,7 @@ import os
|
||||
INSTRUMENTS = (
|
||||
('TR', _('Trumpet') ),
|
||||
('TRB', _('Trombone') ),
|
||||
('EUPH',_('Euphonium') ),
|
||||
('HRN',_('Horn') ),
|
||||
('TUBA',_('Tuba') )
|
||||
)
|
||||
|
||||
@@ -16,14 +16,20 @@ def musicianPictureName( musician, originalName ):
|
||||
fileExtension = os.path.splitext(originalName)[1]
|
||||
return "user_images/" + musician.user.username + fileExtension
|
||||
|
||||
def musicianSmallPictureName( musician, originalName ):
|
||||
fileExtension = os.path.splitext(originalName)[1]
|
||||
return "user_images/" + musician.user.username + "_thumb" + fileExtension
|
||||
|
||||
|
||||
class Musician( models.Model ):
|
||||
# Link to user object, contains first name and last name
|
||||
user = models.OneToOneField( User, verbose_name=_("user") )
|
||||
|
||||
# Properties
|
||||
image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
|
||||
image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
|
||||
small_image = models.ImageField( upload_to = musicianSmallPictureName, verbose_name = _("circular thumbnail") )
|
||||
|
||||
|
||||
# Properties
|
||||
instrument = models.CharField( max_length=4, choices=INSTRUMENTS, blank=True, verbose_name=_("instrument") )
|
||||
|
||||
birthday = models.DateField( null=True, verbose_name=_("birthday") )
|
||||
@@ -36,7 +42,13 @@ class Musician( models.Model ):
|
||||
phone_mobile = models.CharField( max_length=18, blank=True, verbose_name=_("phone_mobile") )
|
||||
phone_work = models.CharField( max_length=18, blank=True, verbose_name=_("phone_work") )
|
||||
|
||||
@property
|
||||
def isDeepBrass(self):
|
||||
return self.instrument == 'TRB' or self.instrument == "EUPH" or self.instrument == "TUBA" or self.instrument == "HRN"
|
||||
|
||||
@property
|
||||
def isHighBrass(self):
|
||||
return self.instrument == 'TR'
|
||||
|
||||
public_description = models.TextField( blank=True, verbose_name=_("public_description") )
|
||||
|
||||
|
||||
144
musicians/templates/musicians/addressbook.html
Normal file
144
musicians/templates/musicians/addressbook.html
Normal file
@@ -0,0 +1,144 @@
|
||||
{% extends "website/base.html" %}
|
||||
|
||||
|
||||
{% load sekizai_tags staticfiles %}
|
||||
|
||||
|
||||
{% block feature_slider %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block navbar_options %} navbar navbar-inverse navbar-static-top {% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
{% addtoblock "css" strip %}<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/portfolio.css" media="screen, projection">{% endaddtoblock %}
|
||||
|
||||
{% addtoblock "css" %}
|
||||
<style>
|
||||
.addressbook_entry {
|
||||
box-shadow: 0px 0px 7px -1px rgb(214, 214, 214);
|
||||
border: 2px solid rgb(217, 217, 217);
|
||||
width: 350px !important;
|
||||
float: left;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.addressbook_entry .name {
|
||||
color: rgb(83, 83, 83);
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
font-size: 18px;
|
||||
margin: 0px 0px 5px;
|
||||
}
|
||||
|
||||
.addressbook_entry td {
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.addressbook_entry .picture {
|
||||
max-width: 55px;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "js" strip %} <script src="{{STATIC_URL}}/js/jquery.isotope.min.js"></script> {% endaddtoblock %}
|
||||
|
||||
|
||||
{% addtoblock "js" %}
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
var $container = $('#gallery_container'),
|
||||
$filters = $("#filters a");
|
||||
|
||||
$container.imagesLoaded( function(){
|
||||
$container.isotope({
|
||||
itemSelector : '.photo',
|
||||
masonry: {
|
||||
columnWidth: 102
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// filter items when filter link is clicked
|
||||
$filters.click(function() {
|
||||
$filters.removeClass("active");
|
||||
$(this).addClass("active");
|
||||
var selector = $(this).data('filter');
|
||||
$container.isotope({ filter: selector });
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endaddtoblock %}
|
||||
|
||||
|
||||
<div id="portfolio">
|
||||
<div class="container">
|
||||
<div class="section_header">
|
||||
<h3>Adressbuch</h3>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="filters_container">
|
||||
<ul id="filters">
|
||||
<li><a href="#" data-filter="*" class="active">Alle</a></li>
|
||||
<li class="separator">/</li>
|
||||
<li><a href="#" data-filter=".unterstimme">Unterstimmen</a></li>
|
||||
<li class="separator">/</li>
|
||||
<li><a href="#" data-filter=".oberstimmen">Oberstimmen</a></li>
|
||||
<li class="separator">/</li>
|
||||
<li><a href="#" data-filter=".rest">Rest</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="gallery_container" >
|
||||
|
||||
{% for m in musicians %}
|
||||
<div class="photo isotope-item addressbook_entry {% if m.isDeepBrass %} unterstimme {% elif m.isHighBrass %} oberstimme {% else %} rest {% endif %} ">
|
||||
|
||||
<div class="span1">
|
||||
<img src="{{MEDIA_URL}}/user_images/{{m.user}}_circle.png" class="img-circle picture">
|
||||
</div>
|
||||
|
||||
<div class="name">
|
||||
{{ m.user.first_name }} {{m.user.last_name }}
|
||||
</div>
|
||||
|
||||
<table>
|
||||
{% if m.street %} <tr><td> Adresse </td><td>{{m.street}} </td>
|
||||
<tr><td> </td><td>{{m.zip_code}} {{m.city}}</td>{% endif %}
|
||||
{% if m.birthday %} <tr><td> Geburtstag: </td><td>{{m.birthday }} </td>{% endif %}
|
||||
{% if m.phone_home %} <tr><td> Telefon (Home): </td><td>{{m.phone_home }} </td>{% endif %}
|
||||
{% if m.phone_mobile %}<tr><td> Telefon (Mobil): </td><td>{{m.phone_mobile }} </td>{% endif %}
|
||||
{% if m.phone_work %} <tr><td> Telefon (Arbeit): </td><td>{{m.phone_work }} </td>{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -12,7 +12,7 @@ class MusicianList( ListView):
|
||||
model = Musician
|
||||
|
||||
|
||||
class UserEditForm(forms.ModelForm):
|
||||
class UserEditForm( forms.ModelForm ):
|
||||
|
||||
email = forms.EmailField()
|
||||
|
||||
@@ -43,7 +43,6 @@ class UserEditForm(forms.ModelForm):
|
||||
model = Musician
|
||||
exclude = [ 'user','image', 'instrument' ]
|
||||
#fields = '__all__'
|
||||
|
||||
|
||||
|
||||
def user_edit( request, username ):
|
||||
@@ -66,4 +65,20 @@ class MusicianUpdate( UpdateView ):
|
||||
model = Musician
|
||||
#fields = []
|
||||
template_name = "musicians/musician_edit.html"
|
||||
success_url = '/books/'
|
||||
success_url = '/books/'
|
||||
|
||||
|
||||
def addressbook( request ):
|
||||
context = dict()
|
||||
context['musicians'] = Musician.objects.all()
|
||||
|
||||
return render( request, 'musicians/addressbook.html', context )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user