File tree 6 files changed +57
-35
lines changed 6 files changed +57
-35
lines changed Original file line number Diff line number Diff line change
1
+ from django .contrib .gis import admin
2
+ from polygons .models import TreeRegionPolygon , DBHClass , TreeRegionEntry
3
+
4
+ admin .site .register (DBHClass )
5
+ admin .site .register (TreeRegionEntry )
Original file line number Diff line number Diff line change @@ -10,15 +10,26 @@ class TreeRegionPolygon(models.Model):
10
10
photo = models .ImageField (upload_to = "polygons/%Y/%m/%d" ,null = True ,blank = True )
11
11
objects = models .GeoManager ()
12
12
13
+ def __unicode__ (self ):
14
+ return u"Polygon #%s, Region ID: %s" % (self .pk , self .region_id )
15
+
13
16
class DBHClass (models .Model ):
14
17
label = models .CharField (max_length = 255 )
15
18
dbh_min = models .FloatField ()
16
19
dbh_max = models .FloatField ()
17
20
21
+ def __unicode__ (self ):
22
+ return u"DBH Class #%s: %s (%s - %s)" % \
23
+ (self .pk , self .label , self .dbh_min , self .dbh_max )
24
+
18
25
class TreeRegionEntry (models .Model ):
19
26
polygon = models .ForeignKey (TreeRegionPolygon )
20
27
species = models .ForeignKey (Species )
21
28
dbhclass = models .ForeignKey (DBHClass )
22
29
count = models .IntegerField (default = 0 )
23
30
24
31
objects = models .GeoManager ()
32
+
33
+ def __unicode__ (self ):
34
+ return u"%s, Species: %s, Count: %s" % \
35
+ (str (self .polygon ), str (self .species ), self .count )
Original file line number Diff line number Diff line change 6
6
width : 100% ;
7
7
}
8
8
9
- # polygontable {
9
+ . table-container {
10
10
overflow : auto;
11
+ width : 95% ;
11
12
}
12
13
13
14
/** CSS for OTM is screwy... we're just going to give
Original file line number Diff line number Diff line change 54
54
< form method ="POST " action ="{{ SITE_ROOT }}polygons/{{ polygonobj.pk }}/photo " enctype ="multipart/form-data ">
55
55
< input type ="file " name ="photo ">
56
56
< input type ="hidden " name ="currentpage " value ="{{ request.get_full_path }} ">
57
- < input type ="submit ">
57
+ < input type ="submit " value =" Submit Photo " >
58
58
</ form >
59
59
{% endif %}
60
60
</ ul >
Original file line number Diff line number Diff line change 5
5
< h1 > Polygon #{{ polygonobj.pk }}</ h1 >
6
6
7
7
< form method ="POST " action ="{{ SITE_ROOT}}polygons/{{ polygonobj.pk }}/update ">
8
- < table class ="polygon-table table " data-id ="{{ polygonobj.pk }} " width ="100% ">
9
- < tr >
10
- < th > Species</ th >
11
- {% for cl in classes %}
12
- < th data-dbh-id ={{ cl.pk }} > {{ cl.label }}</ th >
8
+ < div class ="table-container ">
9
+ < table class ="polygon-table table " data-id ="{{ polygonobj.pk }} " width ="100% ">
10
+ < tr >
11
+ < th > Species</ th >
12
+ {% for cl in classes %}
13
+ < th data-dbh-id ={{ cl.pk }} > {{ cl.label }}</ th >
14
+ {% endfor %}
15
+ < th > </ th >
16
+ </ tr >
17
+ {% for row in polygon %}
18
+ < tr >
19
+ {% for item in row %}
20
+ {% if forloop.first %}
21
+ < td data-species-id ="{{ item.0 }} "> {{ item.1 }}</ td >
22
+ {% else %}
23
+ < td > < input name ="pval_{{ polygonobj.pk }}_{{ row.0.0 }}_{{ item.0 }} " value ="{% if item.1 %}{{ item.1 }}{% else %}0{% endif %} "> </ td >
24
+ {% endif %}
25
+ {% endfor %}
26
+ < td > < a href ="# " class ="removespecies "> Remove</ a > </ td >
27
+ </ tr >
13
28
{% endfor %}
14
- < th > </ th >
15
- </ tr >
16
- {% for row in polygon %}
17
- < tr >
18
- {% for item in row %}
19
- {% if forloop.first %}
20
- < td data-species-id ="{{ item.0 }} "> {{ item.1 }}</ td >
21
- {% else %}
22
- < td > < input name ="pval_{{ polygonobj.pk }}_{{ row.0.0 }}_{{ item.0 }} " value ="{% if item.1 %}{{ item.1 }}{% else %}0{% endif %} "> </ td >
23
- {% endif %}
24
- {% endfor %}
25
- < td > < a href ="# " class ="removespecies "> Remove</ a > </ td >
26
- </ tr >
27
- {% endfor %}
28
29
</ table >
30
+ </ div >
31
+
29
32
< input type ="submit " name ="submit " value ="Update " />
30
33
< a href ="{{ SITE_ROOT}}polygons/{{ polygonobj.pk }} "> Cancel</ a >
31
34
</ form >
Original file line number Diff line number Diff line change @@ -7,20 +7,22 @@ <h1>Polygon #{{ polygonobj.pk }}</h1>
7
7
< a href ="{{ SITE_ROOT }}polygons/{{ polygonobj.pk }}/edit "> < button > Edit</ button > </ a >
8
8
{% endif %}
9
9
10
- < table id ="polygontable " class ="table " width ="100% ">
11
- < tr >
12
- < th > Species</ th >
13
- {% for cl in classes %}
14
- < th > {{ cl.label }}</ th >
10
+ < div class ="table-container ">
11
+ < table id ="polygontable " class ="table " width ="100% ">
12
+ < tr >
13
+ < th > Species</ th >
14
+ {% for cl in classes %}
15
+ < th > {{ cl.label }}</ th >
16
+ {% endfor %}
17
+ </ tr >
18
+ {% for row in polygon %}
19
+ < tr >
20
+ {% for item in row %}
21
+ < td > {{ item.1 }}</ td >
22
+ {% endfor %}
23
+ </ tr >
15
24
{% endfor %}
16
- </ tr >
17
- {% for row in polygon %}
18
- < tr >
19
- {% for item in row %}
20
- < td > {{ item.1 }}</ td >
21
- {% endfor %}
22
- </ tr >
23
- {% endfor %}
24
- </ table >
25
+ </ table >
26
+ </ div >
25
27
26
28
{% endblock %}
You can’t perform that action at this time.
0 commit comments