Merge branch 'master' of gitea:jdavlb/jdav_lb_webapp

v1-0-stable
Christian Merten 4 years ago
commit 7fdcd0dfd2

2
.gitmodules vendored

@ -1,3 +1,3 @@
[submodule "jdav_web/jet"]
path = jdav_web/jet
url = https://git.flavigny.de/christian/jet
url = https://git.flavigny.de/jdavlb/jet/

@ -138,6 +138,9 @@ class FreizeitAdminForm(forms.ModelForm):
tour_type = TypedChoiceField(choices=Freizeit.tour_type_choices,
coerce=int,
label=_('Tour type'))
tour_approach = TypedChoiceField(choices=Freizeit.tour_approach_choices,
coerce=int,
label=_('Tour type'))
class Meta:
model = Freizeit
@ -391,6 +394,20 @@ class FreizeitAdmin(admin.ModelAdmin):
tour_type += '\\qquad \\qquad '
template_content = template_content.replace('TOUR-TYPE', tour_type)
# create tickboxes for tour approach
tour_approach = ''
for tt in ['Muskelkraft', 'Öffentliche VM', 'Fahrgemeinschaften']:
print(memberlist.tour_approach)
if tt == memberlist.get_tour_approach():
tour_approach += '\\tickedbox ' + tt
else:
tour_approach += '\\checkbox'
tour_approach += '\\enspace ' + tt
tour_approach += '\\qquad \\qquad '
template_content = template_content.replace('TOUR-APPROACH', tour_approach)
template_content = template_content.replace('TABLE-NAME',
filename_table)

@ -13,12 +13,11 @@ import os
from dateutil.relativedelta import relativedelta
GEMEINSCHAFTS_TOUR = 0
FUEHRUNGS_TOUR = 1
AUSBILDUNGS_TOUR = 2
GEMEINSCHAFTS_TOUR = MUSKELKRAFT_ANREISE = 0
FUEHRUNGS_TOUR = OEFFENTLICHE_ANREISE = 1
AUSBILDUNGS_TOUR = FAHRGEMEINSCHAFT_ANREISE = 2
HOST = os.environ.get('DJANGO_ALLOWED_HOST', 'localhost:8000').split(",")[0]
class ActivityCategory(models.Model):
"""
Describes one kind of activity
@ -202,6 +201,10 @@ class MemberList(models.Model):
(AUSBILDUNGS_TOUR, 'Ausbildung'))
# verbose_name is overriden by form, label is set in admin.py
tour_type = models.IntegerField(choices=tour_type_choices)
tour_approach_choices = ((MUSKELKRAFT_ANREISE, 'Muskelkraft'),
(OEFFENTLICHE_ANREISE, 'Öffentliche VM'),
(FAHRGEMEINSCHAFT_ANREISE, 'Fahrgemeinschaften'))
tour_approach = models.IntegerField(choices=tour_approach_choices)
activity = models.ManyToManyField(ActivityCategory, default=None,
verbose_name=_('Categories'))
difficulty_choices = [(1, _('easy')), (2, _('medium')), (3, _('hard'))]
@ -224,6 +227,14 @@ class MemberList(models.Model):
else:
return "Gemeinschaftstour"
def get_tour_approach(self):
if self.tour_approach == MUSKELKRAFT_ANREISE:
return "Muskelkraft"
elif self.tour_approach == OEFFENTLICHE_ANREISE:
return "Öffentliche VM"
else:
return "Fahrgemeinschaften"
def get_absolute_url(self):
return reverse('admin:members_memberlist_change', args=[str(self.id)])
@ -281,6 +292,10 @@ class Freizeit(models.Model):
(AUSBILDUNGS_TOUR, 'Ausbildung'))
# verbose_name is overriden by form, label is set in admin.py
tour_type = models.IntegerField(choices=tour_type_choices)
tour_approach_choices = ((MUSKELKRAFT_ANREISE, 'Muskelkraft'),
(OEFFENTLICHE_ANREISE, 'Öffentliche VM'),
(FAHRGEMEINSCHAFT_ANREISE, 'Fahrgemeinschaften'))
tour_approach = models.IntegerField(choices=tour_approach_choices)
activity = models.ManyToManyField(ActivityCategory, default=None,
verbose_name=_('Categories'))
difficulty_choices = [(1, _('easy')), (2, _('medium')), (3, _('hard'))]
@ -304,6 +319,14 @@ class Freizeit(models.Model):
else:
return "Gemeinschaftstour"
def get_tour_approach(self):
if self.tour_approach == MUSKELKRAFT_ANREISE:
return "Muskelkraft"
elif self.tour_approach == OEFFENTLICHE_ANREISE:
return "Öffentliche VM"
else:
return "Fahrgemeinschaften"
def get_absolute_url(self):
return reverse('admin:members_freizeit_change', args=[str(self.id)])

@ -71,6 +71,8 @@
\end{table}
\noindent TOUR-TYPE
\large Anreise: \\
\noindent TOUR-APPROACH
\begin{table}[H]
\begin{tabularx}{1\linewidth}{@{\extracolsep{\fill}}lLlL}
\toprule

Loading…
Cancel
Save