Skip to content

Lesson08 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
794a6e2
Все сделано
AlexN-github Apr 2, 2020
d4ae5d3
Все сделано
AlexN-github Apr 5, 2020
cedf71b
фиксируем изменения по шаблонизации index
AlexN-github Apr 5, 2020
ed7f71d
фикс изменений по шаблонизации index
AlexN-github Apr 5, 2020
0b07359
Выполнил шаблонизацию всех страниц
AlexN-github Apr 5, 2020
2712485
Все выполнил
AlexN-github Apr 6, 2020
b68e879
Какие-то непонятные изменения в workspace
AlexN-github Apr 9, 2020
544f0b2
Выполнил
AlexN-github Apr 9, 2020
96d1a1a
Урок3 весь
AlexN-github Apr 9, 2020
782f4e1
Выполнено
AlexN-github Apr 13, 2020
980c5d7
Выполнено
AlexN-github Apr 13, 2020
912e725
тест
AlexN-github Apr 13, 2020
69cb988
Коммит БД
AlexN-github Apr 13, 2020
f2baaf9
Консистентный коммит
AlexN-github Apr 13, 2020
481cfdc
Выполнено
AlexN-github Apr 16, 2020
1ceaddc
Еще непонятные изменения
AlexN-github Apr 16, 2020
3115e35
еще коммит
AlexN-github Apr 16, 2020
6aea296
Перезабил снова картинки
AlexN-github Apr 16, 2020
4ae4fa3
Поправил картинки,
AlexN-github Apr 16, 2020
47eafb2
Набежали какие-то изменения
AlexN-github Apr 19, 2020
7397457
Выполнено
AlexN-github Apr 20, 2020
8859fc7
Выполнено
AlexN-github Apr 23, 2020
a2048ed
Выполнено
AlexN-github Apr 23, 2020
474ced5
какие-то изменения workspace
AlexN-github Apr 26, 2020
3d3e03e
Все кроме CBV CRUD категорий
AlexN-github Apr 26, 2020
0e90c6e
Все выполнил
AlexN-github Apr 26, 2020
1554c4c
+ my_tags
AlexN-github Apr 27, 2020
b1d1a6d
изменился воркспейс
AlexN-github Apr 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __init__.cpython-37.pyc
Binary file not shown.
7 changes: 7 additions & 0 deletions geekshop/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions geekshop/.idea/geekshop.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions geekshop/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions geekshop/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions geekshop/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions geekshop/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions geekshop/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added geekshop/adminapp/__init__.py
Empty file.
Binary file not shown.
Binary file added geekshop/adminapp/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file added geekshop/adminapp/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added geekshop/adminapp/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions geekshop/adminapp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions geekshop/adminapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AdminappConfig(AppConfig):
name = 'adminapp'
33 changes: 33 additions & 0 deletions geekshop/adminapp/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django import forms
from authapp.models import ShopUser
from authapp.forms import ShopUserEditForm
from mainapp.models import ProductCategory, Product


class ShopUserAdminEditForm(ShopUserEditForm):
class Meta:
model = ShopUser
fields = '__all__'

class ProductCategoryEditForm(forms.ModelForm):
class Meta:
model = ProductCategory
fields = '__all__'

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name, field in self.fields.items():
field.widget.attrs['class'] = 'form-control'
field.help_text = ''


class ProductEditForm(forms.ModelForm):
class Meta:
model = Product
fields = '__all__'

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name, field in self.fields.items():
field.widget.attrs['class'] = 'form-control'
field.help_text = ''
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions geekshop/adminapp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
32 changes: 32 additions & 0 deletions geekshop/adminapp/templates/adminapp/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
{{ title|title }} -Магазин, Сегодня: {% now 'd.m.Y' %}
</title>
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<link rel="stylesheet" href="{% static 'fonts/font-awesome/css/font-awesome.css' %}">
{% endblock %}

{% block js %}
{% endblock %}
</head>
<body>
<div class="admin_container">
<div class="h2 text-center head">
Админка
</div>
{% block menu %}
<div class="admin_menu">
{% include 'adminapp/includes/inc_menu.html' %}
</div>
{% endblock %}

{% block content %}
{% endblock %}
</div>
</body>
</html>
43 changes: 43 additions & 0 deletions geekshop/adminapp/templates/adminapp/categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}

{% block content %}
<div class="categories_list">
<button class="new_category">
<a href={% url 'admin:category_create' %}>
новая категория
</a>
</button>

{% for object in objects %}
<div class="category_record
{% if not object.is_active %}
not_active
{% endif %}">
<div class="category_name">
{{ object.name|title }}
</div>
<div class="category_actions">
<button>
<a href={% url 'admin:products' object.pk %}>
товары категории
</a>
</button>
<button>
<a href={% url 'admin:category_update' object.pk %}>
редактировать
</a>
</button>
<button>
<a href={% url 'admin:category_delete' object.pk %}>
удалить
</a>
</button>
</div>
<div class="category_desc">
{{ object.description|title }}
</div>
</div>
{% endfor%}
</div>
{% endblock %}
17 changes: 17 additions & 0 deletions geekshop/adminapp/templates/adminapp/category_delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}

{% block content %}
<div class="new_category_form">
<form class="form-horizontal" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<input class="form-control" type="submit" value="сохранить">
</form>
<button class="btn btn-round form-control last">
<a href="{% url 'admin:categories' %}">
к списку категорий
</a>
</button>
</div>
{% endblock %}
17 changes: 17 additions & 0 deletions geekshop/adminapp/templates/adminapp/category_update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}

{% block content %}
<div class="new_category_form">
<form class="form-horizontal" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<input class="form-control" type="submit" value="сохранить">
</form>
<button class="btn btn-round form-control last">
<a href="{% url 'admin:categories' %}">
к списку категорий
</a>
</button>
</div>
{% endblock %}
26 changes: 26 additions & 0 deletions geekshop/adminapp/templates/adminapp/includes/inc_menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ul class="menu">
<li>
<a href="{% url 'main' %}">
на сайт
</a>
</li>
<li>
<a href="{% url 'admin:users' %}"
class="{% if request.resolver_match.url_name == 'users' %}
active
{% endif %}">
пользователи
</a>
</li>
<li>
<a href="{% url 'admin:categories' %}"
class="{% if request.resolver_match.url_name == 'categories' or category.name %}
active
{% endif %}">
категории
{% if category %}
:<span>{{ category.name }}</span>
{% endif %}
</a>
</li>
</ul>
19 changes: 19 additions & 0 deletions geekshop/adminapp/templates/adminapp/product_delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}


{% block content %}
<div class="product_delete">
Уверены, что хотите удалить продукт <strong>{{ product_to_delete.name }}</strong>?
<form action="{% url 'admin:product_delete' product_to_delete.pk %}"
method="post">
{% csrf_token %}
<input class="btn btn-danger" type="submit" value="удалить">
</form>
<button class="btn btn-success">
<a href="{% url 'admin:products' product_to_delete.category.pk %}">
Отмена
</a>
</button>
</div>
{% endblock %}
Loading