All Posts Create a Post  
1
votes
552
views
Auto-create primary key used when not defining a primary key type warning in Django
Posted at 8 months, 2 weeks ago / May 2, 2021, 11:26 a.m.

I just updated my python from 3.9.1 to 3.9.4. When I tried to run the server. The console gave me a warning for this: WARNINGS: learning_logs.Entry: (models.W042) Auto-created primary key …

146 7 7 0
1
votes
367
views
How to create Django Language Middleware
Posted at 1 year, 3 months ago / Oct. 11, 2020, 8:04 a.m.

This example below to setup default language code as id (Indonesian). Your file middleware.py # -*- coding: utf-8 -*- from django.conf import settings from django.utils import translation from django.utils.deprecation import …

146 7 7 0
1
votes
427
views
How to custom select language icon in django administration
Posted at 1 year, 3 months ago / Oct. 11, 2020, 8:04 a.m.

1. Add the base_site file inside templates/admin/base_site.html. {% extends "admin/base.html" %} {% load static i18n %} {% block title %}{{ title }} | {{ site_title|default:_('Situs django admin') }}{% endblock %} …

146 7 7 0
1
votes
349
views
How to remove user from telegram channel using python
Posted at 8 months ago / May 20, 2021, midnight

I am using telethon for adding users in the telegram channel but how to remove or delete users from Particular telegram channels? There is one function to restrict user so …

146 7 7 0
1
votes
591
views
Django Standard API Response Middleware for DRF
Posted at 1 year, 3 months ago / Oct. 11, 2020, 8:04 a.m.

As you can see, if you using django-rest-framework, you will found many different response format. This middleware to solve all of these problems with implement the Standard API Response. All …

146 7 7 0
1
votes
417
views
Pylint-django raising error about Django not being configured when that's not the case (VSCode)
Posted at 8 months, 2 weeks ago / May 2, 2021, noon

Pylint-django worked just fine up to version 2.3.x but since 2.4.0 it reports an error on every python-django file: Django was not configured. For more information runpylint–load-plugins=pylint_django –help-msg=django-not-configuredpylint(django-not-configured) This happens …

146 7 7 0
0
votes
526
views
Regular expression to replace second occurrence of dot
Posted at 8 months ago / May 19, 2021, noon

String is Hello.world.hello. I wanted to replace the second occurrence of the dot with ‘_’. str = "Hello. world. Hello!" x = re.sub(r'^((.){1}).', r'\1_', str) #x = str.find(str.find('.') print(x) The …

146 7 7 0
0
votes
179
views
Create a column based on the aggregation of values from multiple column at multiple row indexes
Posted at 8 months ago / May 19, 2021, 8:17 a.m.

I’m trying to translate a technical analysis operator from another proprietary language to python as using dataframes, but I got stuck on a problem that seems rather simple, but I …

146 7 7 0
0
votes
640
views
How to automaticly backup your projects into external hardisk in ubuntu?
Posted at 1 year, 3 months ago / Oct. 11, 2020, 8:04 a.m.

Rsync, which stands for “remote sync”, is a remote and local file synchronization tool. It uses an algorithm that minimizes the amount of data copied by only moving the portions …

146 7 7 0
0
votes
343
views
Converting django object values dict into native datatype
Posted at 9 months, 2 weeks ago / April 7, 2021, 8:53 p.m.

I’m trying to get specific fields from my database using the object.values() attribute, as such: stocks = Stock.objects.values("ticker", "stock", "exchange__exchange_code", "earnings_yield", "roic") The reason I’m not using Stock.objects.filter()... is because …

146 7 7 0
  Page 1 of 11