mirror of
https://github.com/creyD/asiimov.git
synced 2026-06-16 18:50:19 +02:00
Added Offer Model
This commit is contained in:
@@ -13,7 +13,8 @@ BADGE_RARITIES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# MODELS
|
# STEAM MIRROR MODELS
|
||||||
|
# -- Models that mirror parts of the steam inventory system --
|
||||||
# Storing the classes of items for quick selection in some menues
|
# Storing the classes of items for quick selection in some menues
|
||||||
class ItemType(models.Model):
|
class ItemType(models.Model):
|
||||||
paint_index = models.IntegerField(primary_key=True, unique=True) # Skin
|
paint_index = models.IntegerField(primary_key=True, unique=True) # Skin
|
||||||
@@ -59,6 +60,8 @@ class Badge(models.Model):
|
|||||||
rarity = models.CharField(choices=BADGE_RARITIES, default=1, max_length=10)
|
rarity = models.CharField(choices=BADGE_RARITIES, default=1, max_length=10)
|
||||||
|
|
||||||
|
|
||||||
|
# ASIIMOV MODELS
|
||||||
|
# -- Models that are explicitly for our site --
|
||||||
# For storing user info like steamID (...)
|
# For storing user info like steamID (...)
|
||||||
class Gamer(models.Model):
|
class Gamer(models.Model):
|
||||||
steamid = models.IntegerField(primary_key=True, unique=True) # This is a maximum of 32 chars long
|
steamid = models.IntegerField(primary_key=True, unique=True) # This is a maximum of 32 chars long
|
||||||
@@ -82,6 +85,14 @@ class Gamer(models.Model):
|
|||||||
system_user = models.OneToOneField(User, on_delete=models.CASCADE)
|
system_user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Offer(models.Model):
|
||||||
|
offeror = models.ForeignKey(Gamer, on_delete=models.CASCADE)
|
||||||
|
items_give = models.ManyToManyField(ItemInstance)
|
||||||
|
items_want = models.ManyToManyField(ItemInstance)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=User)
|
@receiver(post_save, sender=User)
|
||||||
def save_user_profile(sender, instance, **kwargs):
|
def save_user_profile(sender, instance, **kwargs):
|
||||||
instance.gamer.save()
|
instance.gamer.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user