Advanced search

DjangoDjango - Tutorial 047. How to do select_related and prefetch_related for an authenticated user

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

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 бота на Django с исползованием webhook

Добрый день.

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

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

DjangoDjango - Tutorial 046. Reset migrations in the project

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

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.

DjangoDjango - Tutorial 045. How to move model from one application to another

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

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.

DjangoDjango - Tutorial 044. How to Install and Configure Django on Mac OS

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

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

DjangoDjango list of subscribed objects

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

DjangoDjango rest framework and foreignkey

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

DjangoUser attendance in app

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

DjangoDjango change button status

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…

Feb. 8, 2019, 6:51 a.m.
Arrow

DjangoЗапрос подтверждения удаления записи

Добрый день!

Пытаюсь на django реализовать удаление записи, а диалог подтверждение удаления хочу вынести в модальное окно.

Файл views.py:

class DeleteObject(LoginRequiredMixin, DeleteView):
    model = Object
    template_name = 'todoList/home.html'

    def get(self, request, *…
How to become an author?

Contribute to the evolution of the EVILEG community.

Learn how to become a site author.

Learn it
Donate

Good day, Dear Users!!!

I am Evgenii Legotckoi, developer of EVILEG. And it is my hobby project, which helps to learn programming another programmers and developers

If the site helped you, and you want also support the development of the site, than you can donate by following ways

PayPalYandex.Money
Timeweb

Let me recommend you the excellent hosting on which EVILEG is located.

For many years, Timeweb has been proving his stability.

For projects on Django I recommend VDS hosting

View Hosting Timeweb
AS
May 26, 2020, 12:29 p.m.
Artem Sun-Dun-Chan

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:50points,
  • Rating points-4
MN
May 25, 2020, 12:33 p.m.
Mitja Nagibin

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:50points,
  • Rating points-4
f
May 25, 2020, 6:05 a.m.
falcon

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

  • Result:66points,
  • Rating points-1
Last comments
May 29, 2020, 7:30 a.m.
Evgenij Legotskoj

Qt/C++ - Lesson 039. How to paint stroke in QSqlTableModel by value in the column?

У меня работает. Исправлял в проекте, который приложен к статье. А что происходит в вашем коде, с учётом места вызова этого кода, я знать не могу ;) Дебажьте и добавляйте условия, кото…
MA
May 29, 2020, 7:27 a.m.
Mihail A

Qt/C++ - Lesson 039. How to paint stroke in QSqlTableModel by value in the column?

QModelIndexList rowIndexes = ui->tableView->selectionModel()->selectedRows(); model->removeRows(rowIndexes.first().row(), rowIndexes.size()); model-&…
May 29, 2020, 7:14 a.m.
Evgenij Legotskoj

Django - Tutorial 036. How to add authentication through social networks. VKontakte

Неправильно прописали URL, на который возвращается ответ от OAuth ВКонтакте. Настраивайте ваше приложение в консоли разработчика ВКонтакте
AL
May 29, 2020, 6:24 a.m.
Aleksandr Leonidov

Django - Tutorial 036. How to add authentication through social networks. VKontakte

Здравствуйте! После клика на ссылку авторизации выдает json словарь с ошибкой: {"error":"invalid_request","error_description":"redirect_uri is incorrect, check application redirect uri in …
May 28, 2020, 4:14 p.m.
Evgenij Legotskoj

Qt/C++ - Lesson 039. How to paint stroke in QSqlTableModel by value in the column?

Ну в моём примере, который в статье сработало так model->setData(model->index(1, 1), 7); Поскольку model->index(1, 0) - это индекс колонки id, которая скрыта, поэтому…
Now discuss on the forum
May 29, 2020, 8:52 a.m.
Vladimir Sergeevich

Масштабирование двумя пальцами на мобильных платформах

Я планировал описать этот момент на блоге, но никак руки не доходят (уже год). Летом дойдут. Тем не менее, у меня в репозитории лежит рабочий код игрушки "пазлы", где есть все это. …
May 29, 2020, 7:51 a.m.
Evgenij Legotskoj

Графическое ускорение

Зависит от платформы и поддерживаемых технологий. В QML в первую очередь используется OpenGL и отрисовка производится средствами GPU. Но может переключаться на использование CPU и прог…
IP
May 29, 2020, 2:55 a.m.
Igor' Poroshin

QTablwView + QSqlQueryModel скрыть пустой столбец

Да, понятно. В данном случае лучше использовать серверную процедуру (если такие поддерживаются), в которой будет проверяться наличие всех пустых строк у нужного столбца и вызываться соответ…
RG
May 28, 2020, 7:21 p.m.
Rovshan Gurbanov

Сборка под старые версии Android

У меня SDK почти все версии есть, NDK есть версии 10, 17, 21. Но собирается приложение только с NDK v21 под Android версии 7.0 и выше Версия Qt у меня 5.14.2
May 28, 2020, 8:58 a.m.
Evgenij Legotskoj

Освобождение памяти QMainWindow::setCentralWidget

Да, соглашусь. Просто удаление происходит позже, а не сразу.
About
Services
© EVILEG 2015-2020
Recommend hosting TIMEWEB