Skip to content
Snippets Groups Projects
Commit dec4e774 authored by Valentin Rigal's avatar Valentin Rigal
Browse files

Declare Budget.memberships generic relation

parent 330074ba
No related branches found
No related tags found
1 merge request!2518Declare Budget.memberships generic relation
import uuid
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.core.validators import MinLengthValidator
from django.db import models
......@@ -9,6 +10,7 @@ class Budget(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=100, validators=[MinLengthValidator(1)])
total = models.DecimalField(max_digits=12, decimal_places=3, default=0)
memberships = GenericRelation("users.Right", "content_id")
def __str__(self) -> str:
return self.name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment