You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
xmrauctions/bids/models.py

19 lines
857 B
Python

from django_prometheus.models import ExportModelOperationsMixin
from django.db import models
from django.contrib.auth.models import User
from items.models import Item
from core.validators import address_is_valid_monero
class ItemBid(ExportModelOperationsMixin('item_bid'), models.Model):
item = models.ForeignKey(Item, related_name='bids', on_delete=models.CASCADE)
bidder = models.ForeignKey(User, related_name='bidder', on_delete=models.CASCADE)
bid_date = models.DateTimeField(auto_now_add=True)
last_updated = models.DateTimeField(auto_now=True)
bid_price_xmr = models.FloatField()
accepted = models.BooleanField(default=False)
return_address = models.CharField(max_length=100, validators=[address_is_valid_monero])
def __str__(self):
return f"{self.id} - {self.item.name} - {self.bidder} > {self.item.owner}"