<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>
{% block title %}
Главная
{% endblock %}
</title>
</head>
<body>
{% if user.is_authenticated %}
<div>
<nav>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Выйти</button>
</form>
</li>
</ul>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% else %}
<div>
<nav>
<div>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% endif %}
{% block content %}
{% endblock %}
</body>
</html>
{% extends 'forum/base.html' %}
{% block title %}
Новый пост
{% endblock %}
{% block content %}
{% if user.is_authenticated %}
<h1>Напишите свой пост</h1>
<form action="{% url 'add_post' %}" method="post">
{% csrf_token %}
<div>
<label><input name="title" placeholder="Заголовок..." /></label>
</div>
<div>
<label><textarea name="description" placeholder="Текст поста..."></textarea></label>
</div>
<div>
<input type="submit" />
</div>
</form>
{% else %}
<h1>Вы не авторизованы</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
{% endif %}
{% endblock %}
pip install python-magic
>>> import magic
>>> magic.from_file("testdata/test.pdf")
'PDF document, version 1.2'
# recommend using at least the first 2048 bytes, as less can produce incorrect identification
>>> magic.from_buffer(open("testdata/test.pdf", "rb").read(2048))
'PDF document, version 1.2'
>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
запустить ос камеры на пкэто не возможно. Возможно подключить к пк и запустить программу на странице 45.
slug_field¶
The name of the field on the model that contains the slug. By default, slug_field is 'slug'.
slug_url_kwarg¶
The name of the URLConf keyword argument that contains the slug. By default, slug_url_kwarg is 'slug'.
urlpatterns = [ path("<slug:slug>/", ArticleDetailView.as_view(), name="article-detail"), ]
Error: Failed to load module @rollup/rollup-win32-x64-msvc. Required DLL was not found. This error usually happens when Microsoft Visual C++ Redistributable is not installed. You can download it from https://aka.ms/vs/17/release/vc_redist.x64.exe
import requests
base_url = "https://www.ursus.ru/catalogue/zashchita_ot_padeniy_s_vysoty/page-"
pages = 8
for i in range(1, pages + 1):
print(f"Page: {i}")
print(f"{base_url}{i}/")
requests.get(f"{base_url}{i}.")