On 29-Mar-08, at 10:30 AM, Brandon Taylor wrote:

> Sure. This app is for my portfolio. Here's my models.py
>
> class WorkCategory(models.Model):
>       title = models.CharField(max_length = 30)
>       position = models.PositiveSmallIntegerField()
>
>       def __unicode__(self):
>               return self.title
>
>       class Admin:
>               ordering = ('position',)
>               search_fields = ('title', 'position')
>
>       class Meta:
>               verbose_name_plural = 'Work Categories'
>
>
> class WorkType(models.Model):
>       title = models.CharField(max_length = 40)
>
>       def __unicode__(self):
>               return self.title
>
>       class Admin:
>               pass
>
>       class Meta:
>               verbose_name_plural = 'Work Types'
>
>
> class Client(models.Model):
>       position = models.PositiveSmallIntegerField()
>       name = models.CharField(max_length = 50)
>       url = models.CharField(max_length = 50, blank = True)
>       display = models.BooleanField()
>
>       def __unicode__(self):
>               return self.name
>
>       class Admin:
>               list_display = ('position','name','url','display')
>               list_filter = ('display',)
>               ordering = ('name',)
>               search_fields = ('name', 'position')
>
>       class Meta:
>               ordering = ['name']
>
>
> class WorkSample(models.Model):
>       work_category = models.ForeignKey(WorkCategory)
>       work_type = models.ForeignKey(WorkType)
>       client = models.ForeignKey(Client)
>       title = models.CharField(max_length = 75)
>       desc = models.TextField()
>       thumbnail = models.ImageField(upload_to = 'images')
>       sample_image = models.ImageField(upload_to = 'images')
>       sample_alt = models.CharField(max_length = 75)
>       slug = models.SlugField()
>
>       def __unicode__(self):
>               return self.title
>
>       def get_absolute_url(self):
>               return u'/portfolio/view/%s' % self.slug
>
>       class Admin:
>               list_display = ('title','desc','sample_alt','slug')
>               list_filter = ('work_category', 'work_type', 'client')
>               search_fields = ('client', 'desc')
>
>       class Meta:
>               verbose_name_plural = 'Work Samples'
>
>
> I thought I could probably loop through the work samples by saying:
>
> {% for work_sample in work_category.work_samples %}{% endfor %}

where are you getting 'work_samples' from? I do not see any  
work_samples in the models. And what happened to the 'items' you had  
mentioned in your original post?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to