Skip to content

Commit 6a50695

Browse files
committed
removes bad file changes
1 parent 1fb4acb commit 6a50695

File tree

3 files changed

+20
-81
lines changed

3 files changed

+20
-81
lines changed

permafrost/forms.py

Lines changed: 4 additions & 3 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)
44+
description = CharField(required=False, widget=Textarea())
4545
category = ChoiceField(choices=CHOICES)
4646

4747
class Meta:
@@ -51,8 +51,6 @@ 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
5654
bootstrappify(self.fields)
5755

5856

@@ -62,6 +60,9 @@ class PermafrostRoleCreateForm(ModelForm):
6260
class Meta:
6361
model = PermafrostRole
6462
fields = ('name', 'description', 'category',)
63+
widgets = {
64+
'description': Textarea(),
65+
}
6566
labels = LABELS
6667

6768
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, help_text=_('Enter Role Name'))
137+
name = models.CharField(_("Name"), max_length=50)
138138
slug = models.SlugField(_("Slug"))
139-
description = models.CharField(_('Description'), null=True, blank=True, max_length=200, help_text=_('Enter Description'))
139+
description = models.CharField(_('Description'), null=True, blank=True, max_length=200)
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: 14 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
{% block content %}
88
<form method="POST" id="role_form">
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>
9+
<div class="d-sm-flex align-items-center justify-content-between mb-4">
10+
<h2> {% trans 'Roles & Permissions' %}</h2>
1211
<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>
1312
<button type="submit" class="btn btn-success ml-1">
1413
{% if object %}
@@ -18,95 +17,34 @@ <h1 class="text-gray-800 m-0"> {% trans 'Roles & Permissions' %}</h1>
1817
{% endif %}
1918
</button>
2019
</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-
<h3 class="m-0 text-primary font-weight-bold">
23+
<h6 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-
</h3>
29+
</h6>
3030
</div>
3131
<div class="card-body">
3232
{{ form.non_field_errors }}
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}}" >
45-
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 %}
88-
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>
97-
{% endif %}
98-
</div>
99-
</div>
100-
<!-- {% for field in form %}
33+
{% for field in form %}
10134
<div class="fieldWrapper form-group" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
10235
{{ field.label_tag }}{% if field.field.required %}<span class="required">*</span>{% endif %}
36+
10337
{{ field }}
38+
39+
{% if field.help_text %}
40+
<p class="help">{{ field.help_text|safe }}</p>
41+
{% endif %}
10442
{{ field.errors }}
10543
</div>
106-
{% endfor %} -->
107-
44+
{% endfor %}
45+
</div>
46+
<div class="card-footer">
10847
</div>
109-
11048
</div>
11149
</form>
11250
{% endblock %}

0 commit comments

Comments
 (0)