Orack
and generics.ListCreateAPIView
Orack
in views.py
pvs
How to schedule web scraper script trigger on specific time in django
Sander
Orack
class CreateView(generics.ListCreateAPIView):
queryset = Bucketlist.objects.all()
serializer_class = BucketlistSerializer
def perform_create(self, serializer):
serializer.save()
class GroupViewSet(viewsets.ModelViewSet):
queryset = StickerData.objects.all()
serializer_class = StickerDataSerializer
Orack
this is confusing
Orack
can anyone link to explaination other than documentation
Shiva
How to check Django version
Anonymous
Anonymous
hi how can i export a data base table to csv file?
Yash
Anonymous
Hello can I use scrapy with Django
cj
Anonymous
Sander
Anonymous
how to backup django psql db
cj
just like any other PostgreSQL DB 🤷♂️
Orack
class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Snippet.objects.all()
serializer_class = SnippetSerializer
Orack
how does it know that im referring which number
Orack
say localhost/users/2
Orack
2 can be userid,
2 can also be a value of x=2
Omair
Hi I am trying to get Stacked In line implemented on a set of foreign keys
Omair
This is the model https://pastebin.com/CjSz41uB
Orack
and Model class has both userid and x as variables
Muflone
Orack
or primary key ?
Omair
As a single tournament can have a set of (categeory, its price, event_type)
Muflone
pk is an alias for the primary Key field
Orack
Orack
then how do we put queries like
Orack
select all instances where scoreof_x=2
Orack
scoreof_x is not pk in my case
Muflone
Describe your models
Orack
Orack
https://del.dog/cudapeneno.py
Muflone
What you want to extract?
Orack
same sticker_title
Orack
or same userid
Orack
wtf
Orack
posting image banned here ;-;
Muflone
You want all StickersData with a specific sticker_title value?
Orack
Muflone
StickersData.objects.filter(sticker_title='something')
Orack
Oo
Orack
Orack
getting this
Orack
url('^stickerlists/<str:title>',CreateViewSticker.as_view() , name = "createsticker"),
url pattern is this
Muflone
Hmm DRF, I don't know it enough
Orack
Omair
It can be handled via request and overriding the get_queryset method
Orack
Orack
queryset=request.query_params.get('title')
Orack
i googled this but no module named request
Rohan
Uhmmm, you pass request object in the get method of your APIView class
Omair
and using requests ?
You already defined title in your url pattern and you are using a generics class so request is not needed
Rohan
Yes, you'll be getting that as an argument when you link that class as views to your url
Orack
Orack
what dos this mean
Orack
(?P<subject_teacher>\d+)$',
Omair
Alibek
Hello, there. I have a question. I have serailizers, called BoardSerializer, TaskSerializer and JobSerializer, where the main entity is BoardSerializer. It contains (e.g. nested) TaskSerializer. In TaskSerializer there is JobSerializer . So on retrieve of BoardViewSet my context is lost. I use SerializerMethodField, where I make relational stuff with their models
Orack
Muflone
Just use two different url map
Muflone
Pointing to the same view
Orack
and why in some cases we pass like <str:title>
Orack
Muflone
Not really different, in the first case you match a whole argument, in the second case you use a regex to catch an argument
Muflone
If you had complex arguments like /2-something_20190630
Muflone
It would require you to use regex
Muflone
Using optional parameters within the view
Orack