AnkitMitraOfficial / AnkitMitraOfficial/StackOverflowClone

Avoid reading request.POST directly

Open
#13 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Avoid reading request.POST directly

```
def contact(request):
if request.method == 'POST':
name = request.POST.get('name')
email = request.POST.get('email')
phone = request.POST.get('phone')
desc = request.POST.get('desc')

```
Source: https://github.com/AnkitMItraOfficial/StackOverFlow-Clone/blob/main/Contact/views.py#L55

Please use a Form. In this case you could use a ModeForm: https://docs.djangoproject.com/en/3.1/topics/forms/modelforms/

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Contact/views.py around line 55 and read the contact view and its related model. Review Django 3.1 ModelForm guidance, then replace the direct request.POST reads with a form-based approach for the contact fields. Done means the view no longer reads request.POST directly and contact submissions still handle the listed fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.