Skip to content

Commit 6296b6d

Browse files
committed
Create quora project to understand data flow
- Create Question app - Create views and url patterns - Create templates - Restructure templates by creating base.html and extending it - Use context variables and template tags
1 parent 736e244 commit 6296b6d

File tree

16 files changed

+359
-0
lines changed

16 files changed

+359
-0
lines changed

quora/db.sqlite3

Whitespace-only changes.

quora/manage.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quora.settings")
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError as exc:
10+
raise ImportError(
11+
"Couldn't import Django. Are you sure it's installed and "
12+
"available on your PYTHONPATH environment variable? Did you "
13+
"forget to activate a virtual environment?"
14+
) from exc
15+
execute_from_command_line(sys.argv)

quora/question/__init__.py

Whitespace-only changes.

quora/question/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

quora/question/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class QuestionConfig(AppConfig):
5+
name = 'question'

quora/question/migrations/__init__.py

Whitespace-only changes.

quora/question/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

quora/question/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

quora/question/views.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django.shortcuts import render
2+
from django.http import HttpResponse
3+
4+
import pprint
5+
6+
# Create your views here.
7+
8+
def welcome(request):
9+
print('-+'*20)
10+
print("Request receieved at welcome")
11+
print('User: ', request.user)
12+
print('Is AJAX: ', request.is_ajax())
13+
print('Method: ', request.method)
14+
print('-+'*20)
15+
return render(request, 'welcome.html')
16+
# return HttpResponse('asdfasdfasdfasdfasdf')
17+
18+
def abc(request):
19+
print('-+'*20)
20+
print("Request received at abc")
21+
print('-+'*20)
22+
context = {'username': 'Django', 'num': 207}
23+
return render(request, 'abc.html', context)

quora/quora/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)