Sep-07-2020, 12:18 AM
(This post was last modified: Sep-07-2020, 12:18 AM by card51shor.)
OK here is my code so far :
Models.py :
Models.py :
from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): pass class Auction(models.Model): title = models.CharField(max_length=64) description = models.CharField(max_length=64) price = models.IntegerField() category = models.CharField(max_length=64) class Bid(): pass class Comment(): passview.py:
def auction(request): title = request.POST.get("title") description = request.POST.get("description") price = request.POST.get("price") category = request.POST.get("category") newPost = Auction.objects.create() newPost.save() return render(request, "auctions/auction.html")I'm getting the error that "Auction" isn't defined. obbviously my syntax for the newPost = Auction.objects.create() is wrong. What am I doing wrong? When I put paramters - I get the same error. Thanks