I have a model where I have the following architecture
- There is Post model
- And there is an answer model for the given post (just like in stack overflow)
Since there are some fields which I do not want the user to populate, I have made a custom form for both of the models. The custom form class is working absolute for the first model i.e. Post Model, but I am getting this strange for the PostAns model. If I remove the class PostAnsForm then it works fine.
class PostAns(models.Model):
created = models.DateTimeField(auto_now_add=True)
creator = models.ForeignKey(User, blank=True, null=True)
post = models.ForeignKey(Post)
body = models.TextField()
like_count = models.IntegerField(default=0,blank=True,null=True)
# If we use markdown can remove this if not
body_html = models.TextField(blank=True)
class PostAnsForm(ModelForm):
class Meta:
model = PostAns
fields = ('body')
I haven't found a similar error on the net.