-
-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
enhancement ⭐New feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wanted 🙌Extra attention is neededExtra attention is needed
Description
Currently the implementation of updating the db is almost the same in 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
.
Metadata
Metadata
Assignees
Labels
enhancement ⭐New feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wanted 🙌Extra attention is neededExtra attention is needed