Sept. 2, 2019, 7:31 a.m.

Django

Auth, Django, Backend, Python

For a long time I did not add such functionality on the site for the simple reason that I did not know which side to approach this, because I would like to process this information in one single place, and not in every View.

Over time, I began to modify Backend classes for the site and the solution came by itself. It was only necessary to modify each authentication backend that is used on the site. And rewrite the get_user method, which will store information about the user's last request to the site. And the online status can be saved for the last 15 minutes, then the status will be offline.

And the date of the last request can be stored either in the user’s profile, which will be the OneToOne model for the user, or override the user model. I chose the option of overriding the user model.

Aug. 26, 2019, 3:51 a.m.

Django

user, Django, Backend, Model

Imagine that for an authenticated user, when opening pages, some requests are constantly being executed, for example, an additional list of notifications is loaded, as well as his profile. And we use this information in templates, for example this way.

{% if user.is_authenticated %}
    {{ user.profile.avatar }}
    {{ user.notices.count }}
{% endif %}
Aug. 2, 2019, 7:06 a.m.
Arrow

Django

Добрый день.

Помогите пожалуйста никак не могу найти информации о деплое Telegram бота на pythonenywhere.

Написал бота используя pyTelegramBotAPI (база данных, админка и еще некоторые вещи на Django). Столкнулся с проблемой, что на локальной машине с использованием polling() все ра…

April 28, 2019, 9:36 a.m.

Django

Django, Model, Reset

In the process of developing a project on Django, we may encounter an unpleasant situation when some packages and modules were removed and, accordingly, models from these packages were no longer used. But at the same time, squash of application migrations does not allow removing these packages, since migrations have many circular dependencies. As a result, removing unnecessary packages becomes a rather difficult task. Since resolving such dependencies becomes a non-trivial task. For me, such an unpleasant package was Django CKEditor, which was present almost everywhere. As a result, this package due to migrations remained for quite a long time in the list of requirements.txt, although in fact it was not used on the site at all.

April 24, 2019, 3:42 a.m.

Django

Django, Application, Model

I would like to share one of the possible way for moving the data model from one application to another.

Immediately, I note that this version of the data model transfer is not 100% working and you may need additional manual editing of the tables to correctly set the Content Type. Since any such modifications are fraught with data loss for GenericForeignKey relationships.

In my case, GenericForeignKey was not used, so there was no such problem.

April 23, 2019, 4:10 a.m.

Django

Mac, Homebrew, Nginx, MacOS, Python, Apple, Django

I propose to consider the process of installing and configuring a Django project on Mac OS X based on an existing project.

Some steps will be similar to those already performed in the Django setup article for Ubuntu .

MU
March 10, 2019, 1:01 p.m.
Maciej Urmański

Django

Hi, I try to show user object from category which they subscribe. But don't know exacly how.

I have four models: Board ( category ) Subject Embed and Subscribe (foreign to user and to board)

class Board(models.Model):
    title = models.CharField(max_length=255, verbose_name='Tytuł')
…
MU
March 7, 2019, 5:01 a.m.
Maciej Urmański

Django

Hi,

I try to save foreign key in django restframework serializer.

My goal is to save in database information from iframely.com and this part works good. But I need to also save it in specific category. After add field "Board(my category name field)" I have error: null value in colu…

MU
Feb. 20, 2019, 9:11 a.m.
Maciej Urmański

Django

Hi, i try to create list of users attendance in goal app.

But i don't know how to filter user.

I have Goal model:

class Goal(models.Model, Activity):
    title = models.CharField(max_length=255, verbose_name='Tytuł')
    image = ImageField(blank=True, verbose_name='Tło')
    bod…
MU
Feb. 13, 2019, 6:30 p.m.
Maciej Urmański

Django

Hi,

I search through internet and review many apps but still don't have answer maybe on this forum someone help me.

I try to create changing button after user join to Goal.

I have work buttons, but i don't know how to change this in template.

I try to do this with boole…

Looking for a Job?
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

For registered users on the site there is a minimum amount of advertising

DSh
Sept. 21, 2019, 2:55 p.m.
Dmitrij Shilkov

C++ - Test 001. The first program and data types

  • Result:46points,
  • Rating points-6
s
Sept. 18, 2019, 5:19 p.m.
sanyalitv

C++ - Test 002. Constants

  • Result:33points,
  • Rating points-10
s
Sept. 18, 2019, 5:12 p.m.
sanyalitv

C++ - Test 001. The first program and data types

  • Result:80points,
  • Rating points4
Last comments
M
Sept. 20, 2019, 11:25 a.m.
Mark

вызываю метод get у m_downloader в другом методе и приложение начинает вылетать. В чем ошибка?
M
Sept. 19, 2019, 5:45 a.m.
Mark

А вот как выгрузить файл на сервер по http протоколу? Допустим на regRu. И как получить путь файла, которой отображается в файловом менеджере regRu, чтобы загрузить его.
Sept. 17, 2019, 6:07 a.m.
Misha Lebedev

Кстати интересные темы нашёл тут https://emacsway.github.io/ru/django-framework/#django-models Может что полезного тоже Евгений найдёте
Sept. 17, 2019, 4:50 a.m.
Misha Lebedev

Доброго времени суток. Спасибо за хороший ответ, У меня ситуация така что в галлереи будет несколько миллионов фотографий с фильтрами и тегами , и я опасаюсь за производительност . Это ос…
Sept. 17, 2019, 3:23 a.m.
Evgenij Legotskoj

Добрый день. Да, я тоже читал ту статью в своё время и согласен с тем, что внешние ключи гораздо лучше, чем GenericForeignKey. Выборки в ряде случае работают быстрее. Но лично мне про…
Now discuss on the forum
M
Sept. 22, 2019, 1:54 a.m.
Mark

Пока реализовал так: на сервере лежат сами файлы и файл с именами всех файлов и их версий, который админ обновляет при довавлении файла. Клиентское по парсит этот файл и таким образом понимает к…
MS
Sept. 21, 2019, 12:51 p.m.
Mihail Sermjazhko

Так работает import QtQuick 2.7import QtQuick.Window 2.2import QtQuick.Controls 2.0Window { id: demo width: 800 height: 600 visible: true color: "#ff303030" prope…
MS
Sept. 21, 2019, 11:46 a.m.
Mihail Sermjazhko

Говорят через делегат должно работать: ListView{ id:l anchors.fill: parent model: ["data 1","data 2","data 3"] currentIndex : 2 delegate: Text { Rectangle{ …
C
Sept. 21, 2019, 9:08 a.m.
Cobra91151

Здравствуйте! Я хочу подключатся к сетям WiFi Enterprise через свою программу. Настроил Radius Server, поключение к сети через Windows работает. Но при подключении через программу пишет: о…
Sept. 20, 2019, 4:56 a.m.
Pavel K.

Привет , подскажите кто-нибудь , как сделать драг н дроп , не нарушая при этом логику работы зума? import QtQuick 2.6 import QtGraphicalEffects 1.0 Page { id:win property string fi…
EVILEG
About
Services
© EVILEG 2015-2019
Recommend hosting TIMEWEB