Coverage for src/django_resume/models.py: 100%

1 from django.db import models

2 from django.contrib.auth import get_user_model

3

4

5 class Resume(models.Model):

6 name = models.CharField(max_length=255)

7 slug = models.SlugField(max_length=255, unique=True)

8 owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)

9 plugin_data = models.JSONField(default=dict, blank=True, null=False)

10

11 def __repr__(self):

12 return f"<{self.name}>"

13

14 def __str__(self):

15 return self.name

16

17 def save(self, *args, **kwargs):

18 if self.plugin_data is None:

19 self.plugin_data = {}

20 super().save(*args, **kwargs)