Commit 813f1b5e authored by Alexandre's avatar Alexandre

bugfix: #148

parent 56a81c9e
......@@ -15,14 +15,14 @@ import itertools
Conversation._meta.permission_classes = [ThreadPermission]
User._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'actions', 'created_actions', 'get_full_name', 'userprofile']
User._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'actions', 'active_actions', 'created_actions', 'get_full_name', 'userprofile']
User._meta.rdf_context = {"get_full_name": "rdfs:label"}
User._meta.depth = 1
User._meta.many_depth = 0
User._meta.get_field('username').verbose_name = "Email"
#def active_actions(self):
# return json.dumps(list(self.actions.filter(date__gte=date.today())))
#User.active_actions=active_actions
def active_actions(self):
return json.dumps(list(self.actions.filter(date__gte=date.today())))
User.active_actions=active_actions
class UserProfile(Model):
photo = models.URLField(max_length=9999999, blank=True, verbose_name=u"URL de la photo")
......
......@@ -10,7 +10,7 @@ urlpatterns = [
url(r'^api/quit_action/(?P<pk>\d+)/', views.quit_action, name='quit_action'),
# API:
url(r'^api/users/', LDPViewSet.urls( model=User, fields = ['@id','first_name', 'last_name', 'username', 'email', 'actions', 'created_actions', 'get_full_name', 'userprofile'], nested_fields=['actions', 'created_actions', 'userprofile'], permission_classes=(),)),
url(r'^api/users/', LDPViewSet.urls( model=User, fields = ['@id','first_name', 'last_name', 'username', 'email', 'actions', 'active_actions', 'created_actions', 'get_full_name', 'userprofile'], nested_fields=['actions', 'created_actions', 'userprofile'], permission_classes=(),)),
url(r'^api/active-actions/', ActionViewSet.urls()),
url(r'^api/', include('djangoldp.urls')),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment