Python Forum
Working on an Auction Site - had questions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working on an Auction Site - had questions
#4
OK here is my code so far :

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():
    pass
view.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
Reply


Messages In This Thread
RE: Working on an Auction Site - had questions - by card51shor - Sep-07-2020, 12:18 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020