def setUp(self):
        self.title = "Before I turn 80"
        user = User.objects.create_user(
            username="******", first_name="John", last_name="Doe", email="*****@*****.**"
        )
        user.save()
        self.user = user

        bucketlist = Bucketlist(name=self.title, user_id=self.user.id)
        bucketlist.save()
Пример #2
0
 def get_queryset(self):
     """specifies the queryset used for the serialization"""
     q = self.request.GET.get('q', None)
     if q:
         return Bucketlist.search(q)
     return Bucketlist.objects.filter(user=self.request.user)
 def get_queryset(self):
     """specifies the queryset used for the serialization"""
     q = self.request.GET.get('q', None)
     if q:
         return Bucketlist.search(q)
     return Bucketlist.objects.filter(user=self.request.user)