chapeau/things_for_testing/views.py

36 wiersze
1.0 KiB
Python
Czysty Zwykły widok Historia

2018-08-12 13:06:26 +00:00
from django.shortcuts import render
from django_kepi.views import *
from django_kepi.models import *
2018-08-27 17:53:52 +00:00
from things_for_testing.models import *
class ThingUserCollection(CollectionView):
def get_collection_items(self, *args, **kwargs):
return ThingUser.objects.all()
def _stringify_object(self, obj):
return obj.activity
2018-09-01 17:19:48 +00:00
class ThingUserFollowingView(CollectionView):
def get_collection_items(self, *args, **kwargs):
return Activity.objects.filter(
f_type='Accept',
f_actor=ThingUser(name=kwargs['name']),
)
def _stringify_object(self, obj):
return ThingUser.objects.get(actor=obj.following).name
class ThingUserFollowersView(CollectionView):
2018-09-01 17:19:48 +00:00
def get_collection_items(self, *args, **kwargs):
return Activity.objects.filter(
f_type='Accept',
f_object=ThingUser(name=kwargs['name']),
)
2018-09-01 17:19:48 +00:00
def _stringify_object(self, obj):
return ThingUser.objects.get(actor=obj.follower).name