summaryrefslogtreecommitdiffstats
path: root/core/forms.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-07-02 20:43:18 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-07-02 20:43:18 +0100
commitae3fe8cd423be5268d630a498361e376c6add776 (patch)
tree1cf7409b5377484ba38d8feba94a893abb7d8611 /core/forms.py
parentc0b274767b5c0ed209b9ff03679519e2d2170134 (diff)
downloadtroggle-ae3fe8cd423be5268d630a498361e376c6add776.tar.gz
troggle-ae3fe8cd423be5268d630a498361e376c6add776.tar.bz2
troggle-ae3fe8cd423be5268d630a498361e376c6add776.zip
[svn] Renaming troggle.expo to troggle.core. To do this, used:
perl -p -i -e "s/expo(?=[\s\.']+)/core/g" `find -name \*.py` and then manually checked each change (had to remove a couple)
Diffstat (limited to 'core/forms.py')
-rw-r--r--core/forms.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/core/forms.py b/core/forms.py
new file mode 100644
index 0000000..929c4e9
--- /dev/null
+++ b/core/forms.py
@@ -0,0 +1,48 @@
+from django.forms import ModelForm
+from models import Cave, Person, LogbookEntry, QM
+import django.forms as forms
+from django.forms.formsets import formset_factory
+from django.contrib.admin.widgets import AdminDateWidget
+import string
+from datetime import date
+
+class CaveForm(ModelForm):
+ class Meta:
+ model = Cave
+
+class PersonForm(ModelForm):
+ class Meta:
+ model = Person
+
+class LogbookEntryForm(ModelForm):
+ class Meta:
+ model = LogbookEntry
+
+ def wikiLinkHints(LogbookEntry=None):
+ """
+ This function returns html-formatted paragraphs for each of the
+ wikilink types that are related to this logbookentry. Each paragraph
+ 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())
+
+ 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>')
+# for persontrip in LogbookEntry.instance.persontrip_set.all():
+# res.append(persontrip.wiki_link())
+# res.append(r'</p>')
+
+ return string.join(res, r'<br />')
+
+ def __init__(self, *args, **kwargs):
+ super(LogbookEntryForm, self).__init__(*args, **kwargs)
+ self.fields['text'].help_text=self.wikiLinkHints() \ No newline at end of file