Skip to content Skip to sidebar Skip to footer

Django Convert Current Model/raw Html Input To Form To Save Input Data

I have a simple form where there is a username and a message. Upon clicking the submit button, I want the data for user and message to be stored separately into the database. I am

Solution 1:

Try changing your model so that content can be null:

classMessage(models.Model):
    content = models.TextField(max_length=140, null=True, blank=True)

Or give a default value in the form:

m = Message(content=request.POST.get('text', ' '), user = u)

Post a Comment for "Django Convert Current Model/raw Html Input To Form To Save Input Data"