-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from l0rb/corpus-settings
Corpus settings
- Loading branch information
Showing
7 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from django.urls import path | ||
|
||
from accounts import views as accounts_views | ||
from accounts import views | ||
|
||
|
||
urlpatterns = [ | ||
path('signup/', accounts_views.signup, name='signup'), | ||
path('logout/', accounts_views.logout_view, name='logout'), | ||
path('login/', accounts_views.login_view, name='login'), | ||
path('signup/', views.signup, name='signup'), | ||
path('logout/', views.logout_view, name='logout'), | ||
path('login/', views.login_view, name='login'), | ||
path('corpus_settings/', views.corpus_settings, name='corpus_settings'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
{% block content %} | ||
<h2>Corpus Settings</h2> | ||
<table class="table"> | ||
<form method="post" novalidate> | ||
{{ formset.management_form }} | ||
{% csrf_token %} | ||
<tr> | ||
{% for form in formset %} | ||
<td> | ||
Slug: {{ form.instance.slug }} | ||
{{ form.as_p }} | ||
</td> | ||
{% endfor %} | ||
</tr> | ||
<tr> | ||
<td> | ||
<button type="submit" class="btn btn-primary">Save</button> | ||
</td> | ||
</tr> | ||
</form> | ||
</table> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
from django.contrib import admin | ||
from explore.models import Corpus | ||
from guardian.admin import GuardedModelAdmin | ||
|
||
@admin.register(Corpus) | ||
class CorpusAdmin(GuardedModelAdmin): | ||
list_display = ('slug',) | ||
|
||
def get_fields(self, request, obj): | ||
if request.user.is_superuser: | ||
return super().get_fields(request, obj) | ||
else: # staff | ||
return ['disabled', 'desc', 'name'] | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters