Skip to content

Commit a797c41

Browse files
Merge pull request #1007 from scieloorg/beta
Incorporação de códigos estáveis
2 parents 22e983b + 5e02370 commit a797c41

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

docs/dev/journals-api.rst

+5
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ Response:
187187
"study_areas": [
188188
"Biological Sciences"
189189
],
190+
subject_categories: [
191+
"Humanities, Multidisciplinary",
192+
"Social Sciences, Interdisciplinary",
193+
"Sociology"
194+
],
190195
"subject_descriptors": "biologia\nbotanica",
191196
"succeeding_title": null,
192197
"title": "Acta bot\u00c3\u00a1nica mexicana",

scielomanager/api/resources_v1.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
PressReleaseTranslation,
2525
PressReleaseArticle,
2626
Article,
27+
SubjectCategory,
2728
)
2829

2930
from scielomanager.utils import usercontext
@@ -160,14 +161,18 @@ class Meta(ApiKeyAuthMeta):
160161
resource_name = 'collections'
161162
allowed_methods = ['get', ]
162163

164+
class SubjectCategoryResource(ModelResource):
165+
class Meta(ApiKeyAuthMeta):
166+
queryset = SubjectCategory.objects.all()
167+
resource_name = 'subjectcategory'
168+
allowed_methods = ['get', ]
163169

164170
class SponsorResource(ModelResource):
165171
class Meta(ApiKeyAuthMeta):
166172
queryset = Sponsor.objects.all()
167173
resource_name = 'sponsors'
168174
allowed_methods = ['get', ]
169175

170-
171176
class UseLicenseResource(ModelResource):
172177
class Meta(ApiKeyAuthMeta):
173178
queryset = UseLicense.objects.all()
@@ -200,6 +205,7 @@ class JournalResource(ModelResource):
200205
collections = fields.ManyToManyField(CollectionResource, 'collections')
201206
issues = fields.OneToManyField(IssueResource, 'issue_set')
202207
sections = fields.OneToManyField(SectionResource, 'section_set')
208+
subject_categories = fields.ManyToManyField(SubjectCategoryResource, 'subject_categories', readonly=True)
203209
pub_status_history = fields.ListField(readonly=True)
204210
contact = fields.DictField(readonly=True)
205211
study_areas = fields.ListField(readonly=True)
@@ -275,6 +281,10 @@ def dehydrate_languages(self, bundle):
275281
return [language.iso_code
276282
for language in bundle.obj.languages.all()]
277283

284+
def dehydrate_subject_categories(self, bundle):
285+
return [subject_category.term
286+
for subject_category in bundle.obj.subject_categories.all()]
287+
278288
def dehydrate_pub_status_history(self, bundle):
279289
return [{'date': event.since,
280290
'status': event.status}

scielomanager/api/tests_resources_v1.py

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def test_api_v1_datamodel(self):
181181
u'editor_name',
182182
u'other_previous_title',
183183
u'study_areas',
184+
u'subject_categories',
184185
u'medline_code',
185186
u'is_trashed',
186187
u'init_num',

scielomanager/scielomanager/static/js/modal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ $(function() {
33
/* hack to reload ajax content, and avoid caching trap */
44
$('.modal').on('hidden', function() { $(this).removeData(); })
55
$('.modal').on('shown', function () {
6-
$('input').addClass('span12');
7-
$(".chzn-select").chosen({
6+
$(this).find('input').addClass('span12');
7+
$(this).find(".chzn-select").chosen({
88
no_results_text: "{% trans 'No results found for' %}:",
99
width: "100%",
1010
});

scielomanager/validator/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
try:
1010
PACKTOOLS_VERSION = pkg_resources.get_distribution('packtools').version
11-
except DistributionNotFound:
11+
except pkg_resources.DistributionNotFound:
1212
PACKTOOLS_VERSION = None
1313

1414

0 commit comments

Comments
 (0)