-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates events page. #15
base: master
Are you sure you want to change the base?
Conversation
…nts to organise from the end user
@paurushofficial please list the changes here, also make the title as concise as you can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, but you should fix the suggested changes.
events/forms.py
Outdated
|
||
|
||
class ParticipantForm(ModelForm): | ||
class Meta: | ||
model = EventParticipant | ||
fields = ['title', 'student_name', | ||
'email_id', 'mobile_number', 'roll_no', 'branch'] | ||
|
||
class requestEventForm(ModelForm): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues here :
- You're not following PEP8 conventions here.
- According to PEP8 there should be 2 blank lines after a class.
- Whenever you create class, it should be in caps. eg.
class RequestEventForm(ModelForm)
- Also try to include docstrings in your class/methods.
events/models.py
Outdated
@@ -53,3 +53,13 @@ class EventParticipant(TimeStampedModel): | |||
|
|||
def __str__(self): | |||
return self.student_name | |||
|
|||
class requestEvent(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Here also, In classes, you should follow
CamelCase
notation. - Try to add docstrings to explain what the class/method is doing.
- You can also add docstrings for existing classes/methods.
events/views.py
Outdated
#numberOfEvents = len(events) | ||
#if (numberOfEvents) == 0: | ||
# events = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you left commented code here. You should remove the unused code.
events/views.py
Outdated
def requestEvent(request): | ||
if request.method == 'POST': | ||
form = requestEventForm(request.POST) | ||
if form.is_valid(): | ||
form.save() | ||
your_name = form.cleaned_data.get('your_name') | ||
title = form.cleaned_data.get('title') | ||
messages.success( | ||
request, f'Thank you { your_name } for requesting to organise { title }, you will be contacted shortly!') | ||
return redirect('homepage') | ||
else: | ||
form = requestEventForm() | ||
return render(request, 'event_register.html', {'form': form}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While creating methods, you should not write like this.
Use this notation, def request_event(request):
This pull request introduces 1 alert when merging d0fe5cf into a8904e0 - view on LGTM.com new alerts:
|
@paurushofficial Sorry for being this late on replying to your PR. Could you please share some screenshots so that I can see it's working as expected. |
…nts to organise from the end user