Skip to content

Commit 1fb4acb

Browse files
committed
Accidentally skipped a version
1 parent 2746580 commit 1fb4acb

File tree

4 files changed

+82
-21
lines changed

4 files changed

+82
-21
lines changed

permafrost/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.2.9"
1+
VERSION = "0.2.8"

permafrost/forms.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def bootstrappify(fields):
4141

4242
class SelectPermafrostRoleTypeForm(ModelForm):
4343
name = CharField(required=False)
44-
description = CharField(required=False, widget=Textarea())
44+
description = CharField(required=False)
4545
category = ChoiceField(choices=CHOICES)
4646

4747
class Meta:
@@ -51,6 +51,8 @@ class Meta:
5151

5252
def __init__(self, *args, **kwargs):
5353
super().__init__(*args, **kwargs)
54+
self.fields['name'].help_text = PermafrostRole.name.field.help_text
55+
self.fields['description'].help_text = PermafrostRole.description.field.help_text
5456
bootstrappify(self.fields)
5557

5658

@@ -60,9 +62,6 @@ class PermafrostRoleCreateForm(ModelForm):
6062
class Meta:
6163
model = PermafrostRole
6264
fields = ('name', 'description', 'category',)
63-
widgets = {
64-
'description': Textarea(),
65-
}
6665
labels = LABELS
6766

6867
def __init__(self, *args, **kwargs):

permafrost/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ class PermafrostRole(models.Model):
134134
levels; 'administrator', 'staff' and 'user'.
135135
'''
136136

137-
name = models.CharField(_("Name"), max_length=50)
137+
name = models.CharField(_("Name"), max_length=50, help_text=_('Enter Role Name'))
138138
slug = models.SlugField(_("Slug"))
139-
description = models.CharField(_('Description'), null=True, blank=True, max_length=200)
139+
description = models.CharField(_('Description'), null=True, blank=True, max_length=200, help_text=_('Enter Description'))
140140
category = models.CharField(_("Role Type"), max_length=32, choices=get_choices(), blank=False, null=False) # These should stay fixed to not trigger a potenital migration issue with changing choices
141141
site = models.ForeignKey(Site, on_delete=models.CASCADE, default=get_current_site) # This uses a callable so it will not trigger a migration with the projects it's included in
142142
locked = models.BooleanField(_("Locked"), default=False) # If this is locked, it can not be edited by the Client, used for System Default Roles

permafrost/templates/permafrost/permafrostrole_form.html

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
{% block content %}
88
<form method="POST" id="role_form">
9-
<div class="d-sm-flex align-items-center justify-content-between mb-4">
10-
<h2> {% trans 'Roles & Permissions' %}</h2>
9+
{% csrf_token %}
10+
<div class="d-sm-flex align-items-center justify-content-between my-3">
11+
<h1 class="text-gray-800 m-0"> {% trans 'Roles & Permissions' %}</h1>
1112
<a href="{% if object %}{{ object.get_absolute_url }}{% else %}{% url 'permafrost:roles-manage' %}{% endif %}" class="btn btn-success btn-outline ml-auto">{% trans 'Cancel' %}</a>
1213
<button type="submit" class="btn btn-success ml-1">
1314
{% if object %}
@@ -17,34 +18,95 @@ <h2> {% trans 'Roles & Permissions' %}</h2>
1718
{% endif %}
1819
</button>
1920
</div>
20-
{% csrf_token %}
2121
<div class="card">
2222
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
23-
<h6 class="m-0 text-primary font-weight-bold">
23+
<h3 class="m-0 text-primary font-weight-bold">
2424
{% if object %}
2525
{% trans 'Edit Permissions' %}: {{ form.initial.name }}
2626
{% else %}
2727
{% trans 'Create Role' %}
2828
{% endif %}
29-
</h6>
29+
</h3>
3030
</div>
3131
<div class="card-body">
3232
{{ form.non_field_errors }}
33-
{% for field in form %}
34-
<div class="fieldWrapper form-group" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
35-
{{ field.label_tag }}{% if field.field.required %}<span class="required">*</span>{% endif %}
33+
<div class="form-row">
34+
<div class="form-group col-12 col-md-4">
35+
<label for="{{ form.name.id_for_label }}">
36+
{{ form.name.label }}
37+
</label>
38+
{% if form.name.required %}<span class="required">*</span>{% endif %}
39+
<input
40+
name="{{ form.name.name }}"
41+
type="text"
42+
id="{{form.name.id_for_label}}"
43+
class="form-control{% if form.name.errors %} is-invalid{% endif %}"
44+
placeholder="{{ form.name.help_text }}" value="{{form.instance.name}}" >
3645

37-
{{ field }}
46+
{% if form.name.errors %}
47+
<div class="invalid-feedback">
48+
{% for error in form.name.errors %}
49+
{{ error }}
50+
{% endfor %}
51+
</div>
52+
{% endif %}
53+
54+
</div>
55+
</div>
56+
<div class="form-row">
57+
<div class="form-group col">
58+
<label for="{{ form.description.id_for_label }}">
59+
{{ form.description.label }}
60+
</label>
61+
{% if form.description.required %}<span class="required">*</span>{% endif %}
62+
<input
63+
name="{{ form.description.name }}"
64+
type="text" id="{{ form.description.id_for_label }}"
65+
class="form-control{% if form.name.errors %} is-invalid{% endif %}"
66+
placeholder="{{ form.description.help_text }}"
67+
{% if form.instance.description %}
68+
value="{{form.instance.description}}"
69+
{% else %}
70+
value=""
71+
{% endif %}>
72+
73+
{% if form.description.errors %}
74+
<div class="invalid-feedback">
75+
{% for error in form.description.errors %}
76+
{{ error }}
77+
{% endfor %}
78+
</div>
79+
{% endif %}
80+
</div>
81+
</div>
82+
<div class="form-row">
83+
<div class="form-group col-12 col-md-4">
84+
<label for="{{ form.description.id_for_label }}">
85+
{{ form.description.label }}
86+
</label>
87+
{% if form.description.required %}<span class="required">*</span>{% endif %}
3888

39-
{% if field.help_text %}
40-
<p class="help">{{ field.help_text|safe }}</p>
89+
{{ form.category }}
90+
91+
{% if form.description.errors %}
92+
<div class="invalid-feedback">
93+
{% for error in form.description.errors %}
94+
{{ error }}
95+
{% endfor %}
96+
</div>
4197
{% endif %}
98+
</div>
99+
</div>
100+
<!-- {% for field in form %}
101+
<div class="fieldWrapper form-group" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
102+
{{ field.label_tag }}{% if field.field.required %}<span class="required">*</span>{% endif %}
103+
{{ field }}
42104
{{ field.errors }}
43105
</div>
44-
{% endfor %}
45-
</div>
46-
<div class="card-footer">
106+
{% endfor %} -->
107+
47108
</div>
109+
48110
</div>
49111
</form>
50112
{% endblock %}

0 commit comments

Comments
 (0)