diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2020-02-24 15:04:07 +0000 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2020-02-24 15:04:07 +0000 |
commit | 43dfe946b6385037141b94b775112037fe5f032f (patch) | |
tree | 72c352e67166f0702ab93d7063c902ff1bd2c621 /core/views_logbooks.py | |
parent | 656ddcfe93061f2f82160ff8cc45b98d27e28bd3 (diff) | |
download | troggle-django-1.10.tar.gz troggle-django-1.10.tar.bz2 troggle-django-1.10.zip |
Just removing dud whitespacedjango-1.10
Diffstat (limited to 'core/views_logbooks.py')
-rw-r--r-- | core/views_logbooks.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/core/views_logbooks.py b/core/views_logbooks.py index ef920d2..c1a7dcb 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -37,7 +37,7 @@ def getNotablePersons(): for person in Person.objects.all(): if person.bisnotable(): notablepersons.append(person) - return notablepersons + return notablepersons def personindex(request): @@ -48,7 +48,7 @@ def personindex(request): nc = (len(persons) + ncols - 1) / ncols for i in range(ncols): personss.append(persons[i * nc: (i + 1) * nc]) - + notablepersons = [] for person in Person.objects.all(): if person.bisnotable(): @@ -67,13 +67,13 @@ def expedition(request, expeditionname): for personexpedition in this_expedition.personexpedition_set.all(): prow = [ ] for date in dates: - pcell = { "persontrips": PersonTrip.objects.filter(personexpedition=personexpedition, + pcell = { "persontrips": PersonTrip.objects.filter(personexpedition=personexpedition, logbook_entry__date=date) } - pcell["survexblocks"] = set(SurvexBlock.objects.filter(survexpersonrole__personexpedition=personexpedition, + pcell["survexblocks"] = set(SurvexBlock.objects.filter(survexpersonrole__personexpedition=personexpedition, date=date)) prow.append(pcell) personexpeditiondays.append({"personexpedition":personexpedition, "personrow":prow}) - + if "reload" in request.GET: LoadLogbookForExpedition(this_expedition) return render(request,'expedition.html', {'this_expedition': this_expedition, @@ -97,14 +97,14 @@ class ExpeditionListView(ListView): def person(request, first_name='', last_name='', ): this_person = Person.objects.get(first_name = first_name, last_name = last_name) - + # This is for removing the reference to the user's profile, in case they set it to the wrong person if request.method == 'GET': if request.GET.get('clear_profile')=='True': this_person.user=None this_person.save() return HttpResponseRedirect(reverse('profiles_select_profile')) - + return render(request,'person.html', {'person': this_person, }) @@ -117,19 +117,19 @@ def GetPersonChronology(personexpedition): for personrole in personexpedition.survexpersonrole_set.all(): a = res.setdefault(personrole.survexblock.date, { }) a.setdefault("personroles", [ ]).append(personrole.survexblock) - + # build up the tables rdates = res.keys() rdates.sort() - - + + res2 = [ ] for rdate in rdates: persontrips = res[rdate].get("persontrips", []) personroles = res[rdate].get("personroles", []) for n in range(max(len(persontrips), len(personroles))): res2.append(((n == 0 and rdate or "--"), (n < len(persontrips) and persontrips[n]), (n < len(personroles) and personroles[n]))) - + return res2 @@ -180,7 +180,7 @@ def experimental(request): survexleglength += survexblock.totalleglength legsbyexpo.append((expedition, {"nsurvexlegs":len(survexlegs), "survexleglength":survexleglength})) legsbyexpo.reverse() - + survexlegs = models.SurvexLeg.objects.all() totalsurvexlength = sum([survexleg.tape for survexleg in survexlegs]) return render(request, 'experimental.html', { "nsurvexlegs":len(survexlegs), "totalsurvexlength":totalsurvexlength, "legsbyexpo":legsbyexpo }) @@ -198,11 +198,11 @@ def newLogbookEntry(request, expeditionyear, pdate = None, pslug = None): personTripFormSet = PersonTripFormSet(request.POST) if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d") - directory = os.path.join(settings.EXPOWEB, - "years", - expedition.year, + directory = os.path.join(settings.EXPOWEB, + "years", + expedition.year, "autologbook") - filename = os.path.join(directory, + filename = os.path.join(directory, dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html") if not os.path.isdir(directory): os.mkdir(directory) @@ -210,7 +210,7 @@ def newLogbookEntry(request, expeditionyear, pdate = None, pslug = None): delLogbookEntry(previouslbe) f = open(filename, "w") template = loader.get_template('dataformat/logbookentry.html') - context = Context({'trip': tripForm.cleaned_data, + context = Context({'trip': tripForm.cleaned_data, 'persons': personTripFormSet.cleaned_data, 'date': dateStr, 'expeditionyear': expeditionyear}) @@ -234,11 +234,11 @@ def newLogbookEntry(request, expeditionyear, pdate = None, pslug = None): "location": previouslbe.place, "caveOrLocation": "location", "html": previouslbe.text}) - personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition), - "TU": py.time_underground, + personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition), + "TU": py.time_underground, "author": py.is_logbook_entry_author} for py in previouslbe.persontrip_set.all()]) - else: + else: tripForm = TripForm() # An unbound form personTripFormSet = PersonTripFormSet() |