File: models.py

package info (click to toggle)
python-django-extensions 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,820 kB
  • sloc: python: 18,601; javascript: 7,354; makefile: 108; xml: 17
file content (41 lines) | stat: -rw-r--r-- 1,067 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
from django.db import models


class Note(models.Model):
    # name conflict with testapp.Note
    text = models.CharField(max_length=42)
    creation_date = models.DateField(auto_now_add=True)

    class Meta:
        app_label = "collisions"


class UniqueModel(models.Model):
    # no conflicts
    global_hash_id = models.CharField(max_length=32)

    class Meta:
        app_label = "collisions"


class Group(models.Model):
    # conflict with django.contrib.auth
    name = models.CharField(max_length=10)
    priority = models.IntegerField()


class Name(models.Model):
    # name conflict with testapp.Name
    real_name = models.CharField(max_length=50)
    number_of_users_having_this_name = models.IntegerField()

    class Meta:
        app_label = "collisions"


class SystemUser(models.Model):
    # no conflicts but FK to conflicting models.
    name = models.ForeignKey(Name, on_delete=models.CASCADE)
    group = models.ForeignKey(Group, on_delete=models.CASCADE)
    global_id = models.CharField(unique=True, max_length=32)