Simplify view naming
This commit is contained in:
parent
3c247a17cf
commit
25e74088b8
|
@ -9,15 +9,15 @@ urlpatterns = [
|
||||||
# Redirect root to bookmarks index
|
# Redirect root to bookmarks index
|
||||||
url(r'^$', RedirectView.as_view(pattern_name='bookmarks:index', permanent=False)),
|
url(r'^$', RedirectView.as_view(pattern_name='bookmarks:index', permanent=False)),
|
||||||
# Bookmarks
|
# Bookmarks
|
||||||
path('bookmarks', views.bookmarks_index, name='index'),
|
path('bookmarks', views.bookmarks.index, name='index'),
|
||||||
path('bookmarks/new', views.bookmarks_new, name='new'),
|
path('bookmarks/new', views.bookmarks.new, name='new'),
|
||||||
path('bookmarks/close', views.bookmarks_close, name='close'),
|
path('bookmarks/close', views.bookmarks.close, name='close'),
|
||||||
path('bookmarks/<int:bookmark_id>/edit', views.bookmarks_edit, name='edit'),
|
path('bookmarks/<int:bookmark_id>/edit', views.bookmarks.edit, name='edit'),
|
||||||
path('bookmarks/<int:bookmark_id>/remove', views.bookmarks_remove, name='remove'),
|
path('bookmarks/<int:bookmark_id>/remove', views.bookmarks.remove, name='remove'),
|
||||||
path('bookmarklet', views.bookmarks_bookmarklet, name='bookmarklet'),
|
path('bookmarklet', views.bookmarks.bookmarklet, name='bookmarklet'),
|
||||||
# Settings
|
# Settings
|
||||||
path('settings', views.settings_index, name='settings_index'),
|
path('settings', views.settings.index, name='settings_index'),
|
||||||
path('settings/import', views.settings_bookmark_import, name='settings_import'),
|
path('settings/import', views.settings.bookmark_import, name='settings_import'),
|
||||||
# API
|
# API
|
||||||
path('api/website_metadata', views.api.api_website_metadata, name='api.website_metadata'),
|
path('api/website_metadata', views.api.website_metadata, name='api.website_metadata'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,7 +5,7 @@ from bookmarks.services.website_loader import load_website_metadata
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def api_website_metadata(request):
|
def website_metadata(request):
|
||||||
url = request.GET.get('url')
|
url = request.GET.get('url')
|
||||||
metadata = load_website_metadata(url)
|
metadata = load_website_metadata(url)
|
||||||
return JsonResponse(metadata.to_dict())
|
return JsonResponse(metadata.to_dict())
|
||||||
|
|
|
@ -12,7 +12,7 @@ _default_page_size = 30
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_index(request):
|
def index(request):
|
||||||
page = request.GET.get('page')
|
page = request.GET.get('page')
|
||||||
query_string = request.GET.get('q')
|
query_string = request.GET.get('q')
|
||||||
query_set = queries.query_bookmarks(request.user, query_string)
|
query_set = queries.query_bookmarks(request.user, query_string)
|
||||||
|
@ -34,7 +34,7 @@ def bookmarks_index(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_new(request):
|
def new(request):
|
||||||
initial_url = request.GET.get('url')
|
initial_url = request.GET.get('url')
|
||||||
initial_auto_close = 'auto_close' in request.GET
|
initial_auto_close = 'auto_close' in request.GET
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ def bookmarks_new(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_edit(request, bookmark_id: int):
|
def edit(request, bookmark_id: int):
|
||||||
bookmark = Bookmark.objects.get(pk=bookmark_id)
|
bookmark = Bookmark.objects.get(pk=bookmark_id)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = BookmarkForm(request.POST, instance=bookmark)
|
form = BookmarkForm(request.POST, instance=bookmark)
|
||||||
|
@ -74,19 +74,19 @@ def bookmarks_edit(request, bookmark_id: int):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_remove(request, bookmark_id: int):
|
def remove(request, bookmark_id: int):
|
||||||
bookmark = Bookmark.objects.get(pk=bookmark_id)
|
bookmark = Bookmark.objects.get(pk=bookmark_id)
|
||||||
bookmark.delete()
|
bookmark.delete()
|
||||||
return HttpResponseRedirect(reverse('bookmarks:index'))
|
return HttpResponseRedirect(reverse('bookmarks:index'))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_bookmarklet(request):
|
def bookmarklet(request):
|
||||||
return render(request, 'bookmarks/bookmarklet.html', {
|
return render(request, 'bookmarks/bookmarklet.html', {
|
||||||
'application_url': request.build_absolute_uri("/bookmarks/new")
|
'application_url': request.build_absolute_uri("/bookmarks/new")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def bookmarks_close(request):
|
def close(request):
|
||||||
return render(request, 'bookmarks/close.html')
|
return render(request, 'bookmarks/close.html')
|
||||||
|
|
|
@ -8,7 +8,7 @@ from bookmarks.services.importer import import_netscape_html
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def settings_index(request):
|
def index(request):
|
||||||
import_message = _find_message_with_tag(messages.get_messages(request), 'bookmark_import')
|
import_message = _find_message_with_tag(messages.get_messages(request), 'bookmark_import')
|
||||||
return render(request, 'settings/index.html', {
|
return render(request, 'settings/index.html', {
|
||||||
'import_message': import_message
|
'import_message': import_message
|
||||||
|
@ -16,7 +16,7 @@ def settings_index(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def settings_bookmark_import(request):
|
def bookmark_import(request):
|
||||||
try:
|
try:
|
||||||
import_file = request.FILES.get('import_file')
|
import_file = request.FILES.get('import_file')
|
||||||
content = import_file.read()
|
content = import_file.read()
|
||||||
|
|
Loading…
Reference in New Issue