Compare commits
10 Commits
33e90a1969
...
7a59fb798f
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a59fb798f | |||
| f7e291af7b | |||
| 4f8cf91609 | |||
| edaa41811f | |||
| 77a2e7d954 | |||
| e79d1e702c | |||
| 353233ba6e | |||
| 530ec8a071 | |||
| cceb2d82fd | |||
| e6b3b0f715 |
BIN
Django_Portfolio_Course_Slides.pdf
Normal file
BIN
Django_Portfolio_Course_Slides.pdf
Normal file
Binary file not shown.
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
18
projects/migrations/0002_alter_project_image.py
Normal file
18
projects/migrations/0002_alter_project_image.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.0 on 2022-01-04 13:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('projects', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='project',
|
||||
name='image',
|
||||
field=models.FilePathField(path='/projects/img'),
|
||||
),
|
||||
]
|
||||
@ -5,4 +5,4 @@ class Project(models.Model):
|
||||
title = models.CharField(max_length=100)
|
||||
description = models.TextField()
|
||||
technology = models.CharField(max_length=20)
|
||||
image = models.FilePathField(path="/img")
|
||||
image = models.FilePathField(path="/projects/img")
|
||||
|
||||
BIN
projects/static/projects/img/daily.png
Normal file
BIN
projects/static/projects/img/daily.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
BIN
projects/static/projects/img/testproject.png
Normal file
BIN
projects/static/projects/img/testproject.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
BIN
projects/static/projects/img/todo.png
Normal file
BIN
projects/static/projects/img/todo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
33
projects/templates/projects/all_projects.html
Normal file
33
projects/templates/projects/all_projects.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<!-- CSS only -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Projects</h1>
|
||||
<div class="row">
|
||||
<!-- h1>Hi again</h1 -->
|
||||
<!--div class="alert alert-warning" role="alert">
|
||||
Remember that errors are your friends!
|
||||
</div -->
|
||||
{% for project in projects%}
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-2">
|
||||
<img class="card-img-top" src="{% static project.image %}" alt="{{ project.description }}">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ project.title }}</h5>
|
||||
<p class="card-text">{{ project.description }}</p>
|
||||
<a href="#" class="btn btn-primary">Read More</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -2,5 +2,6 @@ from django.urls import path
|
||||
from projects import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.project_list),
|
||||
path("", views.all_projects),
|
||||
path("test", views.project_list),
|
||||
]
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
from django.shortcuts import render
|
||||
from projects.models import Project
|
||||
|
||||
# Create your views here.
|
||||
def project_list(request):
|
||||
return render(request, "projects/index.html")
|
||||
|
||||
|
||||
def all_projects(request):
|
||||
# query the db to return all project objects
|
||||
projects = Project.objects.all()
|
||||
return render(request, "projects/all_projects.html", {"projects": projects})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user