Python Forum
[django] arguments not defined - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: [django] arguments not defined (/thread-18008.html)



[django] arguments not defined - SheeppOSU - May-02-2019

I was watching a tutorial to django. I was using the cmd for some stuff. Anyways I have a class and I was trying to define the class but I was getting an error. TIA for your help

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User


class Post(models.Model):
    title = models.CharField(max_length=100)
    content = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)
Error:
Traceback (most recent call): File "<console>", line 1, in <module> File "C:\users\etc.\django\db\models\base.py", line 501n in __init__ raise TypeError("%s() got an unexpected keyword argument '%s'" % (cls.__name__, kwarg)) TypeError: Post() got an unexpected keyword argument 'author'