'Why is the error showing 5 positional arguments while registering the model
I am trying to make a chat application on Django. I have created a model to input into a database of the format room_no, user, message. Additionally, I have included the init function to extract the data from the database in the form of a string so I can display it on the HTML page. Apart from my method, is there another way to do this? If not, could you please explain my error?
Models:
class chatbox(models.Model):
name = models.CharField(max_length=100, blank=False,default='Anonymous')
room = models.CharField(max_length=100,blank=True)
message = models.CharField(max_length=500000,blank=True)
def __init__(self,name,message):
self.name = name
self.message = message
ADMIN
admin.site.register(models.chatbox)
Error:
TypeError at /admin/DjangoChat/chatbox/
chatbox.__init__() takes 3 positional arguments but 5 were given
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
