mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 06:17:17 +00:00
fixed settings and user management.
This commit is contained in:
@@ -7,13 +7,13 @@ from comic.models import Setting
|
|||||||
|
|
||||||
|
|
||||||
class InitialSetupForm(forms.Form):
|
class InitialSetupForm(forms.Form):
|
||||||
username = forms.CharField(help_text="Username", widget=forms.TextInput(attrs={"class": "form-control"}))
|
username = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
email = forms.CharField(help_text="Email Address", widget=forms.TextInput(attrs={"class": "form-control"}))
|
email = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
password = forms.CharField(help_text="New Password", widget=forms.PasswordInput(attrs={"class": "form-control"}))
|
password = forms.CharField(widget=forms.PasswordInput(attrs={"class": "form-control"}))
|
||||||
password_confirm = forms.CharField(
|
password_confirm = forms.CharField(
|
||||||
help_text="New Password Confirmation", widget=forms.PasswordInput(attrs={"class": "form-control"})
|
widget=forms.PasswordInput(attrs={"class": "form-control"})
|
||||||
)
|
)
|
||||||
base_dir = forms.CharField(help_text="Base Directory", widget=forms.TextInput(attrs={"class": "form-control"}))
|
base_dir = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
|
|
||||||
def clean_base_dir(self):
|
def clean_base_dir(self):
|
||||||
data = self.cleaned_data["base_dir"]
|
data = self.cleaned_data["base_dir"]
|
||||||
@@ -32,16 +32,14 @@ class InitialSetupForm(forms.Form):
|
|||||||
|
|
||||||
class AccountForm(forms.Form):
|
class AccountForm(forms.Form):
|
||||||
username = forms.CharField(
|
username = forms.CharField(
|
||||||
help_text="Username",
|
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.TextInput(attrs={"class": "form-control disabled", "readonly": True}),
|
widget=forms.TextInput(attrs={"class": "form-control disabled", "readonly": True}),
|
||||||
)
|
)
|
||||||
email = forms.CharField(help_text="Email Address", widget=forms.TextInput(attrs={"class": "form-control"}))
|
email = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
password = forms.CharField(
|
password = forms.CharField(
|
||||||
help_text="New Password", required=False, widget=forms.PasswordInput(attrs={"class": "form-control"})
|
required=False, widget=forms.PasswordInput(attrs={"class": "form-control"})
|
||||||
)
|
)
|
||||||
password_confirm = forms.CharField(
|
password_confirm = forms.CharField(
|
||||||
help_text="New Password Confirmation",
|
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.PasswordInput(attrs={"class": "form-control"}),
|
widget=forms.PasswordInput(attrs={"class": "form-control"}),
|
||||||
)
|
)
|
||||||
@@ -65,11 +63,11 @@ class AccountForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class AddUserForm(forms.Form):
|
class AddUserForm(forms.Form):
|
||||||
username = forms.CharField(help_text="Username", widget=forms.TextInput(attrs={"class": "form-control"}))
|
username = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
email = forms.CharField(help_text="Email Address", widget=forms.TextInput(attrs={"class": "form-control"}))
|
email = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
password = forms.CharField(help_text="New Password", widget=forms.PasswordInput(attrs={"class": "form-control"}))
|
password = forms.CharField(widget=forms.PasswordInput(attrs={"class": "form-control"}))
|
||||||
password_confirm = forms.CharField(
|
password_confirm = forms.CharField(
|
||||||
help_text="New Password Confirmation", widget=forms.PasswordInput(attrs={"class": "form-control"})
|
widget=forms.PasswordInput(attrs={"class": "form-control"})
|
||||||
)
|
)
|
||||||
|
|
||||||
def clean_username(self):
|
def clean_username(self):
|
||||||
@@ -95,13 +93,12 @@ class AddUserForm(forms.Form):
|
|||||||
|
|
||||||
class EditUserForm(forms.Form):
|
class EditUserForm(forms.Form):
|
||||||
username = forms.CharField(
|
username = forms.CharField(
|
||||||
help_text="Username",
|
|
||||||
required=False,
|
required=False,
|
||||||
widget=forms.TextInput(attrs={"class": "form-control disabled", "readonly": True}),
|
widget=forms.TextInput(attrs={"class": "form-control disabled", "readonly": True}),
|
||||||
)
|
)
|
||||||
email = forms.CharField(help_text="Email Address", widget=forms.TextInput(attrs={"class": "form-control"}))
|
email = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
password = forms.CharField(
|
password = forms.CharField(
|
||||||
help_text="New Password", required=False, widget=forms.PasswordInput(attrs={"class": "form-control"})
|
required=False, widget=forms.PasswordInput(attrs={"class": "form-control"})
|
||||||
)
|
)
|
||||||
# TODO: allow setting superuser on users
|
# TODO: allow setting superuser on users
|
||||||
|
|
||||||
@@ -127,7 +124,7 @@ class EditUserForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class SettingsForm(forms.Form):
|
class SettingsForm(forms.Form):
|
||||||
base_dir = forms.CharField(help_text="Base Directory", widget=forms.TextInput(attrs={"class": "form-control"}))
|
base_dir = forms.CharField(widget=forms.TextInput(attrs={"class": "form-control"}))
|
||||||
|
|
||||||
def clean_base_dir(self):
|
def clean_base_dir(self):
|
||||||
data = self.cleaned_data["base_dir"]
|
data = self.cleaned_data["base_dir"]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load bootstrap4 %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
@@ -13,13 +14,10 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% for item in form %}
|
{% bootstrap_form form %}
|
||||||
<div class="form-group">
|
{% buttons %}
|
||||||
<label for="{{ item.id_for_label }}">{{ item.help_text }}</label>
|
<button type="submit" class="btn btn-secondary">Submit</button>
|
||||||
{{ item }}
|
{% endbuttons %}
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
<button type="submit" class="btn btn-default">Submit</button>
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@
|
|||||||
<tbody data-link="row" class="rowlink">
|
<tbody data-link="row" class="rowlink">
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{user.id}}/">{{user.id}}</a></td>
|
<td>{{user.id}}</td>
|
||||||
<td>{{user.username}}</td>
|
<td><a href="{% url 'user_details' user.id %}">{{user.username}}</a></td>
|
||||||
<td>{{user.email}}</td>
|
<td>{{user.email}}</td>
|
||||||
<td>{{user.is_superuser}}</td>
|
<td>{{user.is_superuser}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<a class="btn btn-default" href="/comic/settings/users/add/" role="button">Add User</a>
|
<a class="btn btn-secondary" href="{% url 'add_users' %}" role="button">Add User</a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ urlpatterns = [
|
|||||||
url(r"^$", views.comic_list, name="index"),
|
url(r"^$", views.comic_list, name="index"),
|
||||||
url(r"^settings/$", views.settings_page, name="settings"),
|
url(r"^settings/$", views.settings_page, name="settings"),
|
||||||
url(r"^settings/users/$", views.users_page, name="users"),
|
url(r"^settings/users/$", views.users_page, name="users"),
|
||||||
url(r"^settings/users/(?P<user_id>[0-9]+)/$", views.user_config_page, name="users"),
|
url(r"^settings/users/(?P<user_id>[0-9]+)/$", views.user_config_page, name="user_details"),
|
||||||
url(r"^settings/users/add/$", views.user_add_page, name="users"),
|
url(r"^settings/users/add/$", views.user_add_page, name="add_users"),
|
||||||
url(r"^account/$", views.account_page, name="account"),
|
url(r"^account/$", views.account_page, name="account"),
|
||||||
url(r"^read/(?P<comic_selector>[\w-]+)/(?P<page>[0-9]+)/$", views.read_comic, name="read_comic"),
|
url(r"^read/(?P<comic_selector>[\w-]+)/(?P<page>[0-9]+)/$", views.read_comic, name="read_comic"),
|
||||||
url(r"^read/(?P<comic_selector>[\w-]+)/(?P<page>[0-9]+)/img$", views.get_image, name="get_image"),
|
url(r"^read/(?P<comic_selector>[\w-]+)/(?P<page>[0-9]+)/img$", views.get_image, name="get_image"),
|
||||||
|
|||||||
Reference in New Issue
Block a user