Re: django html error

2022-04-03 Thread Rakesh Sharma
Will you send me some project codes pics so that i can help you.

On Sat, 2 Apr, 2022, 8:34 pm 5021-Chandra Prakash.S, <
chan8754584...@gmail.com> wrote:

> i am new to django, there is no error in my project but my html page is
> not loading ,its just appearing white blank screen when i run the server.I
> had checked settings.py file and edited the templates setting but then too
> my html file isn't loading.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e2efbfba-b612-48d8-9012-e277cb21d7e9n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOzzt0V3KYgXqfbmCbqpRpvN2fwqV%2BnPrdBD%3Dpf35fdd_vGZDw%40mail.gmail.com.


Re: Is Overriding widget templates buggy?

2022-04-03 Thread Antonis Christofides

Hi,

I'm not really an expert in that part. From what I can read in the 
documentation, TemplatesSetting isn't a template backend, so why do you think 
you can specify it in TEMPLATES[x]['BACKEND']? It appears to be a form renderer, 
which means you can specify it in FORM_RENDERER.


But of course I may have understood something wrong myself.

Regards,

Antonis



On 03/04/2022 20.56, run_the_race wrote:

I was going to report a bug, but the guide recommends asking here first.

While trying to override a built in widget template (still stuck on it here: 
https://forum.djangoproject.com/t/overriding-widgets-templates-not-working-following-help-template-loader-not-searching-app-dirs/12974), 
I came across this weird behavoir:


In `django/forms/renderers.py` line 59 it has:
```
class TemplatesSetting(BaseRenderer):
    """
    Load templates using template.loader.get_template() which is configured
    based on settings.TEMPLATES.
    """
    def get_template(self, template_name):
        return get_template(template_name)
```
However a new project with:
```
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
            ],
        },
    },
    {
        'BACKEND': 'django.forms.renderers.TemplatesSetting',
        'DIRS': ['/my/overide/dir/path',],
        'APP_DIRS': False,
    },
]
```

Generates the error:
```

Traceback (most recent call last):
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py", 
line 66, in __getitem__

    return self._engines[alias]
KeyError: 'renderers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/michael/project/src/manage.py", line 16, in 
    execute_from_command_line(sys.argv)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/__init__.py", 
line 425, in execute_from_command_line

    utility.execute()
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/__init__.py", 
line 419, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py", 
line 373, in run_from_argv

    self.execute(*args, **cmd_options)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py", 
line 417, in execute

    output = self.handle(*args, **options)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/commands/check.py", 
line 63, in handle

    self.check(
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py", 
line 438, in check

    all_issues = checks.run_checks(
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/checks/registry.py", 
line 77, in run_checks

    new_errors = check(app_configs=app_configs, databases=databases)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/contrib/admin/checks.py", 
line 78, in check_dependencies

    for engine in engines.all():
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py", 
line 90, in all

    return [self[alias] for alias in self]
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py", 
line 90, in 

    return [self[alias] for alias in self]
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py", 
line 81, in __getitem__

    engine = engine_cls(params)
TypeError: TemplatesSetting() takes no arguments
```

How does one configure `django.forms.renderers.TemplatesSetting` without it 
throwing an error?

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b5182cf-cef1-463b-bb6a-2fb96b893b56n%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/77d0dd37-b0bb-ec64-cc05-a59712a3a54d%40antonischristofides.com.


Is Overriding widget templates buggy?

2022-04-03 Thread run_the_race
I was going to report a bug, but the guide recommends asking here first.

While trying to override a built in widget template (still stuck on it 
here: 
https://forum.djangoproject.com/t/overriding-widgets-templates-not-working-following-help-template-loader-not-searching-app-dirs/12974),
  
I came across this weird behavoir:

In `django/forms/renderers.py` line 59 it has:
```
class TemplatesSetting(BaseRenderer):
"""
Load templates using template.loader.get_template() which is configured
based on settings.TEMPLATES.
"""
def get_template(self, template_name):
return get_template(template_name)
```
However a new project with:
```
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
{
'BACKEND': 'django.forms.renderers.TemplatesSetting',
'DIRS': ['/my/overide/dir/path',],
'APP_DIRS': False,
},
]
```

Generates the error:
```

Traceback (most recent call last):
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py",
 
line 66, in __getitem__
return self._engines[alias]
KeyError: 'renderers'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/michael/project/src/manage.py", line 16, in 
execute_from_command_line(sys.argv)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/__init__.py",
 
line 425, in execute_from_command_line
utility.execute()
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/__init__.py",
 
line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py",
 
line 373, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py",
 
line 417, in execute
output = self.handle(*args, **options)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/commands/check.py",
 
line 63, in handle
self.check(
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/management/base.py",
 
line 438, in check
all_issues = checks.run_checks(
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/core/checks/registry.py",
 
line 77, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/contrib/admin/checks.py",
 
line 78, in check_dependencies
for engine in engines.all():
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py",
 
line 90, in all
return [self[alias] for alias in self]
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py",
 
line 90, in 
return [self[alias] for alias in self]
  File 
"/home/michael/.venv/project/lib/python3.8/site-packages/django/template/utils.py",
 
line 81, in __getitem__
engine = engine_cls(params)
TypeError: TemplatesSetting() takes no arguments
```

How does one configure `django.forms.renderers.TemplatesSetting` without it 
throwing an error?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b5182cf-cef1-463b-bb6a-2fb96b893b56n%40googlegroups.com.


Re: jinja

2022-04-03 Thread jelli jinx
hello

On Tuesday, March 22, 2022 at 11:18:49 PM UTC+6:30 vas91...@gmail.com wrote:

> rfr

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ef6bb438-1831-43ef-ba72-ecc18e7eb951n%40googlegroups.com.


Re: django queryset - Get the data particular to current year only

2022-04-03 Thread Lalit Suthar
I think this is related to your query
https://stackoverflow.com/a/28101722/8882295

On Thu, 31 Mar 2022 at 11:22, Trippy Samurai 
wrote:

>
> 
>
> I have my query written to get some thing from database and display on my
> website that query is getting all the data from db but what if i want to
> get the data particular to current year only
>
>
> def get(self, request, *args, **kwargs):
> filters = self.get_filters()
>
> result = Model.objects.all().filter(*filters).distinct().aggregate(
> t=Sum('t'),
> b=Sum('b'),
> )
>
> result2 = Model.objects.all().filter(*filters).distinct().aggregate(
> past_due=Sum('balance', filter=Q(due_date__lt=timezone.now()))
> )
>
> zero = Decimal('0.00')
>
> total = result['t'] or zero
> balance = result['b'] or zero
> past_due = result2['past_due'] or zero
> amount_received = t - b
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0959467-786f-4701-9d68-abd2e54c3aaan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGoatg_BEPt-jYQVD7_%3DURdhraY%3D8KWvrL40yBJ0vYSSg%40mail.gmail.com.