Skip to content

Commit 6ca75e3

Browse files
authored
Merge pull request #21 from biojs/tests
Tests
2 parents 4e0b977 + 28ef986 commit 6ca75e3

File tree

16 files changed

+201
-48
lines changed

16 files changed

+201
-48
lines changed

biojs/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
try:
2727
from config import *
28-
DEBUG = False
28+
DEBUG = DEBUG
2929
except:
30-
DEBUG = True
30+
DEGUB = True
3131

3232
ALLOWED_HOSTS = ['*']
3333

main/management/commands/updatecomponents.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ def handle(self, *args, **options):
115115
_component.license = github_data['license']['name']
116116
except:
117117
pass
118+
try:
119+
str_date = github_data['created_at']
120+
req_date = datetime.strptime(str_date, "%Y-%m-%dT%H:%M:%SZ") #This object is timezone unaware
121+
aware_date = pytz.utc.localize(req_date) #This object is now timezone aware
122+
_component.created_time = aware_date
123+
except:
124+
pass
118125
_component.save()
119126
print str(github_data['contributors_url']) + '?client_id=' + GITHUB_CLIENT_ID + '&client_secret=' + GITHUB_CLIENT_SECRET
120127
contributors_data = get_contributors_data(str(github_data['contributors_url']) + '?client_id=' + GITHUB_CLIENT_ID + '&client_secret=' + GITHUB_CLIENT_SECRET)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.13 on 2018-06-09 08:55
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('main', '0008_auto_20180603_0800'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='component',
17+
name='created_time',
18+
field=models.DateTimeField(null=True),
19+
),
20+
]

main/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Component(models.Model):
2121
name = models.CharField(max_length=100)
2222
stars = models.IntegerField(default=0, null=True)
2323
downloads = models.BigIntegerField(default=0, null=True)
24-
created_time = models.DateTimeField(editable=False, null=True)
24+
created_time = models.DateTimeField(null=True)
2525
modified_time = models.DateTimeField(null=True)
2626
tags = models.ManyToManyField('Tag', null=True)
2727
icon_url = models.URLField(null=True, blank=True)
@@ -43,8 +43,6 @@ class Component(models.Model):
4343
license = models.CharField(max_length=50, null=True)
4444

4545
def save(self, *args, **kwargs):
46-
if not self.id:
47-
self.created_time = timezone.now()
4846
if not self.url_name:
4947
self.url_name = (str(self.name).replace(' ', '-')).replace('/', '-').replace('@','').lower()
5048
return super(Component, self).save(*args, **kwargs)

main/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Meta:
5555
'name',
5656
'stars',
5757
'downloads',
58+
'created_time',
5859
'modified_time',
5960
'tags',
6061
'icon_url',
@@ -65,6 +66,7 @@ class Meta:
6566
'forks',
6667
'watchers',
6768
'no_of_contributors',
69+
'open_issues',
6870
'version',
6971
'author',
7072
'author_email',

main/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ def index(request):
2121

2222
def all_components(request): # requested on_load() for querying
2323
all_components = BaseComponentSerializer(Component.objects.all(), many=True)
24-
print all_components
2524
return JsonResponse({
2625
'all_components':all_components.data,
2726
})
2827

2928
def top_components(request):
3029
top_components = TopComponentSerializer(Component.objects.all().order_by('-downloads')[:10], many=True)
31-
print top_components
3230
return JsonResponse({
3331
'top_components':top_components.data,
3432
})

static/admin/css/base.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,15 @@ p.mini {
187187
margin-top: -3px;
188188
}
189189

190-
.help, p.help, form p.help {
190+
.help, p.help, form p.help, div.help, form div.help, div.help li {
191191
font-size: 11px;
192192
color: #999;
193193
}
194194

195+
div.help ul {
196+
margin-bottom: 0;
197+
}
198+
195199
.help-tooltip {
196200
cursor: help;
197201
}
@@ -410,6 +414,9 @@ input, textarea, select, .form-row p, form .button {
410414
font-weight: normal;
411415
font-size: 13px;
412416
}
417+
.form-row div.help {
418+
padding: 2px 3px;
419+
}
413420

414421
textarea {
415422
vertical-align: top;
@@ -731,7 +738,7 @@ a.deletelink:focus, a.deletelink:hover {
731738

732739
.object-tools a.viewsitelink, .object-tools a.golink,.object-tools a.addlink {
733740
background-repeat: no-repeat;
734-
background-position: 93% center;
741+
background-position: right 7px center;
735742
padding-right: 26px;
736743
}
737744

static/admin/css/changelists.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@
166166
#changelist-filter a {
167167
display: block;
168168
color: #999;
169+
text-overflow: ellipsis;
170+
overflow-x: hidden;
169171
}
170172

171173
#changelist-filter li.selected {

static/admin/css/dashboard.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121

2222
ul.actionlist li {
2323
list-style-type: none;
24-
}
25-
26-
ul.actionlist li {
2724
overflow: hidden;
2825
text-overflow: ellipsis;
2926
-o-text-overflow: ellipsis;

static/admin/css/forms.css

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ form ul.inline li {
8383
height: 26px;
8484
}
8585

86-
.aligned label + p {
86+
.aligned label + p, .aligned label + div.help, .aligned label + div.readonly {
8787
padding: 6px 0;
8888
margin-top: 0;
8989
margin-bottom: 0;
@@ -115,26 +115,32 @@ form .aligned ul.radiolist {
115115
padding: 0;
116116
}
117117

118-
form .aligned p.help {
118+
form .aligned p.help,
119+
form .aligned div.help {
119120
clear: left;
120121
margin-top: 0;
121122
margin-left: 160px;
122123
padding-left: 10px;
123124
}
124125

125-
form .aligned label + p.help {
126+
form .aligned label + p.help,
127+
form .aligned label + div.help {
126128
margin-left: 0;
127129
padding-left: 0;
128130
}
129131

130-
form .aligned p.help:last-child {
132+
form .aligned p.help:last-child,
133+
form .aligned div.help:last-child {
131134
margin-bottom: 0;
132135
padding-bottom: 0;
133136
}
134137

135138
form .aligned input + p.help,
136139
form .aligned textarea + p.help,
137-
form .aligned select + p.help {
140+
form .aligned select + p.help,
141+
form .aligned input + div.help,
142+
form .aligned textarea + div.help,
143+
form .aligned select + div.help {
138144
margin-left: 160px;
139145
padding-left: 10px;
140146
}
@@ -156,15 +162,17 @@ form .aligned table p {
156162
padding: 0 0 5px 5px;
157163
}
158164

159-
.aligned .vCheckboxLabel + p.help {
165+
.aligned .vCheckboxLabel + p.help,
166+
.aligned .vCheckboxLabel + div.help {
160167
margin-top: -4px;
161168
}
162169

163170
.colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField {
164171
width: 610px;
165172
}
166173

167-
.checkbox-row p.help {
174+
.checkbox-row p.help,
175+
.checkbox-row div.help {
168176
margin-left: 0;
169177
padding-left: 0;
170178
}
@@ -180,14 +188,22 @@ fieldset .field-box {
180188
width: 200px;
181189
}
182190

183-
form .wide p, form .wide input + p.help {
191+
form .wide p,
192+
form .wide input + p.help,
193+
form .wide input + div.help {
184194
margin-left: 200px;
185195
}
186196

187-
form .wide p.help {
197+
form .wide p.help,
198+
form .wide div.help {
188199
padding-left: 38px;
189200
}
190201

202+
form div.help ul {
203+
padding-left: 0;
204+
margin-left: 0;
205+
}
206+
191207
.colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField {
192208
width: 450px;
193209
}

0 commit comments

Comments
 (0)