Open Bhupesh-V opened 5 years ago
Currently the implementation of updating the db is almost the same in app & api
app
api
def post(self, request): linkCount = tutorial.objects.filter(link = request.POST['tlink']).count() if linkCount == 0: tags, title = generateTags(request.POST['tlink']) if 'other' in tags: return render(request, 'contribute.html', {'error': "Not a Tutorial Link, Try Again"}) else: tutorialObject = tutorial.objects.create( title = title, link = request.POST['tlink'], category = request.POST['tcategory'] ) for t in tags: obj, created = tag.objects.get_or_create(name=t) tagObjList = tag.objects.filter(name__in = tags) tutorialObject.tags.set(tagObjList)
A possible solution is to shift this post method in serializers.py.
serializers.py
Please check my PR for that issue. https://github.com/Bhupesh-V/tutorialdb/pull/73
Currently the implementation of updating the db is almost the same in
app
&api
A possible solution is to shift this post method in
serializers.py
.