+ Added base series.list and series.detail pages (views / urls)
+ Added Publisher.url field + Base ordering for models
This commit is contained in:
parent
b92a79c132
commit
dc3268aec8
|
@ -82,7 +82,7 @@ module.exports = (grunt) ->
|
||||||
options:
|
options:
|
||||||
livereload: true
|
livereload: true
|
||||||
layout:
|
layout:
|
||||||
files: ['shelfzilla/themes/bootflat/templates/**/*.html', 'shelfzilla/themes/bootflat/templates/**/*.jinja']
|
files: ['shelfzilla/themes/**/*.html', 'shelfzilla/themes/**/*.jinja']
|
||||||
tasks: []
|
tasks: []
|
||||||
less:
|
less:
|
||||||
files: ['shelfzilla/themes/bootflat/static/less/*.less']
|
files: ['shelfzilla/themes/bootflat/static/less/*.less']
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from south.utils import datetime_utils as datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
# Adding field 'Publisher.url'
|
||||||
|
db.add_column(u'manga_publisher', 'url',
|
||||||
|
self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True),
|
||||||
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
# Deleting field 'Publisher.url'
|
||||||
|
db.delete_column(u'manga_publisher', 'url')
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
u'manga.publisher': {
|
||||||
|
'Meta': {'ordering': "['name']", 'object_name': 'Publisher'},
|
||||||
|
'for_review': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'for_review_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
|
||||||
|
'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
u'manga.series': {
|
||||||
|
'Meta': {'ordering': "['name']", 'object_name': 'Series'},
|
||||||
|
'for_review': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'for_review_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '40'})
|
||||||
|
},
|
||||||
|
u'manga.volume': {
|
||||||
|
'Meta': {'ordering': "['series__name', 'number']", 'object_name': 'Volume'},
|
||||||
|
'for_review': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'for_review_comment': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||||
|
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'isbn_10': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'isbn_13': ('django.db.models.fields.CharField', [], {'max_length': '13', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'number': ('django.db.models.fields.IntegerField', [], {}),
|
||||||
|
'publisher': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': u"orm['manga.Publisher']"}),
|
||||||
|
'series': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': u"orm['manga.Series']"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['manga']
|
|
@ -6,6 +6,7 @@ from shelfzilla.models import ReviewModel
|
||||||
|
|
||||||
class Publisher(ReviewModel):
|
class Publisher(ReviewModel):
|
||||||
name = models.CharField(_('Name'), max_length=40)
|
name = models.CharField(_('Name'), max_length=40)
|
||||||
|
url = models.URLField(_('URL'), blank=True, null=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'{}'.format(self.name)
|
return u'{}'.format(self.name)
|
||||||
|
@ -15,6 +16,7 @@ class Publisher(ReviewModel):
|
||||||
return self.volumes.distinct('series')
|
return self.volumes.distinct('series')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = ['name']
|
||||||
verbose_name = _('Publisher')
|
verbose_name = _('Publisher')
|
||||||
verbose_name_plural = _('Publishers')
|
verbose_name_plural = _('Publishers')
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ class Series(ReviewModel):
|
||||||
return self.volumes.distinct('publisher')
|
return self.volumes.distinct('publisher')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = ['name']
|
||||||
verbose_name = _('Series')
|
verbose_name = _('Series')
|
||||||
verbose_name_plural = _('Series')
|
verbose_name_plural = _('Series')
|
||||||
|
|
||||||
|
@ -47,5 +50,6 @@ class Volume(ReviewModel):
|
||||||
return u'{} #{}'.format(self.series.name, self.number)
|
return u'{} #{}'.format(self.series.name, self.number)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = ['series__name', 'number']
|
||||||
verbose_name = _('Volume')
|
verbose_name = _('Volume')
|
||||||
verbose_name_plural = _('Volumes')
|
verbose_name_plural = _('Volumes')
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
|
from ..views.series import SeriesListView, SeriesDetailView
|
||||||
|
|
||||||
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
|
url(r'^$', SeriesListView.as_view(), name='series.list'),
|
||||||
|
url(r'^(?P<sid>\d+)/$', SeriesDetailView.as_view(), name='series.detail'),
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
from django.template import RequestContext
|
||||||
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
|
|
||||||
|
from shelfzilla.views import View
|
||||||
|
from ..models import Series
|
||||||
|
|
||||||
|
|
||||||
|
class SeriesView(View):
|
||||||
|
section = 'series'
|
||||||
|
|
||||||
|
|
||||||
|
class SeriesListView(SeriesView):
|
||||||
|
template = 'manga/series/list.html'
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
items = Series.objects.all()
|
||||||
|
context = {
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
|
ctx = RequestContext(request, self.get_context(context))
|
||||||
|
return render_to_response(self.template, context_instance=ctx)
|
||||||
|
|
||||||
|
|
||||||
|
class SeriesDetailView(SeriesView):
|
||||||
|
template = 'manga/series/detail.html'
|
||||||
|
|
||||||
|
def get(self, request, sid):
|
||||||
|
item = get_object_or_404(Series, pk=sid)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'item': item
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = RequestContext(request, self.get_context(context))
|
||||||
|
return render_to_response(self.template, context_instance=ctx)
|
|
@ -7,5 +7,9 @@ class ReviewModel(models.Model):
|
||||||
for_review_comment = models.TextField(
|
for_review_comment = models.TextField(
|
||||||
_('Review comment'), null=True, blank=True)
|
_('Review comment'), null=True, blank=True)
|
||||||
|
|
||||||
|
def first_letter(self):
|
||||||
|
if hasattr(self, 'name'):
|
||||||
|
return self.name and self.name[0] or ''
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
|
@ -13,3 +13,8 @@ DATABASES = {
|
||||||
STATICFILES_DIRS += (
|
STATICFILES_DIRS += (
|
||||||
os.path.join(BASE_DIR, "..", "static_components"),
|
os.path.join(BASE_DIR, "..", "static_components"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Apps
|
||||||
|
INSTALLED_APPS += (
|
||||||
|
'django.contrib.webdesign',
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// jquery vegas, background with opacity
|
// jquery vegas, background with opacity, not overlaying
|
||||||
.vegas-background {
|
.vegas-background {
|
||||||
opacity: .3;
|
opacity: .3;
|
||||||
|
z-index: -200;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bootstrap navbar, margin-top
|
// bootstrap navbar, margin-top
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
body {
|
||||||
|
background-color: rgb(241, 242, 246);
|
||||||
|
}
|
||||||
|
|
||||||
/* Login panel */
|
/* Login panel */
|
||||||
.panel-login {
|
.panel-login {
|
||||||
@height: 180px;
|
@height: 180px;
|
||||||
|
@ -12,3 +16,9 @@
|
||||||
top: 50%;
|
top: 50%;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Alternative behaviours for bootstrap */
|
||||||
|
.panel-title-alt {
|
||||||
|
font-size: 1.75em !important;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li {% if navigation.section == "series" %}class="active"{% endif %}>
|
<li {% if navigation.section == "series" %}class="active"{% endif %}>
|
||||||
<a href="#">{% trans "Series" %}</a>
|
<a href="{% url "series.list" %}">{% trans "Series" %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li {% if navigation.section == "publishers" %}class="active"{% endif %}>
|
<li {% if navigation.section == "publishers" %}class="active"{% endif %}>
|
||||||
<a href="#">{% trans "Publishers" %}</a>
|
<a href="#">{% trans "Publishers" %}</a>
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
{% extends "_layout.html" %}
|
||||||
|
{% load webdesign %}
|
||||||
|
|
||||||
|
{% block main_content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h1 class="panel-title panel-title-alt text-center">{{ item.name }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body text-center">
|
||||||
|
<img src="http://placekitten.com/g/200/300/" />
|
||||||
|
</div>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item">Detail 1</li>
|
||||||
|
<li class="list-group-item">Detail 2</li>
|
||||||
|
<li class="list-group-item">Detail 3</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="well">
|
||||||
|
{% lorem 2 p %}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"><div class="well text-center">Volume</div></div>
|
||||||
|
<div class="col-md-3"><div class="well text-center">Volume</div></div>
|
||||||
|
<div class="col-md-3"><div class="well text-center">Volume</div></div>
|
||||||
|
<div class="col-md-3"><div class="well text-center">Volume</div></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4"><div class="well text-center">Volume</div></div>
|
||||||
|
<div class="col-md-4"><div class="well text-center">Volume</div></div>
|
||||||
|
<div class="col-md-4"><div class="well text-center">Volume</div></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,29 @@
|
||||||
|
{% extends "_layout.html" %}
|
||||||
|
|
||||||
|
{% block main_content %}
|
||||||
|
{% regroup items by first_letter as letter_list %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="pull-right">
|
||||||
|
<ul class="pagination">
|
||||||
|
{% for letter in letter_list %}
|
||||||
|
<li>
|
||||||
|
<a href="#{{ letter.grouper }}">{{ letter.grouper }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
{% for letter in letter_list %}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title" id="{{ letter.grouper }}">{{ letter.grouper }}</h3>
|
||||||
|
</div>
|
||||||
|
<ul class="list-group">
|
||||||
|
{% for item in letter.list %}
|
||||||
|
<li class="list-group-item"><a href="{% url "series.detail" item.pk %}">{{ item.name }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -7,6 +7,7 @@ urlpatterns = patterns(
|
||||||
'',
|
'',
|
||||||
url(r'^', include('shelfzilla.apps.landing.urls')),
|
url(r'^', include('shelfzilla.apps.landing.urls')),
|
||||||
url(r'^', include('shelfzilla.apps.users.urls')),
|
url(r'^', include('shelfzilla.apps.users.urls')),
|
||||||
|
url(r'^series/', include('shelfzilla.apps.manga.urls.series')),
|
||||||
url(r'^$', include('shelfzilla.apps.homepage.urls')),
|
url(r'^$', include('shelfzilla.apps.homepage.urls')),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
from django.views.generic import View as DjangoView
|
||||||
|
|
||||||
|
|
||||||
|
class View(DjangoView):
|
||||||
|
section = None
|
||||||
|
|
||||||
|
def get_context(self, context):
|
||||||
|
if self.section:
|
||||||
|
context['navigation'] = {
|
||||||
|
'section': self.section
|
||||||
|
}
|
||||||
|
|
||||||
|
return context
|
Reference in New Issue