mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
Editing for entrances along with caves
More detailed display of entrances
This commit is contained in:
parent
fac89bae30
commit
fd12e70f78
@ -9,34 +9,32 @@ from datetime import date
|
||||
from tinymce.widgets import TinyMCE
|
||||
|
||||
class CaveForm(ModelForm):
|
||||
underground_description = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
|
||||
explorers = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
equipment = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
survey = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
kataster_status = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
underground_centre_line = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
notes = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
references = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
underground_description = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
|
||||
explorers = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
equipment = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
survey = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
kataster_status = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
underground_centre_line = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
notes = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
references = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
class Meta:
|
||||
model = Cave
|
||||
|
||||
class CaveAndEntranceForm(forms.Form):
|
||||
entrance = forms.ChoiceField(choices=[("", "-----")] +
|
||||
[(x.slug, x.slug)
|
||||
for x
|
||||
in Entrance.objects.all()])
|
||||
entrance_letter = forms.CharField(max_length=20)
|
||||
non_public = forms.BooleanField()
|
||||
|
||||
CaveAndEntranceFormSet = formset_factory(CaveAndEntranceForm)
|
||||
|
||||
|
||||
class EntranceForm(ModelForm):
|
||||
class Meta:
|
||||
model = Entrance
|
||||
|
||||
class CaveForm(ModelForm):
|
||||
underground_description = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
|
||||
explorers = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
equipment = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
survey = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
kataster_status = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
underground_centre_line = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
notes = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
references = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
|
||||
class Meta:
|
||||
model = Cave
|
||||
|
||||
#class PersonForm(ModelForm):
|
||||
# class Meta:
|
||||
# model = Person
|
||||
|
@ -1,5 +1,5 @@
|
||||
from troggle.core.models import Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, Entrance
|
||||
from troggle.core.forms import CaveForm
|
||||
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet
|
||||
import troggle.core.models as models
|
||||
import troggle.settings as settings
|
||||
from troggle.helper import login_required_if_public
|
||||
@ -42,6 +42,7 @@ def caveEntrance(request, slug):
|
||||
return render_with_context(request,'nonpublic.html', {'instance': cave})
|
||||
else:
|
||||
return render_with_context(request,'cave_entrances.html', {'cave': cave})
|
||||
|
||||
def caveDescription(request, slug):
|
||||
cave = Cave.objects.get(slug = slug)
|
||||
if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated():
|
||||
@ -71,14 +72,17 @@ def caveSlug(request, slug):
|
||||
@login_required_if_public
|
||||
def edit_cave(request, slug=None):
|
||||
cave = Cave.objects.get(slug = slug)
|
||||
form = CaveForm(instance=cave)
|
||||
class CaveAndEntranceForm(forms.Form):
|
||||
entrance = forms.ChoiceField(choices=[("", "-----")] + [(x.slug, x.slug) for x in Entrance.objects.all()])
|
||||
entrance_letter = forms.CharField(max_length=20)
|
||||
non_public = forms.BooleanField()
|
||||
CaveAndEntranceFormSet = formset_factory(CaveAndEntranceForm)
|
||||
i = [{"entrance": x.entrance.slug, "entrance_letter": x.entrance_letter, "non_public": x.non_public} for x in cave.caveandentrance_set.all()]
|
||||
ceFormSet = CaveAndEntranceFormSet(initial=i)
|
||||
if request.POST:
|
||||
form = CaveForm(request.POST, instance=cave)
|
||||
ceFormSet = CaveAndEntranceFormSet(request.POST)
|
||||
else:
|
||||
form = CaveForm(instance=cave)
|
||||
i = [{"entrance": x.entrance.slug,
|
||||
"entrance_letter": x.entrance_letter,
|
||||
"non_public": x.non_public}
|
||||
for x
|
||||
in cave.caveandentrance_set.all()]
|
||||
ceFormSet = CaveAndEntranceFormSet(initial=i)
|
||||
return render_with_context(request,
|
||||
'editcave2.html',
|
||||
{'form': form,
|
||||
|
@ -1,12 +1,64 @@
|
||||
<div id="entrances">
|
||||
<p>{% if cave.entrances %}
|
||||
<h2>Entrances</h2>
|
||||
<ul>
|
||||
{% for ent in cave.entrances %}
|
||||
<a href = "./{{ ent.entrance_letter|safe }}">{{ ent.entrance_letter|safe }}</a>
|
||||
<li>
|
||||
{{ ent.entrance_letter|safe }}
|
||||
{% if ent.entrance.name %}
|
||||
{{ ent.entrance.name|safe }}
|
||||
{% endif %}
|
||||
<dl>
|
||||
{% if ent.entrance.marking %}
|
||||
Marking: {{ ent.entrance.marking_val|safe }}
|
||||
<dt>Marking</dt><dd>{{ ent.entrance.marking_val|safe }}</dd>
|
||||
{% endif %}
|
||||
<br>
|
||||
{% if ent.entrance.marking_comment %}
|
||||
<dt>Marking Comment</dt><dd>{{ ent.entrance.marking_comment|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.findability %}
|
||||
<dt>Findability</dt><dd>{{ ent.entrance.findability_val|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.findability_comment %}
|
||||
<dt>Findability Comment</dt><dd>{{ ent.entrance.findability_comment|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.location_description %}
|
||||
<dt>Location</dt><dd>{{ ent.entrance.location_description|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.approach %}
|
||||
<dt>Approach</dt><dd>{{ ent.entrance.approach|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.map_description %}
|
||||
<dt>Map</dt><dd>{{ ent.entrance.map_description|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.underground_description %}
|
||||
<dt>Underground</dt><dd>{{ ent.entrance.underground_description|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.photo %}
|
||||
<dt>Photo</dt><dd>{{ ent.entrance.photo|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.entrance_description %}
|
||||
<dt>Description</dt><dd>{{ ent.entrance.entrance_description|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.explorers %}
|
||||
<dt>Explorers</dt><dd>{{ ent.entrance.explorers|safe }}</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.northing %}
|
||||
<dt>Location</dt><dd>{{ ent.entrance.northing|safe }}, {{ ent.entrance.easting|safe }}, {{ ent.entrance.alt|safe }}m</</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.tag_station %}
|
||||
<dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }}{{ ent.entrance.tag.y|safe }}, {{ ent.entrance.tag.x|safe }}, {{ ent.entrance.tag.z|safe }}m</</dd>
|
||||
{% endif %}
|
||||
{% if ent.entrance.bearings %}
|
||||
<dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{{ ent.entrance.tag_station|safe }}
|
||||
{{ ent.entrance.exact_station|safe }}
|
||||
{{ ent.entrance.other_station|safe }}
|
||||
{{ ent.entrance.other_description|safe }}
|
||||
</dl>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}</p>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user