Coverage for servermodel / migrations / 0006_historicalmodel.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-24 12:43 +0000

1# Generated by Django 6.0.3 on 2026-03-10 07:29 

2 

3import django.db.models.deletion 

4import simple_history.models 

5from django.conf import settings 

6from django.db import migrations, models 

7 

8 

9class Migration(migrations.Migration): 

10 

11 dependencies = [ 

12 ( 

13 "servermodel", 

14 "0005_alter_model_options_alter_model_unique_together_and_more", 

15 ), 

16 ("vendor", "0007_historicalmodel"), 

17 migrations.swappable_dependency(settings.AUTH_USER_MODEL), 

18 ] 

19 

20 operations = [ 

21 migrations.CreateModel( 

22 name="HistoricalModel", 

23 fields=[ 

24 ( 

25 "id", 

26 models.BigIntegerField( 

27 auto_created=True, blank=True, db_index=True, verbose_name="ID" 

28 ), 

29 ), 

30 ("name", models.CharField(max_length=45)), 

31 ("history_id", models.AutoField(primary_key=True, serialize=False)), 

32 ("history_date", models.DateTimeField(db_index=True)), 

33 ("history_change_reason", models.CharField(max_length=100, null=True)), 

34 ( 

35 "history_type", 

36 models.CharField( 

37 choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")], 

38 max_length=1, 

39 ), 

40 ), 

41 ( 

42 "history_user", 

43 models.ForeignKey( 

44 null=True, 

45 on_delete=django.db.models.deletion.SET_NULL, 

46 related_name="+", 

47 to=settings.AUTH_USER_MODEL, 

48 ), 

49 ), 

50 ( 

51 "vendor", 

52 models.ForeignKey( 

53 blank=True, 

54 db_constraint=False, 

55 default=None, 

56 null=True, 

57 on_delete=django.db.models.deletion.DO_NOTHING, 

58 related_name="+", 

59 related_query_name="servermodel", 

60 to="vendor.model", 

61 ), 

62 ), 

63 ], 

64 options={ 

65 "verbose_name": "historical model", 

66 "verbose_name_plural": "historical models", 

67 "ordering": ("-history_date", "-history_id"), 

68 "get_latest_by": ("history_date", "history_id"), 

69 }, 

70 bases=(simple_history.models.HistoricalChanges, models.Model), 

71 ), 

72 ]