• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

chiefonboarding / ChiefOnboarding / 5538019943

pending completion
5538019943

push

github

web-flow
Fix TextField not available in sequence (#332)

5495 of 5884 relevant lines covered (93.39%)

0.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.37
back/admin/templates/utils.py
1
from django.apps import apps
1✔
2

3
from admin.appointments.forms import AppointmentForm
1✔
4
from admin.badges.forms import BadgeForm
1✔
5
from admin.introductions.forms import IntroductionForm
1✔
6
from admin.preboarding.forms import PreboardingForm
1✔
7
from admin.resources.forms import ResourceForm
1✔
8
from admin.to_do.forms import ToDoForm
1✔
9

10
MODELS = [
1✔
11
    {"app": "to_do", "model": "ToDo", "user_field": "to_do", "form": ToDoForm},
12
    {
13
        "app": "resources",
14
        "model": "Resource",
15
        "user_field": "resources",
16
        "form": ResourceForm,
17
    },
18
    {
19
        "app": "introductions",
20
        "model": "Introduction",
21
        "user_field": "introductions",
22
        "form": IntroductionForm,
23
    },
24
    {
25
        "app": "appointments",
26
        "model": "Appointment",
27
        "user_field": "appointments",
28
        "form": AppointmentForm,
29
    },
30
    {
31
        "app": "preboarding",
32
        "model": "Preboarding",
33
        "user_field": "preboarding",
34
        "form": PreboardingForm,
35
    },
36
    {"app": "badges", "model": "Badge", "user_field": "badges", "form": BadgeForm},
37
]
38

39

40
def template_model_exists(template_slug):
1✔
41
    return any([x["model"].lower() == template_slug.lower() for x in MODELS])
1✔
42

43

44
def get_templates_model(template_slug):
1✔
45
    if template_model_exists(template_slug):
1✔
46
        model_item = next(
1✔
47
            (x for x in MODELS if x["model"].lower() == template_slug.lower()), None
48
        )
49
        return apps.get_model(model_item["app"], model_item["model"])
1✔
50

51

52
def get_user_field(template_slug):
1✔
53
    if template_model_exists(template_slug):
1✔
54
        return next(
1✔
55
            (
56
                x["user_field"]
57
                for x in MODELS
58
                if x["model"].lower() == template_slug.lower()
59
            ),
60
            None,
61
        )
62

63

64
def get_model_item(template_slug):
1✔
65
    model_item = None
×
66
    if template_model_exists(template_slug):
×
67
        model_item = next(
×
68
            (x for x in MODELS if x["model"].lower() == template_slug.lower()), None
69
        )
70
    return model_item
×
71

72

73
def get_model_form(template_slug):
1✔
74
    model = get_model_item(template_slug)
×
75

76
    if model is None:
×
77
        return None
×
78

79
    return get_model_item(template_slug)["form"]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc