Commit 8b5d27c1 authored by Daniel W Bond's avatar Daniel W Bond

only show completion message if actually completed

parent 1fc86100
......@@ -200,6 +200,12 @@ class Student(TimeStampedModel):
except AttributeError:
return None
def totally_done(self):
if self.completedName and self.completedPrivacy and self.completedMajor and self.completedSocial:
return True
else:
return False
def profile_image_url(self):
fb_uid = SocialAccount.objects.filter(user=self.user.id, provider='facebook')
#print("profile_image")
......
......@@ -470,15 +470,13 @@ class WelcomeMajor(LoginRequiredMixin, UpdateView):
kwargs={'slug':self.request.user.username})
class WelcomeSocial(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
class WelcomeSocial(LoginRequiredMixin, UpdateView):
model = Student
form_class = WelcomeSocialForm
context_object_name = 'student'
template_name = 'welcome_social.html'
login_url = 'login'
form_valid_message = "You successfully finished the welcome walkthrough!"
def get(self, request, *args, **kwargs):
current_url = self.request.get_full_path()
......@@ -501,6 +499,11 @@ class WelcomeSocial(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
return super(WelcomeSocial, self).form_valid(form)
def get_success_url(self):
if self.request.user.student.totally_done():
messages.add_message(self.request, messages.SUCCESS,
"You successfully finished the welcome walkthrough!")
return reverse('detail_student',
kwargs={'slug':self.request.user.username})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment