django insert data into database foreign key view py

Solutions on MaxInterview for django insert data into database foreign key view py by the best coders in the world

showing results for - "django insert data into database foreign key view py"
Célestin
11 Oct 2019
1for i in range(1,10):
2        obj = Count.objects.filter(userId=request.user.id, channelId=cid)
3        if not obj:
4            news_obj = News_Channel.objects.get(id=i)
5            o = Count.objects.create(id=Count.objects.all().count() + 1,userId=request.user.id, channelId=news_obj,rate=0)
6            o.save()
7        i += 1