Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jatolentino authored May 15, 2022
1 parent b3803eb commit f26bb44
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 38 deletions.
80 changes: 42 additions & 38 deletions crm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Test: `http://127.0.0.1:8000/leads/1/` <br>
</p>
</a>
-->
Compiled in the branch of [`ver-1.2`](https://github.com/jatolentino/Django-notes/tree/jatolentino-ver-1.2)
<!--Compiled in the branch of [`ver-1.2`](https://github.com/jatolentino/Django-notes/tree/jatolentino-ver-1.2) -->
### 23 Create the lead_update model
- In lead/views.py
```python
Expand Down Expand Up @@ -568,7 +568,7 @@ Test: `http://127.0.0.1:8000/leads/1/` <br>
</form>
</body>
```
Compiled in the branch of [`ver-1.3`](https://github.com/jatolentino/Django-notes/tree/jatolentino-ver-1.3)
Compiled in the branch of [`ver-1.2`](https://github.com/jatolentino/Django-notes/tree/jatolentino-ver-1.2)
### 26 Create a template
- Create base.html in crm/templates/
```html
Expand Down Expand Up @@ -599,68 +599,71 @@ Test: `http://127.0.0.1:8000/leads/1/` <br>
- Update the leads/lead_list.html file
```html
{% extends "base.html" %}

{% block content %}
<a href="{% url 'leads:lead-create' %">Create a new lead</a>
<h1> This is all of our leads</h1>
{% for lead in leads %}
<div class="lead">
<a href="{% url 'leads:lead-detail' lead.pk %}"> {{ lead.first_name }} {{ lead.last_name }}</a>. Age: {{ lead.age }}
</div>
<a href="{% url 'leads:lead-create' %}">Create a new lead</a>
<hr />
<h1> This is all of our leads</h1>
{% for lead in leads %}
<div class="lead">
<a href="{% url 'leads:lead-detail' lead.pk %}"> {{ lead.first_name }} {{ lead.last_name }}</a>. Age: {{ lead.age }}
</div>
{% endfor %}
{% endblock content %}
```
- Update the leads/lead_detail.html file
```html
{% extends "base.html" %}
{% block content %}
<a href="{% url 'leads:lead-list' %">Go back to leads</a>
<hr />
<h1>This is the details of {{ lead.first_name }}</h1>
<p>This persons age: {{ lead.age }} </p>
<p>The agent responsible for this lead is : {{ lead.agent }}</p>
<hr />
<a href="{% url 'leads:lead-update' lead.pk %}">Update</a>
<a href="{% url 'leads:lead-delete' lead.pk %}">Delete</a>
<a href="{% url 'leads:lead-list' %}">Go back to leads</a>
<hr />
<h1>This is the details of {{ lead.first_name }}</h1>
<p>This persons age: {{ lead.age }} </p>
<p>The agent responsible for this lead is : {{ lead.agent }}</p>
<hr />
<a href="{% url 'leads:lead-update' lead.pk %}">Update</a>
<a href="{% url 'leads:lead-delete' lead.pk %}">Delete</a>
{% endblock content %}
```
- Update the leads/lead_update.html file
```html
{% extends "base.html" %}
{% block content %}
<a href="{% url 'leads:lead-detail' lead.pk %}">Go back to {{ lead.first_name }} {{ lead.last_name }} </a>
<hr />
<h1>Update lead: {{ lead.first_name }} {{ lead.last_name }}</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
<a href="{% url 'leads:lead-detail' lead.pk %}">Go back to {{ lead.first_name }} {{ lead.last_name }} </a>
<hr />
<h1>Update lead: {{ lead.first_name }} {{ lead.last_name }}</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% endblock content %}
```
- Update the leads/lead_create.html file
```html
{% extends "base.html" %}
{% block content %}
<a href="{% url 'leads:lead-list' %}"> Go back to leads</a>
<hr />
<h1> Create a new lead</h1>
<form method="post"> <!-- form method="post" action="/leads/another-url/"> -->
{% csrf_token %}
{{ form.as_p }}
<button type="submit" >Submit</button>
</form>
<a href="{% url 'leads:lead-list' %}"> Go back to leads</a>
<hr />
<h1> Create a new lead</h1>
<form method="post"> <!-- form method="post" action="/leads/another-url/"> -->
{% csrf_token %}
{{ form.as_p }}
<button type="submit" >Submit</button>
</form>
{% endblock content %}
```
- Update the leads/lead_list.html file
```html
{% extends "base.html" %}
{% block content %}
<a href="{% url 'leads:lead-create' %}">Create a new lead</a>
<h1> This is all of our lead lead</h1>
{% for lead in leads %}
<div class="lead">
<a href="{% url 'leads:lead-detail' lead.pk %}"> {{ lead.first_name }} {{ lead.last_name }}</a>. Age: {{ lead.age }}
</div>
<a href="{% url 'leads:lead-create' %}">Create a new lead</a>
<hr />
<h1> This is all of our leads</h1>
{% for lead in leads %}
<div class="lead">
<a href="{% url 'leads:lead-detail' lead.pk %}"> {{ lead.first_name }} {{ lead.last_name }}</a>. Age: {{ lead.age }}
</div>
{% endfor %}
{% endblock content %}
```
Expand All @@ -680,6 +683,7 @@ Edit the crm/templates/scripts.html
{% include "scripts.html" %}
</body>
```
Compiled in the branch of [`ver-1.3`](https://github.com/jatolentino/Django-notes/tree/jatolentino-ver-1.3)
### 27 Adding Tailwindcss
- Go to https://v2.tailwindcss.com/docs/installation#using-tailwind-via-cdn and edit templates/base.html
```html
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
24 changes: 24 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CRM</title>
<style>
.lead {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 6px;
padding-right: 6px;
margin-top: 10px;
background-color: #f6f6f6;
width: 100%;
}
</style>
</head>
<body>
{% block content %}
{% endblock content %}
{% include "scripts.html" %}
</body>
</html>
3 changes: 3 additions & 0 deletions templates/scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
console.log("hello")
</script>
20 changes: 20 additions & 0 deletions templates/second_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset = "UTF-8">
<meta name = "viewport" content="width=device-width", initial-scale=1.0>
<title>Document</title>
</head>
<body>
<h1>Hello world</h1>
<p>This is the second page</p>
<!--{{name}}
{{age}} -->
<ul>
{% for lead in leads %}
<li>{{ lead }}</li>
{% endfor %}
</ul>

</body>
</html>

0 comments on commit f26bb44

Please sign in to comment.