Skip to content

Commit

Permalink
f/#61 Added a Meta class to BaseResource and inherited from it in api…
Browse files Browse the repository at this point in the history
…/resources.py
  • Loading branch information
AndreiDuma committed Mar 24, 2013
1 parent 41a850e commit a8ebf23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions vmc_backend/api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SubmissionResource(BaseResource):
student_id = fields.IntegerField(attribute='student_id')
assignment_id = fields.IntegerField(attribute='assignment_id')

class Meta:
class Meta(BaseResource.Meta):
filtering = {
'assignment_id': ALL,
}
Expand All @@ -24,7 +24,7 @@ class Meta:
class AssignmentResource(BaseResource):
subject_id = fields.IntegerField(attribute='subject_id')

class Meta:
class Meta(BaseResource.Meta):
filtering = {
"subject_id": ALL,
"id": ALL,
Expand All @@ -38,7 +38,7 @@ def determine_format(self, request):

class SubjectResource(BaseResource):

class Meta:
class Meta(BaseResource.Meta):
queryset = Subject.objects.all()
allowed_methods = ['get']

Expand All @@ -47,7 +47,7 @@ class UsersToSubjectsResource(BaseResource):
subject_id = fields.IntegerField(attribute='subject_id')
user_id = fields.IntegerField(attribute='user_id')

class Meta:
class Meta(BaseResource.Meta):
filtering = {
"user_id": ALL,
}
Expand Down
3 changes: 2 additions & 1 deletion vmc_backend/core/base_resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from tastypie.resources import ModelResource

class BaseResource(ModelResource):
pass
class Meta:
pass

0 comments on commit a8ebf23

Please sign in to comment.