Skip to content
This repository was archived by the owner on Jan 26, 2021. It is now read-only.

Migrated Events app to CBV #364

Merged

Conversation

amruthasangeeth
Copy link
Contributor

@amruthasangeeth amruthasangeeth commented Jul 29, 2016

Migrated function based views in Events app to class based views. The following are the views used:
ListView - To list the Events
UpdateView - To edit the Event details
DeleteView - To delete a Event object
#288.

@tapaswenipathak
Copy link
Contributor

tapaswenipathak commented Jul 30, 2016

@amruthasangeeth Travis is throwing errors, can you please fix them?

AIL: test_edit_event_with_invalid_job_date (administrator.tests.test_settings.Settings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/systers/vms/vms/administrator/tests/test_settings.py", line 689, in test_edit_event_with_invalid_job_date
    self.settings_page)
AssertionError: u'http://localhost:8081/event/list/' == u'http://localhost:8081/event/list/'

This failure is present in your other pull requests as well, @smarshy found out that the value should not be same to pass this assertion.

Let us know if you are not able to resolve the errors.

cc @nida @nidhimj22.

@amruthasangeeth amruthasangeeth force-pushed the ShiftEventsToCBV branch 5 times, most recently from 86f63fe to 0b14da1 Compare August 1, 2016 19:06
@amruthasangeeth
Copy link
Contributor Author

amruthasangeeth commented Aug 1, 2016

@smarshy Can you spot the error it is showing in test? I am not able to find it.

@smarshy
Copy link
Contributor

smarshy commented Aug 2, 2016

@amruthasangeeth On editing event, it isn't getting saved. Also, you are having same value retention problem as in the jobs pr. What that means is that if the form gets refreshed / reloaded for some reason ( say invalid values entered) the values that the user has already entered shouldn't vanish.

),
],
blank=True,
null=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amruthasangeeth Are there any changes in this model?
I can spot only the autoincrement one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarshy Only the id is the new one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amruthasangeeth Complete file is coming as diff, it is really difficult to review. Can you please undo the unnecessary changes (cleanups, spacing)?

@tapaswenipathak
Copy link
Contributor

@amruthasangeeth Please fix the errors in this and all the consecutive pull requests.

@smarshy
Copy link
Contributor

smarshy commented Aug 9, 2016

@amruthasangeeth This has less errors - both are related to edit event. Please try testing this locally. Edit an event with valid details and check if it gets saved.

Also, the second error is due to this

Here, since the end date is not wrong, it isn't expected to be erased. Since the same error did not take place for create event, I think this too is related to edit event

@amruthasangeeth amruthasangeeth force-pushed the ShiftEventsToCBV branch 2 times, most recently from d7556ca to b1d01d0 Compare August 10, 2016 19:23
@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.3% when pulling b1d01d01d8dfc280b947f03923b251df8dccfc7b on amruthasangeeth:ShiftEventsToCBV into 91677ce on systers:develop.

@amruthasangeeth
Copy link
Contributor Author

@tapasweni-pathak All the test cases here are passed now :)


class EventDateForm(forms.Form):
start_date = forms.DateField(required=True)
end_date = forms.DateField(required=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amruthasangeeth What has been changed in this file? Nothing, right? Did you run pep8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapasweni-pathak No changes are made in this file.

@tapaswenipathak
Copy link
Contributor

@amruthasangeeth Great. :)

If you see you will find that complete files are coming in the diff, it becomes very difficult to review such a diff. Can you please undo the unnecessary changes and only have the useful ones in this pull request?

You can submit a new pull request for the cleanups, spacing issues e.t.c.

@@ -4,7 +4,7 @@

{% block setting_content %}
<div class="spacer"></div>
<form class="form-horizontal" action="{% url 'event:delete' event_id %}" method="post">
<form class="form-horizontal" action="" method="post">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amruthasangeeth Where are we redirecting to delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapasweni-pathak DeleteView works just like that.

Copy link
Contributor

@tapaswenipathak tapaswenipathak Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amruthasangeeth Then do we need this form tag ?

Migrated function based views in Events app to class based views
template_name = "event/list.html"

def get_queryset(self):
events = Event.objects.all().order_by('name')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapasweni-pathak Updated the PR by making the list in sorted order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 83.693% when pulling f4bf510 on amruthasangeeth:ShiftEventsToCBV into 5dadcd6 on systers:develop.

@tapaswenipathak tapaswenipathak merged commit 09a6837 into anitab-org:develop Aug 18, 2016
@smarshy
Copy link
Contributor

smarshy commented Aug 19, 2016

@tapasweni-pathak There are tests for this, they are commented out as the current vms does not redirect to no admin pages uniformly. I have added a test for this - here
#325 is related to this.
Once all cases are covered, I can uncomment it and check. Or should I do it now itself? The build might fail.

@tapaswenipathak
Copy link
Contributor

@smarshy Okay. Do we have these tests for the cases when it is being redirected to no admin page or all are commented?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants