broken
This commit is contained in:
parent
a7e33a9f10
commit
7f25dcf95c
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
@ -0,0 +1,5 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class FrontendConfig(AppConfig):
|
||||||
|
name = 'frontend'
|
@ -0,0 +1,10 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Attachment(models.Model):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Post(models.Model):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Board(models.Model):
|
||||||
|
pass
|
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
14
contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py
Normal file
14
contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^ctl-(?P<page>[0-9])\.html$', views.modlog, name='old-modlog'),
|
||||||
|
url(r'^ctl/((?P<page>[0-9])/)?$', views.modlog, name='modlog'),
|
||||||
|
url(r'^overchan\.(?P<name>[a-zA-z0-9\.]+)-(?P<page>[0-9])\.html$', views.boardpage, name='old-board'),
|
||||||
|
url(r'^(?P<name>[a-zA-z0-9\.]+)/((?P<page>[0-9])/)?$', views.boardpage, name='board'),
|
||||||
|
url(r'^thread-(?P<op>[a-fA-F0-9\.]{40})\.html$', views.threadpage, name='old-thread'),
|
||||||
|
url(r'^t/(?P<op>[a-fA-F0-9\.]{40})\.html$', views.redirect_thread, name='redirect-thread'),
|
||||||
|
url(r'^t/(?P<op>[a-fA-F0-9\.]{40})/$', views.threadpage, name='thread'),
|
||||||
|
url(r'^$', views.frontpage, name='index'),
|
||||||
|
]
|
34
contrib/frontends/django/nntpchan/nntpchan/frontend/views.py
Normal file
34
contrib/frontends/django/nntpchan/nntpchan/frontend/views.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.views import generic
|
||||||
|
|
||||||
|
from .models import Post, Board
|
||||||
|
|
||||||
|
class IndexView(generic.DetailView):
|
||||||
|
template_name = 'frontend/index.html'
|
||||||
|
|
||||||
|
class BoardView(generic.ListView):
|
||||||
|
template_name = 'frontend/board.html'
|
||||||
|
|
||||||
|
class ThreadView(generic.ListView):
|
||||||
|
template_name = 'frontend/thread.html'
|
||||||
|
|
||||||
|
def frontpage(request):
|
||||||
|
return HttpResponse('ayyyy')
|
||||||
|
|
||||||
|
def boardpage(request, name, page):
|
||||||
|
if page is None:
|
||||||
|
page = 0
|
||||||
|
name = 'overchan.{}'.format(name)
|
||||||
|
return HttpResponse('{} page {}'.format(name, page))
|
||||||
|
|
||||||
|
def threadpage(request, op):
|
||||||
|
return HttpResponse('thread {}'.format(op))
|
||||||
|
|
||||||
|
def redirect_thread(request, op):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def modlog(request, page):
|
||||||
|
if page is None:
|
||||||
|
page = 0
|
||||||
|
return HttpResponse('mod log page {}'.format(page))
|
@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
|
|||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'nntpchan.frontend.apps.FrontendConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
@ -13,9 +13,8 @@ Including another URLconf
|
|||||||
1. Import the include() function: from django.conf.urls import url, include
|
1. Import the include() function: from django.conf.urls import url, include
|
||||||
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^nntpchan/', include('nntpchan.frontend.urls'))
|
||||||
]
|
]
|
||||||
|
4
contrib/frontends/django/nntpchan/nntpchan/views.py
Normal file
4
contrib/frontends/django/nntpchan/nntpchan/views.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
return HttpResponse('ayyyyy')
|
@ -1,4 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# entry point for c++ frontend
|
||||||
|
#
|
||||||
|
|
||||||
from nntpchan import message
|
from nntpchan import message
|
||||||
from nntpchan import db
|
from nntpchan import db
|
||||||
import logging
|
import logging
|
||||||
|
@ -1 +1,6 @@
|
|||||||
|
#
|
||||||
|
# entry for gunicorn
|
||||||
|
#
|
||||||
|
|
||||||
|
from nntpchan.app import app
|
||||||
|
from nntpchan import viewsp
|
||||||
|
@ -17,7 +17,7 @@ onready(function(){
|
|||||||
var e = document.getElementById("captcha_img");
|
var e = document.getElementById("captcha_img");
|
||||||
if (e) {
|
if (e) {
|
||||||
e.onclick = function() {
|
e.onclick = function() {
|
||||||
reload(document.getElementById("captcha_img"));
|
reload(e);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user