-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
150 additions
and
30 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from django.contrib import admin | ||
from .models import Blog | ||
|
||
admin.site.register(Blog) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.0.5 on 2022-06-14 03:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Project', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=200)), | ||
('description', models.TextField()), | ||
('date', models.DateField()), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.0.5 on 2022-06-14 03:26 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='Project', | ||
new_name='Blog', | ||
), | ||
] |
Binary file added
BIN
+731 Bytes
personal_blog/blog/migrations/__pycache__/0001_initial.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+526 Bytes
personal_blog/blog/migrations/__pycache__/0002_rename_project_blog.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class Blog(models.Model): | ||
title = models.CharField(max_length=200) | ||
description = models.TextField() | ||
date = models.DateField() | ||
|
||
def __str__(self): | ||
return self.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends 'portfolio/base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h1>Blog</h1> | ||
|
||
<h2>Temirlan has written {{ blogs.count }} blog{{blogs.count|pluralize}}</h2> | ||
{% for blog in blogs %} | ||
|
||
<a href="{% url 'blog:detail' blog.id %}"><h2>{{ blog.title }}</h2></a> | ||
<h5>{{ blog.date|date:'M d Y'|upper }}</h5> | ||
<p>{{ blog.description|striptags|truncatechars:100 }}</p> | ||
|
||
|
||
{% endfor %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>$Title$</title> | ||
</head> | ||
<body> | ||
$END$ | ||
</body> | ||
</html> | ||
{% extends 'portfolio/base.html' %} | ||
|
||
{% block content %} | ||
|
||
|
||
<h1>{{ blog.title}}</h1> | ||
<h2> --{{ blog.date|date:'F jS Y'}}--</h2> | ||
|
||
|
||
{{ blog.description|safe}} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
app_name = 'blog' | ||
|
||
urlpatterns = [ | ||
path('', views.all_blogs, name='all_blogs'), | ||
path('<int:blog_id>/', views.detail, name='detail'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
from django.shortcuts import render | ||
from django.shortcuts import render, get_object_or_404 | ||
from .models import Blog | ||
|
||
# Create your views here. | ||
|
||
|
||
def all_blogs(request): | ||
blogs_count = Blog.objects.count | ||
blogs = Blog.objects.order_by('-date')[:5] | ||
return render(request, 'blog/all_blogs.html', {'blogs': blogs}) | ||
|
||
|
||
def detail(request, blog_id): | ||
blog = get_object_or_404(Blog, pk=blog_id) | ||
return render(request, 'blog/detail.html', {'blog':blog}) |
Binary file not shown.
Binary file added
BIN
+126 KB
personal_blog/media/portfolio/images/b3a632a5547d22c553075514add449db.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+96 Bytes
(100%)
personal_blog/personal_blog/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file modified
BIN
+286 Bytes
(130%)
personal_blog/personal_blog/__pycache__/urls.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+121 Bytes
(120%)
personal_blog/portfolio/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from django.contrib import admin | ||
from .models import Project | ||
|
||
# Register your models here. | ||
admin.site.register(Project) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+126 KB
personal_blog/portfolio/static/portfolio/b3a632a5547d22c553075514add449db.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>$Title$</title> | ||
</head> | ||
<body> | ||
$END$ | ||
</body> | ||
</html> | ||
{% extends 'portfolio/base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h1>Temirlan's Portfolio</h1> | ||
|
||
{% load static %} | ||
|
||
<img src="{% static 'portfolio/b3a632a5547d22c553075514add449db.jpg' %}"> | ||
|
||
{% for project in projects %} | ||
|
||
<h2>{{project.title}}</h2> | ||
<p>{{project.description}}</p> | ||
<img src="{{ project.image.url }}" height=70 , width=70> | ||
{% if project.url %} | ||
<br><a href="{{ project.url }}">Link</a> | ||
{% endif %} | ||
|
||
{% endfor %} | ||
<a a href="{% url 'blog:all_blogs' %}">Blog</a> | ||
<br> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
from django.shortcuts import render | ||
from .models import Project | ||
|
||
# Create your views here. | ||
|
||
|
||
def home(request): | ||
projects = Project.objects.all() | ||
return render(request, 'portfolio/home.html', {'projects':projects}) |