Форум сайта python.su
ilnur
покажи модель Tasks.
task_types = (
('1', ‘category’),
('2', ‘event’),
)
class Tasks(models.Model):
pid = models.IntegerField(default = 0)
types = models.CharField(choices=task_types, max_length=1)
name = models.CharField(max_length = 100)
created = models.DateTimeField(auto_now_add=True)
start_date = models.DateTimeField(default = 0)
end_date = models.DateTimeField(default = 0)
comment = models.CharField(max_length = 300)
user_id = models.ForeignKey(User, related_name='userid')
Отредактировано eboome (Июль 25, 2013 22:54:12)
Офлайн
def index(request): task_list = Tasks.objects.filter(user_id=user) output = ', '.join( p.name for p in task_list ] ) return HttpResponse(output)
Офлайн