Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
51 lines (37 loc) · 1.32 KB

File metadata and controls

51 lines (37 loc) · 1.32 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from datetime import datetime
from django.shortcuts import redirect, render
from django.views.generic import ListView
from hello.forms import LogMessageForm
from hello.models import LogMessage
class HomeListView(ListView):
"""Renders the home page, with a list of all polls."""
model = LogMessage
def get_context_data(self, **kwargs):
context = super(HomeListView, self).get_context_data(**kwargs)
return context
def about(request):
"""Renders the about page."""
return render(request, "hello/about.html")
def contact(request):
"""Renders the contact page."""
return render(request, "hello/contact.html")
def hello_there(request, name):
"""Renders the hello_there page.
Args:
name: Name to say hello to
"""
return render(
request, "hello/hello_there.html", {"name": name, "date": datetime.now()}
)
def log_message(request):
form = LogMessageForm(request.POST or None)
if request.method == "POST":
if form.is_valid():
message = form.save(commit=False)
message.log_date = datetime.now()
message.save()
return redirect("home")
else:
return render(request, "hello/log_message.html", {"form": form})
else:
return render(request, "hello/log_message.html", {"form": form})
Morty Proxy This is a proxified and sanitized view of the page, visit original site.