forms foo lil bit..

This commit is contained in:
Johnson Chetty 2012-08-31 14:25:04 +02:00
parent 40f401b547
commit 82952672ed
3 changed files with 21 additions and 8 deletions

View File

@ -10,7 +10,7 @@ from crispy_forms.layout import Submit
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from app.forms import * from app.forms import *
from imagestore.forms import AlbumForm, ImageForm from imagestore.forms import AlbumForm, ImageForm
from itfprofiles.models import *
#Forms and Inlines for Generic Classes #Forms and Inlines for Generic Classes
@ -24,6 +24,7 @@ class LocationForm(ItfForm):
class Meta: class Meta:
model = Location model = Location
#fields = ('city','address', 'pincode')
exclude = ('lat', 'lon',) exclude = ('lat', 'lon',)
LocationsInline = itf_inlineformset_factory(Location, form=LocationForm, title="Locations", is_generic=True) LocationsInline = itf_inlineformset_factory(Location, form=LocationForm, title="Locations", is_generic=True)

View File

@ -106,7 +106,7 @@ class BuzzItem(ItfModel):
link = models.URLField(verify_exists=False) link = models.URLField(verify_exists=False)
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
blurb = models.TextField(blank=True) blurb = models.TextField(blank=True)
typ = models.CharField(choices=BUZZ_ITEM_TYPES, max_length=128, blank=True) typ = models.CharField(choices=BUZZ_ITEM_TYPES, max_length=128, blank=True, verbose_name="Type")
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField() object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') content_object = generic.GenericForeignKey('content_type', 'object_id')
@ -201,8 +201,8 @@ class Training(models.Model):
until_when = models.DateField(blank=True, null=True) until_when = models.DateField(blank=True, null=True)
locations = generic.GenericRelation("Location") locations = generic.GenericRelation("Location")
#def __unicode__(self): def __unicode__(self):
#\ return self.name return self.area
class Play(ItfModel): class Play(ItfModel):
@ -369,3 +369,6 @@ class Language(models.Model):
code = models.CharField(max_length=3, db_index=True) code = models.CharField(max_length=3, db_index=True)
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
def __unicode__(self):
return self.name

View File

@ -52,7 +52,7 @@
<span class="orange">Nature of Work: </span> <span class="orange">Nature of Work: </span>
<ul> <ul>
{% for work in nature_of_work %} {% for work in nature_of_work %}
<li>{{ work.name }} <br /> {{ work.name }} </li> <li>{{ work.name }} {% if work.is_main %} Primary occupation {% endif %} </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
@ -64,7 +64,10 @@
<span class="orange">Trainings: </span> <span class="orange">Trainings: </span>
<ul> <ul>
{% for training in trainings %} {% for training in trainings %}
<li>{{ training }} </li> <li>{{ training }} {{ training.title }} {{ training.desc }} {{ training.person }} {{ training.area }} {{ training.with_whom }} {{ training.where }} {{ training.from_when }} {{ training.until_when }}
{% for loc in training.locations %} {{ loc.city }} {% endfor %}
</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
@ -76,7 +79,7 @@
<span class="orange">Venues: </span> <span class="orange">Venues: </span>
<ul> <ul>
{% for elem in venues %} {% for elem in venues %}
<li> {{ elem.name }} </li> <li> {{ elem.city }} </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
@ -89,7 +92,13 @@
<ul> <ul>
{% for elem in buzzitems %} {% for elem in buzzitems %}
<li>{{ elem }} </li> <li>
<a href={{ elem.link }}> {{ elem.title }} </a>
<br/>
Desc: {{ elem.blurb }}
<br/>
Type:{{ elem.typ }}
</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>