Remove redundant get_absolute_url

parent 25c5628d
......@@ -21,6 +21,3 @@ class WidgetUser(models.Model):
def get_absolute_url(self):
return reverse('widgetuser-detail', kwargs={'pk': self.pk})
def get_absolute_url(self):
return reverse('widgetuser-add', kwargs={'pk': self.pk})
from .models import WidgetUser
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views import generic
from django.urls import reverse
......@@ -14,11 +12,13 @@ def Dashboard_list_view(request):
for wu in WidgetUser.objects.all():
number = str(wu.pk)
href = '<a href="/Widgetusers/' + number + '/details">'
html_string_2 += '<li>' + href + '{}, {} {}: {}, {}' .format(wu.last_name,
wu.first_name,
wu.middle_name,
wu.department.dept_name,
wu.department.home_unit)
html_string_2 += '<li>' + href + '{}, {} {}: {}, {}' .format(
wu.last_name,
wu.first_name,
wu.middle_name,
wu.department.dept_name,
wu.department.home_unit
)
html_string_2 += '</ul></li>'
html_string_3 = '<a href="/Widgetusers/add"><button value="click here" > Add Widget User</button></a><br><br>'
html_string_3 += '<a href="/announcements/">Announcement Board</a><br>'
......@@ -27,7 +27,6 @@ def Dashboard_list_view(request):
html_string_3 += '<a href="/widget_Calendar/">Calendar</a><br>'
html_string_final = html_string_1 + html_string_2 + html_string_3 + '</html>'
return HttpResponse(html_string_final)
......@@ -57,4 +56,3 @@ class WidgetUserUpdateView(generic.UpdateView):
def get_success_url(self):
return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
\ No newline at end of file
......@@ -30,10 +30,6 @@ class Event(models.Model):
def __str__(self):
return '{} on {}'.format(self.activity, self.target_datetime)
def get_absolute_url(self):
return reverse('event-detail', kwargs={'pk': self.pk})
def get_absolute_url(self):
return reverse('event-add', kwargs={'pk': self.pk})
return reverse('event-detail', kwargs={'pk': self.pk})
......@@ -63,5 +63,5 @@ class EventUpdateView(generic.UpdateView):
success_url = "widget_Calendar/"
def get_success_url(self):
return reverse('widget_Calendar:eventuser-detail', kwargs={'pk': self.object.id},
return reverse('widget_Calendar:event-detail', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
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