*You need SlugField or even check the AutoSlugField app.
*
On Sun, Oct 16, 2011 at 7:29 AM, Tsung-Hsien <jasoniem9...@gmail.com> wrote:

> I want to build a gallery which connects to different photo sets.
> I have been completed the gallery main page, however, I meet two
> problems:
> 1) Use title name of cover image as the URL of photo page, but if the
> name include blank, then The URL is not complete. For example: the
> cover image named summer days, however ,only shows summer on the URL.
>
> 2)How to build the dynamic URL connecting to each photo sets?
>
> the models as below:
>
> class Item(models.Model):
>    name = models.CharField(max_length=250)
>    description = models.TextField()
>
>    class Meta:
>                ordering = ["name"]
>
>    def __unicode__(self):
>                return self.name
>
>    def get_cover_photo(self):
>            if self.photo_set.all().count() > 0:
>                    return self.photo_set.all()[0].image
>            else:
>                    return None
>
>
>
>
> class Photo(models.Model):
>    item = models.ForeignKey(Item)
>    title = models.CharField(max_length=100)
>    image = models.ImageField(uplo
>
>
> Thanks!!
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Thanks and Regards,
*Praveen Krishna R*

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to