Skip to content

Commit

Permalink
Remove custom form used to add or update themes
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed Aug 8, 2024
1 parent 53a6b1e commit cd23442
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
18 changes: 0 additions & 18 deletions weechat/common/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,3 @@ def get_bound_field(self, form, field_name):
class Html5EmailInput(forms.widgets.Input):
"""E-mail field (with HTML5 validator)."""
input_type = 'email'


class Form(forms.Form):
"""Form with "as_div" method."""

def as_div(self):
"Return this form rendered as HTML <div>s."
return self._html_output(
normal_row=('<div%(html_class_attr)s class="form-group row">'
'%(label)s'
'<div class="col-12 col-md-9 col-lg-10">'
'%(field)s%(help_text)s'
'</div>'
'</div>'),
error_row='%s',
row_ender='</p>',
help_text_html=' <span class="helptext">%s</span>',
errors_on_separate_row=True)
2 changes: 1 addition & 1 deletion weechat/templates/themes/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="col-12 col-md-8">
<form action="." method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_div }}
{{ form.as_p }}
<button type="submit" class="btn btn-primary btn-lg mt-3 px-5">{% trans "Submit" %}</button>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion weechat/templates/themes/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="col-12 col-md-8">
<form action="." method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_div }}
{{ form.as_p }}
<button type="submit" class="btn btn-primary btn-lg mt-3 px-5">{% trans "Submit" %}</button>
</form>
</div>
Expand Down
5 changes: 2 additions & 3 deletions weechat/themes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
FileField,
TestField,
Html5EmailInput,
Form,
)
from weechat.common.path import files_path_join
from weechat.download.models import Release
Expand Down Expand Up @@ -157,7 +156,7 @@ class Meta:
ordering = ['-added']


class ThemeFormAdd(Form):
class ThemeFormAdd(forms.Form):
"""Form to add a theme."""
required_css_class = 'required'
themefile = FileField(
Expand Down Expand Up @@ -243,7 +242,7 @@ def get_theme_choices():
return []


class ThemeFormUpdate(Form):
class ThemeFormUpdate(forms.Form):
"""Form to update a theme."""
required_css_class = 'required'
theme = ChoiceField(
Expand Down

0 comments on commit cd23442

Please sign in to comment.