Hello,

I'm testing django with a blog and I have the following issue :

I have the following model :

class Post(models.Model):
    author = models.ForeignKey(User)
    title = models.CharField(maxlength=50)
    summary = models.TextField(blank=True)
    message = models.TextField()
    category = models.ManyToManyField(Category)
    tag = models.ManyToManyField(Tag, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    pub_date = models.DateTimeField('Date de publication',
auto_now_add=True)
    pub_status = models.BooleanField('Publie ?', default=True)

and the following template :

        {% if latest_posts %}
                {% for post in latest_posts %}
                        <h2 id="post-{{ post.id }}">
                                <a href="">{{ post.title }}</a>
                        </h2>
                        <p class="post-info">publié le {{ post.pub_date|date:"l 
d F Y à H:i" }},
dans la catégorie <a href="">{{ post.category }}</a></p>
                        <div class="post-content">{{ post.summary }}</div>
                        <div class="post-tag">{{ post.tag }}</div>
                {% endfor %}
        {% else %}
                <p>Aucun article ne correspond aux critères.</p>
        {% endif %}

I would like that post.category and post.tag display all tags or categories
linked to a postfor the related post.

I tried to use "cycle" and some "for" loops but it does not work (or I do
not handle it correctly).

Could someone explained how can I handle such an easy (?) thing ?

Thanks in advance,
Nicolas


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to