initial rcr platform commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
from typing import Any
|
||||
from django.db import models
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.views.generic.detail import DetailView
|
||||
|
||||
from rcr.models import Item
|
||||
from rcr.forms import ItemForm
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def radiology_index(request):
|
||||
|
||||
items = Item.objects.all()
|
||||
|
||||
return render(
|
||||
request,
|
||||
"rcr/index.html",
|
||||
{
|
||||
"items": items
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
class ItemUpdateView(UpdateView):
|
||||
model = Item
|
||||
|
||||
form_class = ItemForm
|
||||
template_name = "rcr/item_update.html"
|
||||
#excludes = ["rcr_platform_id"]
|
||||
#fields = ["category", "level"]
|
||||
|
||||
class ItemUpdateNextView(UpdateView):
|
||||
model = Item
|
||||
|
||||
form_class = ItemForm
|
||||
template_name = "rcr/item_update.html"
|
||||
|
||||
def get_object(self):
|
||||
obj = Item.objects.filter(completed=False).first()
|
||||
|
||||
#~if not obj:
|
||||
#~ return reverse_lazy("rcr:radiology_index_view")
|
||||
|
||||
return obj
|
||||
print("test")
|
||||
return super().get_object()
|
||||
|
||||
#def get
|
||||
|
||||
def get_success_url(self) -> str:
|
||||
return reverse_lazy("rcr:radiology_update_next_view")
|
||||
|
||||
|
||||
|
||||
|
||||
class ItemDetailView(DetailView):
|
||||
model = Item
|
||||
#template_name = "TEMPLATE_NAME"
|
||||
#excludes = ["rcr_platform_id"]
|
||||
Reference in New Issue
Block a user