Skip to content

Commit 33a2044

Browse files
authored
Upgrade Python + Django (#69)
1 parent 202e5c2 commit 33a2044

40 files changed

+1960
-259
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ dbdb_io/settings.py
2121
media
2222
.env
2323
static-live
24-
data/xapian
24+
25+
data/db.sqlite3.*
26+
data/xapian

.travis.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ language: python
22
python:
33
- "3.6"
44
install:
5-
- mkdir -p media/logos media/twitter
6-
- sudo apt-get install python3-sphinx
7-
- pip3 install Sphinx
8-
- ./install_xapian.sh 1.4.9
9-
- pip install git+https://github.com/notanumber/xapian-haystack.git
105
- mkdir -p data/xapian
6+
- mkdir -p media/logos
7+
- mkdir -p media/twitter
8+
- pip3 install -U pip setuptools wheel
9+
- ./bin/install_xapian.sh 1.4.16
1110
- pip3 install -r requirements.txt
1211
- pip3 install -r requirements-test.txt
1312
before_script:
1413
- python manage.py migrate
15-
1614
script:
1715
- python manage.py test
18-

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
[![Build Status](https://travis-ci.org/cmu-db/dbdb.io.svg?branch=master)](https://travis-ci.org/cmu-db/dbdb.io)
22

3-
Database of Databases
4-
=====================
3+
# Database of Databases
4+
5+
## Installation
6+
Assumes installation within a virtual directory
7+
8+
1. `pip install -U pip setuptools`
9+
2. `./bin/install_xapian.sh 1.4.14`
10+
3. `pip install -U -r requirements.txt`
511

File renamed without changes.

dbdb/core/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class SystemVersionAdmin(admin.ModelAdmin):
4545
list_display = ('system', 'ver', 'creator', 'created')
4646
list_filter = ['created', 'system']
4747
readonly_fields=('ver', )
48-
48+
4949
class SystemACLAdmin(admin.ModelAdmin):
5050
list_display = ('system', 'user', 'created', 'modified')
5151
list_filter = ['created']
5252
readonly_fields=('created', 'modified')
53-
53+
5454
class SystemRecommendationAdmin(admin.ModelAdmin):
5555
list_display = ('system', 'recommendation', 'score', 'created')
5656
list_filter = ['created', 'system']

dbdb/core/forms.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def clean(self, value):
4949
cit_url, _ = CitationUrl.objects.get_or_create(url=url)
5050
url_objs.append(cit_url)
5151
return url_objs
52-
52+
5353
pass
5454

5555

@@ -132,13 +132,13 @@ def __init__(self, *args, **kwargs):
132132
initial=initial_cit,
133133
required=False
134134
)
135-
135+
136136
self.fields[feature.label+'_choices'].feature_id = feature.id
137137
self.fields[feature.label+'_description'].feature_id = feature.id
138138
self.fields[feature.label+'_citation'].feature_id = feature.id
139139
pass
140140
return
141-
141+
142142
pass
143143

144144

@@ -191,11 +191,11 @@ class SystemForm(forms.ModelForm):
191191

192192
# This is only shown to non-superusers
193193
orig_name = forms.CharField(max_length=128, label="Name", disabled=True, required=False)
194-
194+
195195
class Meta:
196196
model = System
197197
fields = ['name','orig_name']
198-
198+
199199
pass
200200

201201
class SystemVersionEditForm(forms.ModelForm):
@@ -220,7 +220,7 @@ class SystemVersionEditForm(forms.ModelForm):
220220
help_text="Separate the urls with commas",
221221
required=False
222222
)
223-
223+
224224
class Meta:
225225
model = SystemVersion
226226
fields = [
@@ -245,7 +245,7 @@ class Meta:
245245
'former_names',
246246
'comment'
247247
]
248-
248+
249249
pass
250250

251251
class SystemVersionForm(forms.ModelForm):

dbdb/core/management/commands/compute_score.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ def handle(self, *args, **options):
2424
meta_fields = set(meta_fields) - set([
2525
"systemversion",
2626
])
27-
28-
27+
28+
2929
for ver in SystemVersion.objects.filter(is_current=True):
3030
print(ver)
3131
score = 0
32-
32+
3333
for field in sorted(version_fields):
3434
val = getattr(ver, field)
3535
if field.endswith("_citations"):
3636
print(" +", field, "=>", val)
3737
score += self.CITATION_REWARD
38-
38+
3939
elif not val is None and val != '':
4040
score += self.FIELD_REWARD
4141
print(" +", field)
4242
# FOR
43-
43+
4444
for field in sorted(meta_fields):
4545
val = getattr(ver.meta, field)
4646
if not val is None and val != '':

dbdb/core/management/commands/create_twitter_cards.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from dbdb.core.views import EmptyFieldsView
1515

1616
class Command(BaseCommand):
17-
17+
1818
def add_arguments(self, parser):
1919
parser.add_argument('--system', type=str)
2020
parser.add_argument('--missing', action='store_true')
@@ -23,22 +23,22 @@ def add_arguments(self, parser):
2323
def handle(self, *args, **options):
2424
template = os.path.join(settings.BASE_DIR, "static", settings.TWITTER_CARD_TEMPLATE)
2525
assert os.path.exists(template), "Missing: " + template
26-
26+
2727
versions = SystemVersion.objects.filter(is_current=True)
2828
if options['system']:
2929
keyword = options['system']
30-
30+
3131
if keyword.isdigit():
3232
versions = versions.filter(system__id=int(keyword))
3333
else:
3434
versions = versions.filter(system__name__icontains=keyword)
35-
35+
3636
for ver in versions:
3737
card_img = os.path.join(settings.TWITTER_CARD_ROOT, ver.get_twitter_card_image())
3838
if options['missing'] and os.path.exists(card_img): continue
3939
ver.create_twitter_card()
4040
self.stdout.write("%s -> %s" % (ver.system.name, card_img))
41-
41+
4242
# FOR
4343
return
4444

dbdb/core/management/commands/fix_acls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def handle(self, *args, **options):
1515
User = get_user_model()
1616
for user in User.objects.all():
1717
if user.username == "developer" or user.is_superuser: continue
18-
18+
1919
systems = set()
2020
# Find what systems this user has editted
2121
for ver in SystemVersion.objects.filter(creator=user):

dbdb/core/management/commands/load_initial_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Command(BaseCommand):
2626

2727
help = '''Creates a fixture based on the files on initial_data folder
2828
This should be run only for a newly created system deployment and if there's no better database dump to apply.
29-
29+
3030
Please be sure you have a databasees.csv file in initial_data folder along with spring2017 and spring2016
3131
'''
3232

@@ -39,7 +39,7 @@ def handle(self, *args, **options):
3939
path_csv = os.path.join(settings.BASE_DIR, 'data', 'initial_data', 'databases.csv')
4040
path_sp2016 = os.path.join(settings.BASE_DIR, 'data', 'initial_data', 'spring2016')
4141
path_sp2017 = os.path.join(settings.BASE_DIR, 'data', 'initial_data', 'spring2017')
42-
42+
4343
with transaction.atomic():
4444
# create initial account
4545
User = get_user_model()

0 commit comments

Comments
 (0)