0

Models.py

class Question(models.Model):
    name = models.CharField(max_length=300, unique=True)
    desc = HTMLField()
    img = models.CharField(max_length=100)
    topic = models.ForeignKey(Topic, related_name='question')
    created_by = models.ForeignKey(User, related_name='question')
    created_on = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.name

template

<form method="post">
    {% csrf_token %}
    {%include 'includes/form.html' %}
    <input type="submit" class="btn btn-success" value="Post Answer" />
</form>

I am using TinyMCE for rich textarea purpose. Here I have added field "desc" as HTMLField and successfully applied migrations. I am able to see desc added in admin page but not in my template. Please point my mistake?

Satendra
  • 6,755
  • 4
  • 26
  • 46
vinoth kumar
  • 216
  • 4
  • 15
  • 1
    you have to add this field in your form class fields attribute `fields = ('desc',...)` – Satendra May 14 '18 at 16:11
  • @Satendra thank you very much. I have started this project few days back i could not continue due to some other project work. Forgot basic things I will make note of it. – vinoth kumar May 15 '18 at 07:27

0 Answers0