mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 14:17:19 +00:00
fix for UserMisc not being created. this fixes issue #1
This commit is contained in:
@@ -13,11 +13,12 @@ class RecentComics(Feed):
|
|||||||
link = "/comics/"
|
link = "/comics/"
|
||||||
description = "Recently added Comics"
|
description = "Recently added Comics"
|
||||||
|
|
||||||
def get_object(self, request: HttpRequest, user_selector: str) -> UserMisc:
|
def get_object(self, request: HttpRequest, user_selector: str, *args, **kwargs) -> UserMisc:
|
||||||
user_selector = uuid.UUID(bytes=urlsafe_base64_decode(user_selector))
|
user_selector = uuid.UUID(bytes=urlsafe_base64_decode(user_selector))
|
||||||
return get_object_or_404(UserMisc, feed_id=user_selector)
|
return get_object_or_404(UserMisc, feed_id=user_selector)
|
||||||
|
|
||||||
def items(self) -> ComicBook:
|
@staticmethod
|
||||||
|
def items() -> ComicBook:
|
||||||
return ComicBook.objects.order_by('-date_added')[:10]
|
return ComicBook.objects.order_by('-date_added')[:10]
|
||||||
|
|
||||||
def item_title(self, item: ComicBook) -> str:
|
def item_title(self, item: ComicBook) -> str:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
from os import path
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from os import path
|
|
||||||
|
|
||||||
from comic.models import Setting
|
from comic.models import Setting
|
||||||
|
|
||||||
|
|
||||||
@@ -233,10 +233,10 @@ class SettingsForm(forms.Form):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_initial_values():
|
def get_initial_values():
|
||||||
base_dir, created = Setting.objects.get_or_create(name='BASE_DIR')
|
base_dir, _ = Setting.objects.get_or_create(name='BASE_DIR')
|
||||||
recaptcha_public_key, created = Setting.objects.get_or_create(name='RECAPTCHA_PUBLIC_KEY')
|
recaptcha_public_key, _ = Setting.objects.get_or_create(name='RECAPTCHA_PUBLIC_KEY')
|
||||||
recaptcha_private_key, created = Setting.objects.get_or_create(name='RECAPTCHA_PRIVATE_KEY')
|
recaptcha_private_key, _ = Setting.objects.get_or_create(name='RECAPTCHA_PRIVATE_KEY')
|
||||||
recaptcha, created = Setting.objects.get_or_create(name='RECAPTCHA')
|
recaptcha, _ = Setting.objects.get_or_create(name='RECAPTCHA')
|
||||||
if recaptcha.value == '1':
|
if recaptcha.value == '1':
|
||||||
recaptcha = True
|
recaptcha = True
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th id="select-all"><input type="checkbox" id="select-all-cb"></th>
|
<th id="select-all"><input type="checkbox" id="select-all-cb"></th>
|
||||||
<th>
|
<th>
|
||||||
<center><span class="glyphicon glyphicon-file"></span></center>
|
<div style="text-align: center;"><span class="glyphicon glyphicon-file"></span></div>
|
||||||
</th>
|
</th>
|
||||||
<th width="100%">File/Folder</th>
|
<th width="100%">File/Folder</th>
|
||||||
<th>Date Added</th>
|
<th>Date Added</th>
|
||||||
@@ -58,7 +58,7 @@ $(document).ready(function() {
|
|||||||
var r = $(row);
|
var r = $(row);
|
||||||
var cols = $('td:nth-child(n+2)', row);
|
var cols = $('td:nth-child(n+2)', row);
|
||||||
cols.attr('data-href', data['url']);
|
cols.attr('data-href', data['url']);
|
||||||
cols.attr('style', 'cursor: pointer;');;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
cols.attr('style', 'cursor: pointer;');
|
||||||
cols.click(function() {
|
cols.click(function() {
|
||||||
window.document.location = $(this).data("href");
|
window.document.location = $(this).data("href");
|
||||||
});
|
});
|
||||||
@@ -74,7 +74,7 @@ $(document).ready(function() {
|
|||||||
var tds = $('table tr td:first-child');
|
var tds = $('table tr td:first-child');
|
||||||
tds.click(function(event){
|
tds.click(function(event){
|
||||||
if (!$(event.target).is('input')) {
|
if (!$(event.target).is('input')) {
|
||||||
var $cb = $('input', this);;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
var $cb = $('input', this);
|
||||||
$cb.click();
|
$cb.click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -104,12 +104,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
$('#select-all').click(function(event){
|
$('#select-all').click(function(event){
|
||||||
var cb = $('input', this);;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
var cb = $('input', this);
|
||||||
if (!$(event.target).is('input')) {
|
if (!$(event.target).is('input')) {
|
||||||
cb.click();
|
cb.click();
|
||||||
}
|
}
|
||||||
$('table tr td:first-child input').each(function(chkbx) {
|
$('table tr td:first-child input').each(function(chkbx) {
|
||||||
row = $(this);;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
row = $(this);
|
||||||
if (row.prop('checked') != cb.prop('checked')){
|
if (row.prop('checked') != cb.prop('checked')){
|
||||||
row.click();
|
row.click();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ def comic_list_json(request, directory_selector=False):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def recent_comics(request):
|
def recent_comics(request):
|
||||||
feed_id = UserMisc.objects.get(user=request.user)
|
feed_id, _ = UserMisc.objects.get_or_create(user=request.user)
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'comic/recent_comics.html',
|
'comic/recent_comics.html',
|
||||||
@@ -261,6 +261,7 @@ def user_add_page(request):
|
|||||||
)
|
)
|
||||||
user.set_password(form.cleaned_data['password'])
|
user.set_password(form.cleaned_data['password'])
|
||||||
user.save()
|
user.save()
|
||||||
|
UserMisc.objects.create(user=user)
|
||||||
success_message = 'User {} created.'.format(user.username)
|
success_message = 'User {} created.'.format(user.username)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ujson
|
||||||
|
django
|
||||||
Reference in New Issue
Block a user