Coverage for actions/models.py: 93.33%

15 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-14 21:14 -0700

1from django.contrib.contenttypes.fields import GenericForeignKey 1a

2from django.contrib.contenttypes.models import ContentType 1a

3from django.db import models 1a

4 

5 

6class Action(models.Model): 1a

7 user = models.ForeignKey( 1a

8 "auth.User", 

9 related_name="actions", 

10 on_delete=models.CASCADE, 

11 ) 

12 verb = models.CharField(max_length=255) 1a

13 created = models.DateTimeField(auto_now_add=True) 1a

14 target_ct = models.ForeignKey( 1a

15 ContentType, 

16 blank=True, 

17 null=True, 

18 related_name="target_obj", 

19 on_delete=models.CASCADE, 

20 ) 

21 target_id = models.PositiveIntegerField(null=True, blank=True) 1a

22 target = GenericForeignKey("target_ct", "target_id") 1a

23 

24 class Meta: 1a

25 indexes = [ 1a

26 models.Index(fields=["-created"]), 

27 models.Index(fields=["target_ct", "target_id"]), 

28 ] 

29 ordering = ["-created"] 1a

30 

31 def __str__(self): 1a

32 pass