jeudi 6 avril 2017

Django IF statemant

Hello i have a problem with my code here is template code:

    

and here is model code:

class Category(models.Model):

name=models.CharField(max_length=200)
opis=models.TextField(max_length=600)


def __str__(self):
    return self.name

class GameName(models.Model):

author = models.ForeignKey('auth.User')
category = models.ForeignKey('Category')
title = models.CharField(max_length=200)
created_date = models.DateTimeField(default=timezone.now)

def __str__(self):
    return self.title

and here is output screen:screen

i checked the gamename.category and is equal to category.name but if statement giving always "else"why when if statement should be true?

Aucun commentaire:

Enregistrer un commentaire