Commit cadfeb2b authored by Jose Luis Bautista's avatar Jose Luis Bautista

Added Mark as Done

parent a21dddca
...@@ -24,6 +24,9 @@ class today_model(models.Model): ...@@ -24,6 +24,9 @@ class today_model(models.Model):
def today_delete(self): def today_delete(self):
return reverse('today_delete', args = [str(self.id)]) return reverse('today_delete', args = [str(self.id)])
def today_done(self):
return reverse('today_done', args = [str(self.id)])
# def deltwtask(self): # def deltwtask(self):
# return reverse('deletetwtask', args=[str(self.id)]) # return reverse('deletetwtask', args=[str(self.id)])
...@@ -36,4 +36,5 @@ urlpatterns = [ ...@@ -36,4 +36,5 @@ urlpatterns = [
path('new_image/',ProfileImageView.as_view(), name = 'new_image'), path('new_image/',ProfileImageView.as_view(), name = 'new_image'),
path('new_today_update/<int:pk>/',TodayUpdateView.as_view(), name = 'new_today_update'), path('new_today_update/<int:pk>/',TodayUpdateView.as_view(), name = 'new_today_update'),
path('today_delete/<int:pk>/',TodayDeleteView.as_view(), name = 'today_delete'), path('today_delete/<int:pk>/',TodayDeleteView.as_view(), name = 'today_delete'),
path('today_done/<int:pk>/',page_today_done, name = 'today_done'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
...@@ -52,6 +52,13 @@ def new_key(request): ...@@ -52,6 +52,13 @@ def new_key(request):
return render(request,'update.html', {'form' : form}) return render(request,'update.html', {'form' : form})
def page_today_done(request,pk):
done = today_model.objects.get(id = pk)
done.keyModel = key_model.objects.get(id = 30)
done.save()
return redirect('today')
def page_today(request): def page_today(request):
myDate = datetime.now() myDate = datetime.now()
...@@ -122,3 +129,4 @@ class TodayDeleteView(DeleteView): ...@@ -122,3 +129,4 @@ class TodayDeleteView(DeleteView):
def get_success_url(self): def get_success_url(self):
return reverse('today') return reverse('today')
...@@ -10,10 +10,24 @@ ...@@ -10,10 +10,24 @@
{% for x in object_list %} {% for x in object_list %}
{{x.keyModel.keyName}} : {{x.todayDesc}} | {% if x.keyModel.keyName == '• Task' %}
{{x.keyModel.keyName}} : {{x.todayDesc}} ||
<a href = "{{ x.today_edit }}"><button>Edit</button></a> <a href = "{{ x.today_edit }}"><button>Edit</button></a>
<a href = "{{ x.today_delete }}"><button>Delete</button></a> <a href = "{{ x.today_delete }}"><button>Delete</button></a>
<a href = "{{ x.today_done }}"><button>Mark as Done</button></a>
<br> <br>
{% else %}
{{x.keyModel.keyName}} : {{x.todayDesc}} ||
<a href = "{{ x.today_edit }}"><button>Edit</button></a>
<a href = "{{ x.today_delete }}"><button>Delete</button></a>
<br>
{% endif %}
{% endfor %} {% endfor %}
<br> <br>
......
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