|
12345678910111213141516171819202122232425 |
- from django.db import models
- from .event import EventOfferAccepted
-
-
- # offer für orders
- class Offer(models.Model):
- company = models.ForeignKey("Company", default=1, on_delete=models.CASCADE)
- amount = models.IntegerField(default=0)
- order = models.ForeignKey("Order", default=1, on_delete=models.CASCADE)
-
- def offerAcceptedEvent(self):
- name = "Offer for " + self.order.name
- description = (
- "Your offer for the order "
- + self.order.name
- + " has been accepted!"
- + " You have "
- + str(self.order.maxRounds)
- + " rounds time to finish the order and claim your profit of "
- + str(self.order.profit)
- )
- offeracceptedevent = EventOfferAccepted.objects.create(
- name=name, description=description, order=self.order
- )
- self.company.addEvent(offeracceptedevent)
|