Merge branch 'main' into progress_update
This commit is contained in:
@ -23,4 +23,5 @@ from .shelf import Shelf
|
||||
from .shelf import user_shelves_page, create_shelf, delete_shelf
|
||||
from .shelf import shelve, unshelve
|
||||
from .status import Status, Replies, CreateStatus, DeleteStatus
|
||||
from .updates import Updates
|
||||
from .user import User, EditUser, Followers, Following
|
||||
|
@ -52,7 +52,7 @@ class Goal(View):
|
||||
form = forms.GoalForm(request.POST, instance=goal)
|
||||
if not form.is_valid():
|
||||
data = {
|
||||
'title': '%s\'s %d Reading' % (goal.user.display_name, year),
|
||||
'title': '%s\'s %d Reading' % (request.user.display_name, year),
|
||||
'goal_form': form,
|
||||
'goal': goal,
|
||||
'year': year,
|
||||
|
@ -43,7 +43,7 @@ class Import(View):
|
||||
except (UnicodeDecodeError, ValueError):
|
||||
return HttpResponseBadRequest('Not a valid csv file')
|
||||
goodreads_import.start_import(job)
|
||||
return redirect('/import-status/%d' % job.id)
|
||||
return redirect('/import/%d' % job.id)
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
|
||||
@ -80,4 +80,4 @@ class ImportStatus(View):
|
||||
items,
|
||||
)
|
||||
goodreads_import.start_import(job)
|
||||
return redirect('/import-status/%d' % job.id)
|
||||
return redirect('/import/%d' % job.id)
|
||||
|
17
bookwyrm/views/updates.py
Normal file
17
bookwyrm/views/updates.py
Normal file
@ -0,0 +1,17 @@
|
||||
''' endpoints for getting updates about activity '''
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import JsonResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
class Updates(View):
|
||||
''' so the app can poll '''
|
||||
def get(self, request):
|
||||
''' any notifications waiting? '''
|
||||
return JsonResponse({
|
||||
'notifications': request.user.notification_set.filter(
|
||||
read=False
|
||||
).count(),
|
||||
})
|
Reference in New Issue
Block a user