Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9 refactor #48

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions authentication/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from django.conf.urls import patterns, url
from django.conf.urls import url

from .views import user_login, user_logout
from .views import BeneficiaryRegistrationView, DonorRegistrationView


urlpatterns = patterns('',
urlpatterns = [
url(r'^register/donor$', DonorRegistrationView.as_view(), name='donor'),
url(r'^register/beneficiary$',
BeneficiaryRegistrationView.as_view(), name='beneficiary'),
url(r'^login/$', user_login, name='login'),
url(r'^logout/$', user_logout, name='logout'),
)
]
106 changes: 44 additions & 62 deletions books/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,45 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

def forwards(self, orm):
# Adding model 'Publisher'
db.create_table(u'books_publisher', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=200)),
('address', self.gf('django.db.models.fields.CharField')(max_length=150)),
('email', self.gf('django.db.models.fields.EmailField')(max_length=70, unique=True, null=True, blank=True)),
('website', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)),
))
db.send_create_signal(u'books', ['Publisher'])

# Adding model 'Book'
db.create_table(u'books_book', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('publisher', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['books.Publisher'])),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=100)),
('synopsis', self.gf('django.db.models.fields.TextField')(blank=True)),
('cost', self.gf('django.db.models.fields.DecimalField')(default=0.0, max_digits=10, decimal_places=2, blank=True)),
('author', self.gf('django.db.models.fields.CharField')(max_length=100)),
))
db.send_create_signal(u'books', ['Book'])


def backwards(self, orm):
# Deleting model 'Publisher'
db.delete_table(u'books_publisher')

# Deleting model 'Book'
db.delete_table(u'books_book')


models = {
u'books.book': {
'Meta': {'object_name': 'Book'},
'author': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'cost': ('django.db.models.fields.DecimalField', [], {'default': '0.0', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'publisher': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['books.Publisher']"}),
'synopsis': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'books.publisher': {
'Meta': {'object_name': 'Publisher'},
'address': ('django.db.models.fields.CharField', [], {'max_length': '150'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '70', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
}
}

complete_apps = ['books']
# Generated by Django 1.9 on 2016-07-16 07:01
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Book',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(blank=True, null=True, upload_to=b'book_covers/')),
('title', models.CharField(max_length=100)),
('slug', models.SlugField(max_length=150, unique=True)),
('synopsis', models.TextField(blank=True)),
('cost', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=10)),
('author', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Publisher',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('slug', models.SlugField(max_length=150, unique=True)),
('address', models.CharField(max_length=150)),
('email', models.EmailField(blank=True, max_length=70, unique=True)),
('website', models.URLField(blank=True)),
],
),
migrations.AddField(
model_name='book',
name='publisher',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='books.Publisher'),
),
]
44 changes: 0 additions & 44 deletions books/migrations/0002_auto__add_field_book_slug.py

This file was deleted.

45 changes: 0 additions & 45 deletions books/migrations/0003_auto__add_field_publisher_slug.py

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions books/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.conf.urls import patterns, url
from django.conf.urls import url

from .views import BookDetail, BooksbyPubView, PublishersListView, BooksListView


urlpatterns = patterns('',
urlpatterns = [
url(r'^$', BooksListView.as_view(), name='home'),
url(r'^books/$', BooksListView.as_view(), name='listofbooks'),
url(r'^books/(?P<slug>[\w-]+)/$', BookDetail.as_view(), name='book_detail'),
url(r'^publishers/$', PublishersListView.as_view(), name='publishers'),
url(r'^publishers/(?P<slug>[\w-]+)/$', BooksbyPubView.as_view(), name='books_by_pub'),
)
]
2 changes: 1 addition & 1 deletion books/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_queryset(self):

class BookDetail(generic.DetailView):
model = Book
template_name = 'books/books_desc.html'
template_name = 'books/book_detail.html'
context_object_name = 'book'


Expand Down
Loading