from django.shortcuts import render
from carnet_rouge.forms import CrForm
from django.views.generic import ListView, UpdateView, DetailView, FormView, CreateView

from carnet_rouge.models import *

def model_form_view(request):
    return render(request, "form_view.html", {'form': CrForm()})

class CrDetailView(DetailView):
    model = cr_Message

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["test"] = timezone.now()
        return context


class CrNotReadView(ListView):
    model = cr_Message

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["test"] = timezone.now()
        return context
def cr_view(request, id):
    print(id)
    cr = cr_Message.objects.get(pk=id)
    return render(request, "form_view.html", {'form': CrForm(), 'obj': cr})
# Create your views here.
