Skip to content

Commit 14c8710

Browse files
Matthew HolmesMatthew Holmes
authored andcommitted
pushing django notes
1 parent 91c1203 commit 14c8710

File tree

32 files changed

+320
-0
lines changed

32 files changed

+320
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'unit_converter_proj.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class UnitConverterAppConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'unit_converter_app'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Unit Converter</title>
8+
</head>
9+
<body>
10+
<h1>Unit Converter</h1>
11+
12+
<form action="" method="post">
13+
{% csrf_token %}
14+
<!-- -->
15+
16+
<div class="distance">
17+
<!-- Name is the variable name -->
18+
<textarea
19+
name="distance"
20+
id=""
21+
cols="30"
22+
rows="1"
23+
placeholder="Enter the distance"
24+
></textarea>
25+
</div>
26+
27+
<div class="user_units">
28+
<h3>Enter the units you are using</h3>
29+
30+
<label for="km">Kilometers:</label>
31+
<input type="radio" name="user_units" id="" />
32+
33+
<label for="m">Meters:</label>
34+
<input type="radio" name="user_units" id="" />
35+
36+
<label for="ft">Feet:</label>
37+
<input type="radio" name="user_units" id="" />
38+
</div>
39+
40+
<div class="conversion_units">
41+
<h3>Enter the units you wish to convert to</h3>
42+
43+
<label for="km">Kilometers:</label>
44+
<input type="radio" name="conversion_units" id="" />
45+
46+
<label for="m">Meters:</label>
47+
<input type="radio" name="conversion_units" id="" />
48+
49+
<label for="ft">Feet:</label>
50+
<input type="radio" name="conversion_units" id="" />
51+
</div>
52+
53+
<button type="submit">submit</button>
54+
</form>
55+
56+
<!-- -->
57+
</body>
58+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Results</title>
8+
</head>
9+
<body>
10+
<h1>Results</h1>
11+
12+
{{% distance %}}
13+
</body>
14+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from django.urls import path, include
2+
from . import views
3+
# . :importing the views from the views file in the same directory
4+
5+
#
6+
app_name = 'unit converter'
7+
8+
urlpatterns = [
9+
# 8000/ucp
10+
path('', views.index, name='index'),
11+
12+
13+
path('result/', views.forms, name='forms')
14+
15+
# 8000/rps/result
16+
# path('result/', views.result, name='result'),
17+
18+
]

0 commit comments

Comments
 (0)