Merge branch 'master' of github.com:Gluejar/regluit

Conflicts:
	core/management/commands/random_campaigns.py
pull/1/head
Andromeda Yelton 2011-10-13 12:46:52 -04:00
commit 145c275795
4 changed files with 238 additions and 64 deletions

View File

@ -1,5 +1,6 @@
import json import json
import logging import logging
from xml.etree import ElementTree
import requests import requests
from django.conf import settings from django.conf import settings
@ -55,6 +56,12 @@ def add_by_googlebooks_id(googlebooks_id):
return e return e
def thingisbn(isbn):
url = "http://www.librarything.com/api/thingISBN/%s" % isbn
xml = requests.get(url, headers={"User-Agent": settings.USER_AGENT}).content
doc = ElementTree.fromstring(xml)
return [e.text for e in doc.findall('isbn')]
def _get_json(url, params={}): def _get_json(url, params={}):
# TODO: should X-Forwarded-For change based on the request from client? # TODO: should X-Forwarded-For change based on the request from client?
headers = {'User-Agent': settings.USER_AGENT, headers = {'User-Agent': settings.USER_AGENT,

View File

@ -1,6 +1,7 @@
from decimal import Decimal from decimal import Decimal
from random import randint, randrange from random import randint, randrange
from datetime import datetime, timedelta from datetime import datetime, timedelta
from decimal import Decimal as D
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
@ -19,7 +20,7 @@ class Command(BaseCommand):
campaign.description = "Test Campaign" campaign.description = "Test Campaign"
# random campaign target between $200 and $10,000 # random campaign target between $200 and $10,000
campaign.target = Decimal(str(randint(200,10000))) campaign.target = D(randint(200,10000))
# random deadline between 5 days from now and 180 days from now # random deadline between 5 days from now and 180 days from now
now = datetime.now() now = datetime.now()

View File

@ -10,7 +10,7 @@ from regluit.core.models import Campaign, Work, UnglueitError
from regluit.core import bookloader, models, search from regluit.core import bookloader, models, search
from regluit.payment.parameters import PAYMENT_TYPE_AUTHORIZATION from regluit.payment.parameters import PAYMENT_TYPE_AUTHORIZATION
class TestBooks(TestCase): class TestBookLoader(TestCase):
def test_add_book(self): def test_add_book(self):
# edition # edition
@ -46,6 +46,12 @@ class TestBooks(TestCase):
e = bookloader.add_by_isbn('0139391401') e = bookloader.add_by_isbn('0139391401')
self.assertEqual(e, None) self.assertEqual(e, None)
def test_thingisbn(self):
isbns = bookloader.thingisbn('0441012035')
self.assertTrue(len(isbns) > 20)
self.assertTrue('0441012035' in isbns)
self.assertTrue('3453313895' in isbns)
class SearchTests(TestCase): class SearchTests(TestCase):
def test_basic_search(self): def test_basic_search(self):
@ -136,11 +142,3 @@ class CampaignTests(TestCase):
c5.save() c5.save()
c5.activate().withdraw('testing') c5.activate().withdraw('testing')
self.assertEqual(c5.status, 'WITHDRAWN') self.assertEqual(c5.status, 'WITHDRAWN')
def suite():
testcases = [TestBooks, SearchTests, CampaignTests]
suites = unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(testcase) for testcase in testcases])
return suites

View File

@ -6,7 +6,7 @@
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
font-size: 13px; font-size: 13px;
letter-spacing: 1px; letter-spacing: -0.05em;
text-transform: capitalize; text-transform: capitalize;
} }
.panelborders { .panelborders {
@ -20,7 +20,7 @@ div.book-list {
vertical-align: middle; vertical-align: middle;
height: 43px; height: 43px;
line-height: 43px; line-height: 43px;
margin: 0 5px 0px 0; margin: 0 5px 0 0;
padding: 7px 0; padding: 7px 0;
overflow: hidden; overflow: hidden;
} }
@ -49,14 +49,13 @@ div.book-list div.book-name span {
height: 43px; height: 43px;
line-height: 43px; line-height: 43px;
} }
div.book-list div.add-wishlist, div.book-list div.remove-wishlist { div.book-list div.add-wishlist {
margin-right: 10px; margin-right: 10px;
padding-right: 10px; padding-right: 10px;
background: url("/static/images/booklist/booklist-vline.png") right center no-repeat; background: url("/static/images/booklist/booklist-vline.png") right center no-repeat;
cursor: pointer;
float: left; float: left;
} }
div.book-list div.add-wishlist span, div.book-list div.remove-wishlist span { div.book-list div.add-wishlist a {
font-weight: normal; font-weight: normal;
color: #3d4e53; color: #3d4e53;
text-transform: none; text-transform: none;
@ -90,6 +89,7 @@ div.unglue-this.complete .unglue-this-inner2 {
} }
div.unglue-this.complete a { div.unglue-this.complete a {
color: #fff; color: #fff;
display: block;
} }
div.unglue-this.processing .unglue-this-inner1 { div.unglue-this.processing .unglue-this-inner1 {
background: url("/static/images/booklist/bg.png") 0 0 no-repeat; background: url("/static/images/booklist/bg.png") 0 0 no-repeat;
@ -162,7 +162,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
} }
.book_panel { .book_panel {
margin: 20px auto; margin: 20px auto;
padding: 0px 5px 5px 5px; padding: 0 5px 5px 5px;
height: 300px; height: 300px;
width: 120px; width: 120px;
line-height: 16px; line-height: 16px;
@ -183,8 +183,8 @@ ul.navigation li a:hover, ul.navigation li.active a {
margin: 0; margin: 0;
} }
.book_panel img { .book_panel img {
padding: 5px 0px; padding: 5px 0;
margin: 0px; margin: 0;
} }
.book_panel:hover { .book_panel:hover {
color: #3d4e53; color: #3d4e53;
@ -194,7 +194,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
text-align: left; text-align: left;
} }
.book_panel_back { .book_panel_back {
margin: 0px auto; margin: 0 auto;
padding: 10px; padding: 10px;
height: 295px; height: 295px;
width: 120px; width: 120px;
@ -208,9 +208,9 @@ ul.navigation li a:hover, ul.navigation li.active a {
font-weight: normal; font-weight: normal;
} }
.unglued_white { .unglued_white {
margin: 0px auto; margin: 0 auto;
margin-bottom: 5px; margin-bottom: 5px;
padding: 10px 0px; padding: 10px 0;
} }
.status { .status {
color: #8dc63f; color: #8dc63f;
@ -219,12 +219,12 @@ ul.navigation li a:hover, ul.navigation li.active a {
.read_itbutton { .read_itbutton {
width: 118px; width: 118px;
height: 35px; height: 35px;
padding: 0px 0px; padding: 0 0;
background: #FFFFFF; background: #FFFFFF;
margin: 0px; margin: 0;
border-radius: 4px 4px 4px 4px;
-moz-border-radius: 4px 4px 4px 4px; -moz-border-radius: 4px 4px 4px 4px;
-webkit-border-radius: 4px 4px 4px 4px; -webkit-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
border: 1px solid #81bb38; border: 1px solid #81bb38;
} }
.read_itbutton a { .read_itbutton a {
@ -232,7 +232,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
font-size: 11px; font-size: 11px;
background: url("/static/images/book-panel/book_icon.png") no-repeat left center; background: url("/static/images/book-panel/book_icon.png") no-repeat left center;
background-position: 10px center; background-position: 10px center;
padding: 0px 0px 0px 30px; padding: 0 0 0 30px;
color: #73a334; color: #73a334;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
@ -244,7 +244,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
#add_towish { #add_towish {
width: 130px; width: 130px;
height: 30px; height: 30px;
padding: 0px 0px; padding: 0 0;
margin: 10px auto; margin: 10px auto;
} }
#add_towish a { #add_towish a {
@ -267,8 +267,8 @@ ul.navigation li a:hover, ul.navigation li.active a {
#white_text { #white_text {
width: 130px; width: 130px;
height: 40px; height: 40px;
padding: 17px 0px; padding: 17px 0;
margin: 0px; margin: 0;
} }
#white_text a { #white_text a {
color: #FFFFFF; color: #FFFFFF;
@ -281,7 +281,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
#moreinfo { #moreinfo {
width: 130px; width: 130px;
height: 30px; height: 30px;
padding: 0px; padding: 0;
margin: 15px 0 0; margin: 15px 0 0;
} }
#moreinfo a { #moreinfo a {
@ -312,7 +312,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
} }
.read { .read {
margin: 15px auto; margin: 15px auto;
padding: 0px; padding: 0;
width: 140px; width: 140px;
color: #8dc63f; color: #8dc63f;
height: 40px; height: 40px;
@ -320,7 +320,7 @@ ul.navigation li a:hover, ul.navigation li.active a {
float: left; float: left;
} }
.read p { .read p {
margin: 0px; margin: 0;
padding: 10px 3px; padding: 10px 3px;
width: 50px; width: 50px;
font-size: 10pt; font-size: 10pt;
@ -328,12 +328,12 @@ ul.navigation li a:hover, ul.navigation li.active a {
} }
.read img { .read img {
padding: 5px; padding: 5px;
margin: 0px; margin: 0;
float: left; float: left;
} }
.right_add { .right_add {
padding: 10px; padding: 10px;
margin: 0px; margin: 0;
float: right; float: right;
} }
p.right_add { p.right_add {
@ -345,9 +345,9 @@ p.right_add {
.book_panel_interior { .book_panel_interior {
float: left; float: left;
position: relative; position: relative;
margin: 0px; margin: 0;
padding: 0px; padding: 0;
left: 0px; left: 0;
} }
.book_panel_interior img { .book_panel_interior img {
z-index: 100; z-index: 100;
@ -371,7 +371,7 @@ body {
img { img {
border: none; border: none;
} }
h2 .content-heading { h2.content-heading {
padding: 15px; padding: 15px;
margin: 0; margin: 0;
font-size: 19px; font-size: 19px;
@ -380,17 +380,17 @@ h2 .content-heading {
float: left; float: left;
width: 50%; width: 50%;
} }
h2 .content-heading span { h2.content-heading span {
font-style: italic; font-style: italic;
} }
h3 .jsmod-title { h3.jsmod-title {
background: url("/static/images/bg.png") 0 0 no-repeat; background: url("/static/images/bg.png") 0 0 no-repeat;
padding: 0; padding: 0;
margin: 0; margin: 0;
height: 73px; height: 73px;
} }
h3 .jsmod-title span { h3.jsmod-title span {
background: url(../images/icon-h3.png) 90% center no-repeat; background: url("/static/images/icon-h3.png") 90% center no-repeat;
font-size: 17px; font-size: 17px;
color: #fff; color: #fff;
padding: 26px 40px 27px 20px; padding: 26px 40px 27px 20px;
@ -400,7 +400,6 @@ ul.menu {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
line-height: 20px;
} }
a.readon { a.readon {
background: url("/static/images/bg.png") 100% -72px no-repeat; background: url("/static/images/bg.png") 100% -72px no-repeat;
@ -436,7 +435,7 @@ a {
} }
.js-logo { .js-logo {
float: left; float: left;
padding-top: 20px; padding-top: 10px;
} }
.js-logo a img { .js-logo a img {
border: none; border: none;
@ -450,25 +449,25 @@ a {
padding: 0 10px; padding: 0 10px;
} }
.js-topmenu ul li a { .js-topmenu ul li a {
color: #fff; color: #3d4e53;
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
display: block; display: block;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
font-size: 13px; font-size: 13px;
letter-spacing: 1px; letter-spacing: -0.05em;
text-transform: capitalize; text-transform: capitalize;
} }
.js-topmenu ul li span#welcome { .js-topmenu ul li span#welcome {
color: yellow; color: #8dc63f;
height: 36px; height: 36px;
line-height: 36px; line-height: 36px;
display: block; display: block;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
font-size: 13px; font-size: 13px;
letter-spacing: 1px; letter-spacing: -0.05em;
text-transform: capitalize; text-transform: capitalize;
} }
.js-topmenu ul lilast a { .js-topmenu ul lilast a {
@ -486,23 +485,27 @@ a {
} }
.js-topnews { .js-topnews {
float: left; float: left;
width: 60%; width: 100%;
} }
.js-news-text { .js-topnews1 {
float: left; background: url("/static/images/header/header-m.png") 0 0 repeat-y;
width: 70%;
font-size: 16px;
color: #3d4e53;
} }
.js-news-links { .js-topnews2 {
float: right; background: url("/static/images/header/header-t.png") 0 0 no-repeat;
width: 30%; }
.js-topnews3 {
background: url("/static/images/header/header-b.png") 0 100% no-repeat;
display: block;
overflow: hidden;
padding: 10px;
} }
.js-search { .js-search {
width: 960px; float: right;
margin: 0 auto; width: 30%;
clear: both; padding-top: 25px;
padding: 0; }
.js-search input {
float: left;
} }
.js-search .inputbox { .js-search .inputbox {
padding: 0 0 0 15px; padding: 0 0 0 15px;
@ -527,7 +530,7 @@ a {
cursor: pointer; cursor: pointer;
} }
.js-search-inner { .js-search-inner {
margin: 0 auto; float: right;
} }
#js-leftcol { #js-leftcol {
float: left; float: left;
@ -542,9 +545,9 @@ a {
#js-leftcol .jsmod-content { #js-leftcol .jsmod-content {
border: 1px solid #edf3f4; border: 1px solid #edf3f4;
margin-left: 10px; margin-left: 10px;
border-radius: 0 0 10px 10px;
-moz-border-radius: 0 0 10px 10px; -moz-border-radius: 0 0 10px 10px;
-webkit-border-radius: 0 0 10px 10px; -webkit-border-radius: 0 0 10px 10px;
border-radius: 0 0 10px 10px;
} }
#js-leftcol ul.level1 > li > a { #js-leftcol ul.level1 > li > a {
text-transform: uppercase; text-transform: uppercase;
@ -560,10 +563,9 @@ a {
} }
#js-leftcol ul.level2 li a { #js-leftcol ul.level2 li a {
color: #6994a3; color: #6994a3;
line-height: 20px;
} }
#js-maincol-fr { #js-maincol-fr {
float: left; float: right;
width: 725px; width: 725px;
} }
div.content-block { div.content-block {
@ -611,3 +613,169 @@ div.content-block-content .cols3 .column {
margin-right: auto; margin-right: auto;
padding: 5px 15px; padding: 5px 15px;
} }
.block-inner {
padding-right: 10px;
}
.user-block {
width: 100%;
clear: both;
}
.user-block-hide {
float: left;
width: 100%;
clear: both;
}
.user-block-hide .block {
float: left;
width: 25%;
}
.user-block-hide input {
float: left;
margin: 3px 10px 0 0;
}
.user-block-hide label {
float: left;
width: 90%;
}
.user-block1 {
float: left;
width: 25%;
}
.user-block2 {
color: #6994a3;
font-size: 11px;
line-height: normal;
float: left;
width: 25%;
}
.user-block3, .user-block4 {
float: right;
width: 25%;
margin-top: 10px;
}
img.user-avatar {
float: left;
margin-right: 10px;
}
.social {
width: 100%;
padding-left: 35px;
}
span.user-name, span.user-date, span.user-short-info {
display: block;
}
span.user-name, span.user-name a, a {
font-size: 12px;
color: #3d4e53;
}
span.user-status-title {
float: left;
margin-right: 8px;
padding-top: 5px;
}
span.rounded {
border: 1px solid #d4d4d4;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
padding: 1px;
color: #fff;
margin: 0 8px 0 0;
display: inline-block;
}
span.rounded > span {
padding: 7px 10px;
min-width: 15px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
text-align: center;
display: inline-block;
}
span.blue {
background: #a7d26a url("/static/images/header-button-blue.png") left bottom repeat-x;
}
span.orange {
background: #eabc7c url("/static/images/header-button-orange.png") left bottom repeat-x;
}
span.grey {
background: #bacfd6 url("/static/images/header-button-grey.png") left bottom repeat-x;
}
div.check-list {
float: left;
width: 100%;
padding-bottom: 7px;
}
a.profile-edit {
display: block;
background: url("/static/images/header/icon-edit.png") right top no-repeat;
}
div.profile-save {
padding-top: 15px;
}
a.profile-save {
background: url("/static/images/header/save-setting.png") 0 0 no-repeat;
width: 116px;
height: 42px;
display: block;
text-indent: -100000px;
}
a.my-setting {
background: #d6dde0 url("/static/images/header/explane.png") 90% center no-repeat;
border-radius: 7px;
height: 50px;
line-height: 50px;
display: block;
padding: 0 0 0 10px;
font-size: 20px;
}
a.my-setting.active {
background: #d6dde0 url("/static/images/header/collspane.png") 90% center no-repeat;
}
#tabs {
border-bottom: 4px solid #8DC63F;
clear: both;
float: left;
margin-left: 10px;
margin-top: 10px;
width: 100%;
}
#tabs ul.book-list-view {
margin-bottom: 4px !important;
}
#tabs-1, #tabs-2, #tabs-3 {
margin-left: 10px;
}
ul.tabs {
float: left;
padding: 0;
margin: 0;
list-style: none;
}
ul.tabs li {
float: left;
height: 46px;
line-height: 46px;
margin-right: 10px;
}
ul.tabs li a {
height: 46px;
line-height: 46px;
display: block;
text-align: center;
padding: 0 10px;
min-width: 80px;
border-radius: 7px 7px 0 0;
background: url("/static/images/header/bg-tabs1.png") left bottom repeat-x;
}
ul.tabs li a:hover, ul.tabs li.active a {
background: url("/static/images/header/bg-tabs.png") left bottom repeat-x;
color: #fff;
}
.book-list span.rounded > span {
line-height: normal;
width: 75px;
}
.book-list span.rounded > span a {
text-transform: capitalize;
}