These are chat archives for django/django

9th
Nov 2018
Luke-VideoLibre
@LukeVideo
Nov 09 2018 16:17
hy, i'm trying to create a form generator. Each page of the from is a question object. I wanted each Question to refer to previous question in the form. But this doesn't work because question is not defined...
from django.db import models

# Create your models here.

class Formo(models.Model):
    name = models.CharField(max_length=50)

    def __str__(self):
        return self.name


class Question(models.Model):
    name = models.CharField(max_length=50, default=0)
    previous = models.ForeignKey(Question, on_delete=models.CASCADE)