Skip to content

Instantly share code, notes, and snippets.

@botanicus
Created February 8, 2009 16:01
Show Gist options
  • Save botanicus/60414 to your computer and use it in GitHub Desktop.
Save botanicus/60414 to your computer and use it in GitHub Desktop.
<h2>Spřízněná videa:</h2>
<div class="inner">
{% for related_interview in interview.related_interviews %}
<div class="video_item">
<a href="/rozhovory/{{ related_interview.slug }}" title="{{ related_interview.title }}"><img src="public/images/small_video.jpg" alt="Zajímavý nadpis videa" /></a>
<strong><a href="#" title="Zajímavý nadpis videa">Zajímavý nadpis videa</a></strong>
<br /><br />
<em>17.12.2008 v 15:39</em>
</div>
<div class="clear"></div>
{% endfor %}
"""Model class which represents interview as a post on the blog"""
class Interview(models.Model):
title = models.CharField('titulek', max_length = 50)
slug = models.SlugField()
person = models.CharField('jméno zpovídaného', max_length = 50)
# who is the interviewed person?
about = models.TextField('bio')
# questions in interview
summary = models.TextField('shrnutí')
# text with embed code which points to URL with video
body = models.TextField('text')
pub_date = models.DateTimeField('publikováno dne', default=datetime.now)
displayed_times = models.IntegerField(default = 0)
related_interviews = models.ManyToManyField('self', name='Spřízněná videa', blank=True)
"""Increase displayed_times property. Used in view show."""
def increase_displayed_times(self):
self.displayed_times += 1
self.save()
"""String representation of model. Is used for example in administration in many to many selectbox."""
def __unicode__(self):
return self.title
# i18n for admin, ordering
class Meta:
verbose_name = "rozhovor"
verbose_name_plural = "rozhovory"
ordering = ['-pub_date']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment