26 lines
648 B
Python
26 lines
648 B
Python
from agent.models import Agent
|
|
from django.db import models
|
|
|
|
|
|
class PurchaseTag(models.Model):
|
|
name = models.CharField(max_length=255)
|
|
description = models.TextField(blank=True)
|
|
|
|
def __repr__(self):
|
|
return f"PurchaseTag_{self.name}"
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class Purchase(models.Model):
|
|
author = models.ForeignKey(Agent, on_delete=models.PROTECT)
|
|
comment = models.TextField(blank=True)
|
|
tags = models.ManyToManyField(PurchaseTag)
|
|
title = models.CharField(max_length=255)
|
|
|
|
def __repr__(self):
|
|
return f"Purchase_{self.title}"
|
|
|
|
def __str__(self):
|
|
return self.title
|