4๐
โ
I can see two issues with your model.
You didnโt create an instance of the IntegerField
; you need to call it:
id = models.IntegerField()
# ^^
You are creating tuples for the other fields, because you end each field with a comma:
title = models.CharField(max_length=40),
# ^
Remove those commas.
You donโt really have to specify your own id
field; models are by default given an id
field automatically. See Automatic primary fields in the Django models documentation:
By default, Django gives each model the following field:
id = models.AutoField(primary_key=True)
This is an auto-incrementing primary key.
Since your specified your own id
field that doesnโt use primary_key=True
, your model is probably going to run into problems with that too.
๐คMartijn Pieters
- [Django]-Django-haystack result filtering using attributes?
- [Django]-Django-crispy-forms AttributeError when using built in AuthenticationForm
0๐
You are missing two () for your id integerfield.
id = models.IntegerField()
๐คJimmy Bernljung
- [Django]-'User' object has no attribute 'username'
- [Django]-How to pass args to a signal
- [Django]-Link with parameter in Django templates
Source:stackexchange.com