2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-01-20 09:52:30 +00:00

Removed modelforms for Caves started to add normal forms

This commit is contained in:
Martin Green 2011-07-10 23:57:31 +01:00
parent 10351fc65b
commit 425d38727d

View File

@ -7,46 +7,49 @@ import string
from datetime import date from datetime import date
from tinymce.widgets import TinyMCE from tinymce.widgets import TinyMCE
class CaveForm(ModelForm): #class CaveForm(ModelForm):
class Meta: # class Meta:
model = Cave # model = Cave
class PersonForm(ModelForm): #class PersonForm(ModelForm):
class Meta: # class Meta:
model = Person # model = Person
class LogbookEntryForm(ModelForm): #class LogbookEntryForm(ModelForm):
class Meta: # class Meta:
model = LogbookEntry # model = LogbookEntry#
def wikiLinkHints(LogbookEntry=None): # def wikiLinkHints(LogbookEntry=None):
""" # """
This function returns html-formatted paragraphs for each of the # This function returns html-formatted paragraphs for each of the
wikilink types that are related to this logbookentry. Each paragraph # wikilink types that are related to this logbookentry. Each paragraph
contains a list of all of the related wikilinks. # contains a list of all of the related wikilinks.
#
# Perhaps an admin javascript solution would be better.
# """
# res = ["Please use the following wikilinks, which are related to this logbook entry:"]
#
# res.append(r'</p><p style="float: left;"><b>QMs found:</b>')
# for QM in LogbookEntry.instance.QMs_found.all():
# res.append(QM.wiki_link())
Perhaps an admin javascript solution would be better. # res.append(r'</p><p style="float: left;"><b>QMs ticked off:</b>')
""" # for QM in LogbookEntry.instance.QMs_ticked_off.all():
res = ["Please use the following wikilinks, which are related to this logbook entry:"] # res.append(QM.wiki_link())
res.append(r'</p><p style="float: left;"><b>QMs found:</b>')
for QM in LogbookEntry.instance.QMs_found.all():
res.append(QM.wiki_link())
res.append(r'</p><p style="float: left;"><b>QMs ticked off:</b>')
for QM in LogbookEntry.instance.QMs_ticked_off.all():
res.append(QM.wiki_link())
# res.append(r'</p><p style="float: left; "><b>People</b>') # res.append(r'</p><p style="float: left; "><b>People</b>')
# for persontrip in LogbookEntry.instance.persontrip_set.all(): # for persontrip in LogbookEntry.instance.persontrip_set.all():
# res.append(persontrip.wiki_link()) # res.append(persontrip.wiki_link())
# res.append(r'</p>') # res.append(r'</p>')
return string.join(res, r'<br />') # return string.join(res, r'<br />')
def __init__(self, *args, **kwargs): # def __init__(self, *args, **kwargs):
super(LogbookEntryForm, self).__init__(*args, **kwargs) # super(LogbookEntryForm, self).__init__(*args, **kwargs)
self.fields['text'].help_text=self.wikiLinkHints() # self.fields['text'].help_text=self.wikiLinkHints()#
class CaveForm(forms.Form):
html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
def getTripForm(expedition): def getTripForm(expedition):