23 lines
741 B
Python
23 lines
741 B
Python
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
class User(AbstractUser):
|
|
pass
|
|
|
|
|
|
class AuctionListing(models.Model):
|
|
title = models.CharField(max_length = 64,primary_key = True)
|
|
user = models.ForeignKey(User,on_delete = models.CASCADE,default = " ")
|
|
price = models.DecimalField(max_digits = 10,decimal_places = 2)
|
|
desc = models.CharField(max_length = 1000)
|
|
picture = models.URLField(null=True)
|
|
|
|
|
|
def __str__(self):
|
|
return f"{self.title}: {self.price},{self.desc},{self.picture}"
|
|
class Comments(models.Model):
|
|
title = models.ForeignKey(AuctionListing,on_delete = models.CASCADE,related_name="auction_title")
|
|
comment = models.CharField(max_length = 1000)
|
|
|