Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 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
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.

79 changes: 79 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'
21 changes: 21 additions & 0 deletions geekshop/adminapp/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from django import forms
from authapp.models import ShopUser
from authapp.forms import ShopUserEditForm
from mainapp.models import ProductCategory


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 = ''
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 %}
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>
49 changes: 49 additions & 0 deletions geekshop/adminapp/templates/adminapp/products.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}

{% block content %}
<div class="products_list">
<button class="new_product">
<a href={% url 'admin:product_create' category.pk %}>
новый продукт
</a>
</button>

{% for object in objects %}
<div class="product_record">
<img
src="/media/{{object.image|default:'products_images/default.jpg'}}"
alt="{{ object.name }}">
<div class="product_name">
{{ object.name|title }}
</div>
<div class="product_actions">
<button>
<a href={% url 'admin:product_read' object.pk %}>
подробнее
</a>
</button>
<button>
<a href={% url 'admin:product_update' object.pk %}>
редактировать
</a>
</button>
<button>
<a href={% url 'admin:product_delete' object.pk %}>
удалить
</a>
</button>
</div>
<div class="summary">
<b>цена</b>
<p>{{ object.price }} руб</p>
<b>количество</b>
<p>{{ object.quantity }}</p>
</div>
<div class="product_desc">
{{ object.short_desc|title }}
</div>
</div>
{% endfor%}
</div>
{% endblock %}
26 changes: 26 additions & 0 deletions geekshop/adminapp/templates/adminapp/user_delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends 'adminapp/base.html' %}
{% load staticfiles %}


{% block content %}
<div class="user_delete">
Уверены, что хотите удалить {{ user_to_delete.username }}
{% if user_to_delete.first_name %}
({{ user_to_delete.first_name|title }}</b>
{% if user_to_delete.last_name %}
{{ user_to_delete.last_name|title }}
{% endif %})
{% endif %}
?
<form action="{% url 'admin:user_delete' user_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:users' %}">
Отмена
</a>
</button>
</div>
{% endblock %}
15 changes: 15 additions & 0 deletions geekshop/adminapp/templates/adminapp/user_update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'authapp/base.html' %}
{% load staticfiles %}

{% block content %}
<form class="form-horizontal" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ update_form.as_p }}
<input class="form-control" type="submit" value="сохранить">
</form>
<button class="btn btn-round form-control last">
<a href="{% url 'admin:users' %}">
к списку пользователей
</a>
</button>
{% endblock %}
Loading