xgettext (GNU gettext-tools) 0.20.2
Copyright (C) 1995-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Автор программы - Ульрих Дреппер (Ulrich Drepper).
...ocessing locale en
from django.core.management.base import BaseCommand, CommandError
from articles.models import Article
import sys
from PyQt5 import QtWidgets
class Command(BaseCommand):
def handle(self, *args, **options):
a = Article.objects.get(id = 1)
print(a)
class Test(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.resize(500, 500)
label = QtWidgets.QLabel(self)
label.setText("TEXT-{}".format(a))
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
w = Test()
w.show()
sys.exit(app.exec_())
python D:/test_progect/articles/my_code.py.
from models import MyCommand
a = MyCommand.objects.get('id' = 1)
print(a)
articles/
__init__.py
models.py
management/
commands/
_private.py
closepoll.py
tests.py
views.py
from articles.models import MyCommand as Poll
from django.core.management.base import BaseCommand, CommandError
from artickles.models import MyCommand
a = MyCommand
a.save()
arr1 = {'val1': 1, 'val2': 2, 'val3': 3, 'val5':4}
arr2 = {'val1': 6, 'val2': 7, 'val3': 8}
arr3 = {'val1': 9, 'val2': 10, 'val3': 11, 'val4': 12}
something = {
'd': arr1,
'c': arr2,
'a': arr3,
}
default_value = '0000000'
if_val = 'a'
val_1 = 'val4'
val_2 = 'val5'
val_3 = 'val6'
print(f"Val4: {something.get(if_val, {}).get(val_1, arr1.get(val_1, default_value))}")
print(f"Val5: {something.get(if_val, {}).get(val_2, arr1.get(val_2, default_value))}")
print(f"Val6: {something.get(if_val, {}).get(val_3, arr1.get(val_3, default_value))}"
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(PROJECT_ROOT, '_apps_'))
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(PROJECT_ROOT, '_apps_'))
INSTALLED_APPS = [
'articles.apps.ArticlesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('articles/', include('articles.urls')),
path('admin/', admin.site.urls),
]
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = "index")
]
#from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Привет Мир!')
INSTALLED_APPS = [
'articles.apps.ArticlesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
python manage.py makemigrations articles
python manage.py makemessages -i en -e html
нет результата