Re: How to use different templates for different sites/domains

2024-05-29 Thread Faisal Mahmood
You're right, using a single Django instance to serve multiple sites with
overridden templates can be tricky. While a custom template loader might
seem appealing, it's true that it doesn't accept the request object by
default. Here's the breakdown and some alternative solutions:

The Challenge:

   - Django's default template loader doesn't consider the current domain
   when searching for templates.
   - You want to use a single Django instance but have domain-specific
   templates.

Less Ugly Solutions:

   1.

   Template Name Prefixing:
   - Prefix your template names with the domain name. For example,
  domain1/home.html and domain2/home.html.
  - In your views, construct the full template name based on the
  current domain (using get_current_site).
  - This approach is simple but can make template names lengthy and
  less readable.
   2.

   Template Inheritance with Context Processors:
   - Create a base template with common elements.
  - Inherit from the base template for each domain-specific template.
  - Use a context processor to inject the current domain information
  into the context.
  - In your domain-specific templates, use the domain information to
  conditionally render specific content.
  - This approach offers flexibility but requires more code in
  templates and context processors.
   3.

   Third-Party Packages:
   - Consider packages like django-sites-templates or
  django-multihost-template-loader.
  - These packages provide custom template loaders that can leverage
  the request object to determine the appropriate template based on the
  domain.
  - This approach can be a good option if the built-in solutions don't
  meet your needs.

Middleware with Context Variables (Least Ugly Hack):

   - While not ideal, storing the request object in a context variable
   using middleware is a workable solution.
   - However, be mindful of potential issues like variable name conflicts
   and unnecessary data passed to every template.

Choosing the Best Approach:

The best solution depends on your project's complexity and preference.
Here's a quick guide:

   - Simple Projects: Template Name Prefixing might suffice.
   - More Complex Projects: Consider Template Inheritance with Context
   Processors or Third-Party Packages for better maintainability.
   - Last Resort: Use the Middleware approach cautiously if other options
   aren't feasible.

Remember, the key is to find a balance between simplicity and
maintainability. Leverage built-in features and explore third-party
packages before resorting to complex hacks.

I'm available if you want further assistance or questions about it

Have a good day ahead.

On Wed, May 29, 2024, 5:52 AM Mike Dewhirst  wrote:

> On 28/05/2024 9:09 pm, Antonis Christofides wrote:
>
> Hello,
>
> I use the sites framework for a Django project that serves many different
> domains. But each of those domains has some templates overridden.
>
>
> Might depend on what you are overriding - entire templates or just
> includes or just vars.
>
> I would probably start by refactoring the templates so they were identical
> for all sites and reduce/extract the differences to includes which can be
> selected via contextvars after calling get_current_site() from the view.
>
> Have you looked at template tags?
>
> I use them for displaying additional information on the staging and dev
> sites versus production. Not what you are doing so I haven't thought too
> hard about that. Only worth a thought if you haven't considered it.
>
>
> If I used a different instance of Django (i.e. a different gunicorn
> service) for each domain, I'd have different settings for each site. But
> I'm using a single instance to serve all sites and, wherever I need to, I
> use things that extract the domain from the request, like
> `get_current_site()`. But this doesn't seem to work with templates. A
> custom template loader won't work without a fight because its methods don't
> accept the request object as an argument.
>
> All solutions I've thought about are ugly hacks.
>
>
> Practicality beats purity
>
> The least ugly seems to be to create middleware that stores the request
> object in a contextvar
> <https://docs.python.org/3/library/contextvars.html>. But it strikes me
> that I can't find a simpler solution for this. Is what I want that
> uncommon, or am I missing something?
>
> There's an old closed "wontfix" ticket
> <https://code.djangoproject.com/ticket/13500> about this but without
> adequate explanation.
> --
> 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.
> T

Re: How to use different templates for different sites/domains

2024-05-28 Thread Mike Dewhirst

On 28/05/2024 9:09 pm, Antonis Christofides wrote:

Hello,

I use the sites framework for a Django project that serves many 
different domains. But each of those domains has some templates 
overridden.


Might depend on what you are overriding - entire templates or just 
includes or just vars.


I would probably start by refactoring the templates so they were 
identical for all sites and reduce/extract the differences to includes 
which can be selected via contextvars after calling get_current_site() 
from the view.


Have you looked at template tags?

I use them for displaying additional information on the staging and dev 
sites versus production. Not what you are doing so I haven't thought too 
hard about that. Only worth a thought if you haven't considered it.




If I used a different instance of Django (i.e. a different gunicorn 
service) for each domain, I'd have different settings for each site. 
But I'm using a single instance to serve all sites and, wherever I 
need to, I use things that extract the domain from the request, like 
`get_current_site()`. But this doesn't seem to work with templates. A 
custom template loader won't work without a fight because its methods 
don't accept the request object as an argument.


All solutions I've thought about are ugly hacks.


Practicality beats purity

The least ugly seems to be to create middleware that stores the 
request object in a contextvar 
<https://docs.python.org/3/library/contextvars.html>. But it strikes 
me that I can't find a simpler solution for this. Is what I want that 
uncommon, or am I missing something?


There's an old closed "wontfix" ticket 
<https://code.djangoproject.com/ticket/13500> about this but without 
adequate explanation.

--
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/175b4601-2038-479b-9581-48d9c196df7cn%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/175b4601-2038-479b-9581-48d9c196df7cn%40googlegroups.com?utm_medium=email_source=footer>.



--
We recommend signal.org

Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.

--
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/befa4ac2-40b8-44da-87c2-cbbe3ed307c6%40dewhirst.com.au.


OpenPGP_signature.asc
Description: OpenPGP digital signature


How to use different templates for different sites/domains

2024-05-28 Thread Antonis Christofides
Hello,

I use the sites framework for a Django project that serves many different 
domains. But each of those domains has some templates overridden.

If I used a different instance of Django (i.e. a different gunicorn 
service) for each domain, I'd have different settings for each site. But 
I'm using a single instance to serve all sites and, wherever I need to, I 
use things that extract the domain from the request, like 
`get_current_site()`. But this doesn't seem to work with templates. A 
custom template loader won't work without a fight because its methods don't 
accept the request object as an argument.

All solutions I've thought about are ugly hacks. The least ugly seems to be 
to create middleware that stores the request object in a contextvar 
<https://docs.python.org/3/library/contextvars.html>. But it strikes me 
that I can't find a simpler solution for this. Is what I want that 
uncommon, or am I missing something?

There's an old closed "wontfix" ticket 
<https://code.djangoproject.com/ticket/13500> about this but without 
adequate explanation.

-- 
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/175b4601-2038-479b-9581-48d9c196df7cn%40googlegroups.com.


Re: how to display group and create user permission in templates?

2024-02-20 Thread ABDUL HAFEEZ
much appreciated


On Tuesday, February 20, 2024 at 7:55:47 AM UTC+5 Ryan Nowakowski wrote:

> On Mon, Feb 19, 2024 at 02:16:29AM -0800, ABDUL HAFEEZ wrote:
> > Hell all how to display *createsuperuser *and there permission in 
> *templates 
> > *instead of admin dashboard 
>
> Users and permissions are just normal Django models[1]. You can create
> your own view and add those objects to the template context then render
> the template just like you would for any other Django view.
>
>
> [1] 
> https://github.com/django/django/blob/a684d73fc9ad94bbc535385d8b1d7c05ea06702f/django/contrib/auth/models.py
>

-- 
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/80a349f5-832d-43bc-8496-920621ece825n%40googlegroups.com.


how to display group and create user permission in templates?

2024-02-19 Thread ABDUL HAFEEZ
Hell all how to display *createsuperuser *and there permission in *templates 
*instead of admin dashboard 

-- 
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/f37cffcd-b425-466b-b247-39bac00a1809n%40googlegroups.com.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2023-03-12 Thread Amar Zamoum
I just had the same problem, and i realized that i had the templates file 
in the wrong "mysite" folder. It is easy to confuse the two, so for whoever 
has the same problem, just check where exactly you have put the 
"template/admin" folders, because in the tutorial it says to put inside the 
folder that contains the manage.py file.

Le mardi 26 avril 2016 à 00:34:06 UTC+2, Luis Zárate a écrit :

> Sory for not answer before, but I think I could help.
>
> First you need to know how django find the templates, so take a look 
> template loaders
>
>
> https://docs.djangoproject.com/en/1.9/ref/templates/api/#django.template.loaders.filesystem.Loader
>
> There are two default loaders (filesystem and app ) 
>
> ['django.template.loaders.filesystem.Loader',
>  'django.template.loaders.app_directories.Loader']
>
> so take a look 
> https://docs.djangoproject.com/en/1.9/ref/settings/#template-loaders
>
> So is important the app order.
>
>
>
>
> 2016-04-22 3:21 GMT-06:00 woodz :
>
>> Aloha Andreas Ka,
>>
>> have you been able to get this to work? I am currently going through the 
>> version 1.9 and facing the same issue. Is the suggestion of Marc Moncrief
>> * a way to go? Did you go for your own solution and would you mind to 
>> share?*Thanks a lot, woodz
>>
>>
>> On Sunday, November 16, 2014 at 7:15:59 PM UTC+1, Andreas Ka wrote:
>>>
>>> I am working through 
>>> https://docs.djangoproject.com/en/1.7/intro/tutorial02
>>> so far all went fine - but now *templates changes just don't work.*
>>>
>>>
>>>
>>> I think there must be a flaw in that tutorial, something missing,
>>> or something different in django 1.7.1 ?
>>>
>>> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel
>>>
>>>
>>> my versions:
>>>
>>> python -c "import django; print(django.get_version())"
>>> 1.7.1
>>>
>>> python --version
>>> Python 2.7.3
>>>
>>>
>>>
>>> *SYMPTOM:*
>>>
>>> my changes in 
>>> mysite/templates/admin/base_site.html   
>>> are simply ignored.
>>>
>>>
>>>
>>> These are my files:
>>>
>>> mysite# tree
>>> .
>>> ├── db.sqlite3
>>> ├── manage.py
>>> ├── mysite
>>> │   ├── __init__.py
>>> │   ├── settings.py
>>> │   ├── urls.py
>>> │   └── wsgi.py
>>> ├── polls
>>> │   ├── admin.py
>>> │   ├── __init__.py
>>> │   ├── migrations
>>> │   │   ├── 0001_initial.py
>>> │   │   └── __init__.py
>>> │   ├── models.py
>>> │   ├── tests.py
>>> │   └── views.py
>>> └── templates
>>> └── admin
>>> └── base_site.html
>>>
>>>
>>>
>>> mysite/settings.py:
>>>
>>> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>>>
>>>
>>> *Whatever I do, the page*
>>> *http://myserver:8000/admin/polls/question/ 
>>> <http://myserver:8000/admin/polls/question/>*
>>> *still keeps the old title 'Django administration'*
>>>
>>>
>>> I want to understand how templates work, because I need them for my real 
>>> project.
>>>
>>> Thanks a lot!
>>>
>>>
>>> -- 
>> 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...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>>
> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/7dd97c54-6128-4aa9-aab6-165a7c0c41ac%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/7dd97c54-6128-4aa9-aab6-165a7c0c41ac%40googlegroups.com?utm_medium=email_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
>

-- 
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/24ce7663-ec8a-4643-900f-312f2e239f4en%40googlegroups.com.


Django Regoup - Sum in templates

2022-09-28 Thread aXXyss Soluciones


Hi, I want to get the Volume subtotal of my "Contracts" field grouped in my 
template.

I manage to display the total but not the subtotal.


*models.py*
class TransColisCgDlaDet(models.Model):

id_trans_colis = models.AutoField(primary_key=True)
essence = models.CharField(max_length=15, blank=True, null=True, 
verbose_name='Essence')
num_colis = models.CharField(max_length=15, blank=True, null=True, 
verbose_name='Numéro de Colis')
cubage = models.DecimalField(max_digits=6, decimal_places=3, blank=True, 
null=True, verbose_name='Cubage')
num_contrat = models.CharField(max_length=15, blank=False, null=True, 
verbose_name='Numéro de Contrat')

class Meta:
managed = True
db_table = 'TransColisCgDlaDet'
verbose_name = 'Transport de Colis Détaillé '
verbose_name_plural = 'Transports de Colis Détaillés'
ordering = ['num_colis']

def __str__(self):
return str(self.num_colis) 

*views.py*
class TransportDetListView(LoginRequiredMixin,ListView):
login_url = 'admin:login'
model = TransColisCgDlaDet
template_name = "transports/trans_detail.html"
paginate_by = 15

def get_queryset(self):
queryset =  
TransColisCgDlaDet.objects.filter(code_trans__contains=self.kwargs['code_trans']).order_by('num_contrat','essence','
 'num_colis')
lstcolis = queryset.values(
'num_contrat'
).annotate(volcolis=Sum('cubage')).annotate(nb_elts=Sum('nbre_elts'))

return lstcolis

I would the subtotal for the contrats y the template:

Contrat: 2475
-
*Essence  /  Num Colis  /  Cubage*
SIPO  /  22  /  2,378
SIPO  /  23  /  1.251
--
Subtotal : 3,629

Contrat: 2500

*Essence  /  Num Colis  /  Cubage*
SAPELLI  /  572  /  3.001
SAPELLI  /  573  /  1.501
--
Subtotal : 4.502

TOTAL:  8.131


Any ideas for how manage this?

Thanks


-- 
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/9da7cce8-8512-497c-897c-4c35eb53102en%40googlegroups.com.


Re: How To expertise Django templates Language(DTL)

2022-05-23 Thread Mike Dewhirst

On 24/05/2022 4:30 am, waqar khan wrote:

How To expertise Django templates Language(DTL)

Kindy help me,
i am intermediate DTL , any budy suggest link , you  tube video or books.


This is likely your best bet ...

https://docs.djangoproject.com/en/4.0/topics/templates/


--
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/c0f39995-27c9-4b27-a766-37235da81e95n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/c0f39995-27c9-4b27-a766-37235da81e95n%40googlegroups.com?utm_medium=email_source=footer>.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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/e3489674-63a0-0e19-814b-952344973dfe%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


How To expertise Django templates Language(DTL)

2022-05-23 Thread waqar khan
How To expertise Django templates Language(DTL)

Kindy help me,
i am intermediate DTL , any budy suggest link , you  tube video or books.  

-- 
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/c0f39995-27c9-4b27-a766-37235da81e95n%40googlegroups.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 
<https://groups.google.com/d/msgid/django-users/2b5182cf-cef1-463b-bb6a-2fb96b893b56n%40googlegroups.com?utm_medium=email_source=footer>.


--
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: What methods are available to determining display type & screen dimensions for dynamic formatting of Django templates.

2022-03-17 Thread Jason
It does seem like you're looking for something related to analytics, ie 
Google Analytics or one of the alternatives.
On Thursday, March 17, 2022 at 5:52:14 AM UTC-4 Django2021 wrote:

> Increasingly we are finding the need to have reactive Django templates, in 
> order to present cross platform Django forms and pages to not only desktop 
> users buy also tablet, and mobile phone users.
>
> We realize Bootstrap offers breakpoints as a means to control columns, 
> still we are looking for more direct ways of getting essential display 
> information including width, height, device type, and OS for taking control 
> of our own breakpoints where further customization is needed.
>
> Is there a best practice, mature or fully cross platform method recognized 
> by Django users for gathering essential display information as required for 
> reactive Django templates?
>
> And if not what are the most promising techniques other than Bootstrap for 
> Django developers in use for building reactive templates?
>
>
>
>
>
>
>

-- 
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/f7866f28-5c99-427b-a1f6-a7802c3953a5n%40googlegroups.com.


What methods are available to determining display type & screen dimensions for dynamic formatting of Django templates.

2022-03-17 Thread Django2021
Increasingly we are finding the need to have reactive Django templates, in 
order to present cross platform Django forms and pages to not only desktop 
users buy also tablet, and mobile phone users.

We realize Bootstrap offers breakpoints as a means to control columns, 
still we are looking for more direct ways of getting essential display 
information including width, height, device type, and OS for taking control 
of our own breakpoints where further customization is needed.

Is there a best practice, mature or fully cross platform method recognized 
by Django users for gathering essential display information as required for 
reactive Django templates?

And if not what are the most promising techniques other than Bootstrap for 
Django developers in use for building reactive templates?






-- 
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/cd9dd5f6-9b0e-430b-b458-20c969abd3d7n%40googlegroups.com.


Re: Reusable django templates

2022-03-14 Thread Heman Okumbo
Can't customize individual templates:the templates inherit all the
properties of the base template  eg styling and content.I am not able to
add custom content to the template that inherits from base template.

On Sat, Mar 12, 2022, 21:37 Clive Bruton  wrote:

>
> On 12 Mar 2022, at 17:43, Heman Okumbo wrote:
>
> > How comes I'm not able to modify my templates after extending from
> > a base template.eg can't add extra contents,the template only
> > display contents of the inherited template.
>
> Some code might help. It's not really clear to me what you are asking.
>
> But at a guess, you can use the {% include … %} template function to
> extend templates.
>
>
> -- Clive
>
> --
> 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/2B3DC48B-D567-45A9-B182-66D13D81B4AF%40indx.co.uk
> .
>

-- 
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/CAJt9CbgRwoH5v_ULX9tGbjyaBtizZMg-PW8f-VKO94apTcpaQg%40mail.gmail.com.


Re: Reusable django templates

2022-03-12 Thread Clive Bruton



On 12 Mar 2022, at 17:43, Heman Okumbo wrote:

How comes I'm not able to modify my templates after extending from  
a base template.eg can't add extra contents,the template only  
display contents of the inherited template.


Some code might help. It's not really clear to me what you are asking.

But at a guess, you can use the {% include … %} template function to  
extend templates.



-- Clive

--
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/2B3DC48B-D567-45A9-B182-66D13D81B4AF%40indx.co.uk.


Reusable django templates

2022-03-12 Thread Heman Okumbo
How comes I'm not able to modify my templates after extending from a base
template.eg can't add extra contents,the template only display contents of
the inherited template.

-- 
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/CAJt9CbhJjE61OES-iTrRicpxH9GwtjPaWKr4wVovH%3DTsZqc8TQ%40mail.gmail.com.


Reusable form templates not working in Django 4.0?!

2022-01-30 Thread Sammeeey
Please find the respective post in the Django Forum 
<https://forum.djangoproject.com/t/reusable-form-templates-not-working-in-django-4-0/11886>

-- 
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/d1082262-7028-484b-968b-487ea128e59cn%40googlegroups.com.


"include super" with django templates?

2021-12-30 Thread Nick Farrell
I would like to extend a django template which is used via the include 
macro. That is, I want to add additional output before or after what would 
otherwise be emitted.

With the normal {% block %} syntax, it's easy to use super to follow the 
template heirachy similar to __mro__ - but to my knowledge there isn't an 
equivalent for include().

For example, form.as_p() calls render() with a template (by default, 
django/forms/p.html). I want my application to modify this, so whenever 
p.html is rendered, it is wrapped by my application's supplied template. 
(As I want this to work for any form instance, I cannot just override the 
default template name)

Another example is 
say django/forms/templates/django/forms/widgets/number.html. It consists of 
a single include() statement pointint to input.html. I would like to 
override input.html, but in a way which eventually renders the original 
template, in addition to my application's template.

Any suggestions?

Thanks.

-- 
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/9ab15060-2dcd-44a0-abe3-eaeed8015813n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-24 Thread Lalit Suthar
I have gone through your views and template. They are looking fine to me.
Are you getting any error?

On Wed, 24 Nov 2021 at 23:02, Lalit Suthar  wrote:

> > Anyone plz review my code i am struggling to figure out what the issue
> here is
>
> What is the issue you are trying to resolve right now?
>

-- 
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/CAGp2JVHOnmK%3DvUZjWrT0vjYZi-sfpUWdAxkVDCp6A8uG_foAZg%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-24 Thread Lalit Suthar
> Anyone plz review my code i am struggling to figure out what the issue
here is

What is the issue you are trying to resolve right now?

-- 
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/CAGp2JVGfs5rLeSZb_OUfaeByYH7xV77PBzNFmC805m_xuqyT%2BA%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Its done bro model is configured already i didn't just posted the models.py 
file

On Monday, 22 November 2021 at 21:18:12 UTC+5:30 ram.asf...@gmail.com wrote:

> will update asap
>
> On Mon, Nov 22, 2021 at 1:22 PM David Nugent  wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template 
>> based on whatever type of ticket you're managing or you can change the 
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with 
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
>> -- 
>>
> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.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/8a2eadcf-5733-439b-b763-4eb70db91429n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread ram s
i think u forgot to configure model, please once configure and complete
check first

On Mon, Nov 22, 2021 at 4:36 PM Trippy Samurai 
wrote:

> Thanks David for the idea i appreciate it i have gone with last way of
> doing things but it doesnt render anything on data
>
> Pls correct my code below
>
>
>
> *views.py:*
>
> class DeveloperTicketView(TemplateView):
> template_name = 'app/ticket_view.html'
> ticket = Ticket.objects.all()
> extra_content = {'ticket_type':ticket}
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
> context['accepted_tickets'] = Ticket.objects.filter(status =
> 'Accepted',accepted_by = self.request.user)
> context['completed_tickets'] = Ticket.objects.filter(status =
> 'Completed',accepted_by = self.request.user)
> context['closed_tickets'] = Ticket.objects.filter(status =
> 'Closed',accepted_by = self.request.user)
> return context
>
>
>
> ticket_view.html
>
> {% extends 'app/base.html' %}
>
> {% block body %}
> {% for tickets in ticket_type%}
> {% if tickets.status == "Opened" %}
> 
> 
> 
> ID
> Status
> Created
> Title
> Description
> 
> 
> 
> {% for ticket in open_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
>  Accept
> 
> {% endfor %}
> 
> {% elif tickets.status == 'Accepted' %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in accepted_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> Complete
> 
> {% endfor %}
> 
>
> {% elif tickets.status == 'Completed' %}
>
> 
>
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in completed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% else %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in closed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% endif %}
> {% endfor %}
> {% endblock %}
>
>
>
>
> On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template
>> based on whatever type of ticket you're managing or you can change the
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
> --
> 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/786fa7af-0a81-4cf7-9a2e-c2fd2e9f0323n%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/CAOGms2_ZR_rrHuANSVAAA0Ca5ow9HVzLHQDVBf%3Dz2XjBEGTmYg%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-22 Thread ram s
will update asap

On Mon, Nov 22, 2021 at 1:22 PM David Nugent  wrote:

> Well, there are several ways you can deal with that.
>
> Probably easiest is to override get_template() and switch the template
> based on whatever type of ticket you're managing or you can change the
> value of self.template_name based on the request.
>
> Or maybe you prefer a single template to deal with all cases with
> conditional blocks where appropriate.
>
>
> Regards,
> David
>
> --
> 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/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.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/CAOGms2_2O%3DqKRqKTPcy7GNUeWEJu-tuJPfHwr93KVr91sAYHOA%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Anyone plz review my code i am struggling to figure out what the issue here 
is

On Monday, 22 November 2021 at 16:35:32 UTC+5:30 Trippy Samurai wrote:

> Thanks David for the idea i appreciate it i have gone with last way of 
> doing things but it doesnt render anything on data
>
> Pls correct my code below 
>
>
>
> *views.py:*
>
> class DeveloperTicketView(TemplateView):
> template_name = 'app/ticket_view.html'
> ticket = Ticket.objects.all()
> extra_content = {'ticket_type':ticket}
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
> context['accepted_tickets'] = Ticket.objects.filter(status = 
> 'Accepted',accepted_by = self.request.user)
> context['completed_tickets'] = Ticket.objects.filter(status = 
> 'Completed',accepted_by = self.request.user)
> context['closed_tickets'] = Ticket.objects.filter(status = 
> 'Closed',accepted_by = self.request.user)
> return context
>
>
>
> ticket_view.html
>
> {% extends 'app/base.html' %}
>
> {% block body %} 
> {% for tickets in ticket_type%}
> {% if tickets.status == "Opened" %}
> 
> 
> 
> ID
> Status
> Created
> Title
> Description
> 
> 
> 
> {% for ticket in open_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
>  Accept
> 
> {% endfor %}
> 
> {% elif tickets.status == 'Accepted' %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
>  
>
> 
> {% for ticket in accepted_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> Complete
> 
> {% endfor %}
> 
>
> {% elif tickets.status == 'Completed' %}
>
> 
>
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
>  
>
> 
> {% for ticket in completed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% else %}
> 
> 
> 
> ID
> Status
> Created by
> Title
> Description
> 
> 
>
> 
> {% for ticket in closed_tickets %}
> 
> {{ ticket.id }}
> {{ ticket.status }}
> {{ ticket.created_by }}
> {{ ticket.ticket_title }}
> {{ ticket.ticket_description }}
> 
> {% endfor %}
> {% endif %}
> {% endfor %}
> {% endblock %}
>
>
>
>
> On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:
>
>> Well, there are several ways you can deal with that.
>>
>> Probably easiest is to override get_template() and switch the template 
>> based on whatever type of ticket you're managing or you can change the 
>> value of self.template_name based on the request.
>>
>> Or maybe you prefer a single template to deal with all cases with 
>> conditional blocks where appropriate.
>>
>>
>> Regards,
>> David
>>
>

-- 
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/c31184b3-6ab9-4b71-a233-6b81cb5e4331n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-22 Thread Trippy Samurai
Thanks David for the idea i appreciate it i have gone with last way of 
doing things but it doesnt render anything on data

Pls correct my code below 



*views.py:*

class DeveloperTicketView(TemplateView):
template_name = 'app/ticket_view.html'
ticket = Ticket.objects.all()
extra_content = {'ticket_type':ticket}

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
context['accepted_tickets'] = Ticket.objects.filter(status = 
'Accepted',accepted_by = self.request.user)
context['completed_tickets'] = Ticket.objects.filter(status = 
'Completed',accepted_by = self.request.user)
context['closed_tickets'] = Ticket.objects.filter(status = 
'Closed',accepted_by = self.request.user)
return context



ticket_view.html

{% extends 'app/base.html' %}

{% block body %} 
{% for tickets in ticket_type%}
{% if tickets.status == "Opened" %}



ID
Status
Created
Title
Description



{% for ticket in open_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}
 Accept

{% endfor %}

{% elif tickets.status == 'Accepted' %}



ID
Status
Created by
Title
Description

 


{% for ticket in accepted_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}
Complete

{% endfor %}


{% elif tickets.status == 'Completed' %}





ID
Status
Created by
Title
Description

 


{% for ticket in completed_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}

{% endfor %}
{% else %}



ID
Status
Created by
Title
Description




{% for ticket in closed_tickets %}

{{ ticket.id }}
{{ ticket.status }}
{{ ticket.created_by }}
{{ ticket.ticket_title }}
{{ ticket.ticket_description }}

{% endfor %}
{% endif %}
{% endfor %}
{% endblock %}




On Monday, 22 November 2021 at 13:22:47 UTC+5:30 David Nugent wrote:

> Well, there are several ways you can deal with that.
>
> Probably easiest is to override get_template() and switch the template 
> based on whatever type of ticket you're managing or you can change the 
> value of self.template_name based on the request.
>
> Or maybe you prefer a single template to deal with all cases with 
> conditional blocks where appropriate.
>
>
> Regards,
> David
>

-- 
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/786fa7af-0a81-4cf7-9a2e-c2fd2e9f0323n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-21 Thread David Nugent
Well, there are several ways you can deal with that.

Probably easiest is to override get_template() and switch the template
based on whatever type of ticket you're managing or you can change the
value of self.template_name based on the request.

Or maybe you prefer a single template to deal with all cases with
conditional blocks where appropriate.


Regards,
David

-- 
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/CAE5VhgUCCnmkm%2BBe0EWLK4Nb%3DXUOHZAEYGax%2B2%2B-kCysYxdzHA%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Trippy Samurai
What about the templates i have three different templates for as u can see 
in template_name in the above views ,how do i deal with it if i actualyl 
had one template the above could have worked.
On Monday, 22 November 2021 at 12:42:59 UTC+5:30 sutharl...@gmail.com wrote:

> we can go like 
>
> ```
>
> class Manager(...):
> def get_context_data(self, **kwargs):
> context = super() 
> context["open_tickets"] = Ticket.objects.filter(status="OPEN")
> context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")
> context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")
> return context
> ```
>
> On Mon, 22 Nov 2021 at 12:19, Trippy Samurai  
> wrote:
>
>> Hi Elena Thanks for the reply i have three different html pages to 
>> display open tickets closed tickets accepted tickets etc each of them have 
>> different ticket statuses i have them written in different views as above 
>> to display each type of ticket at different pages how can i combine all 
>> three in  a single view so that i dont repeat my logic in views.Is there a 
>> way to acheive all the three views writing in a single view?
>>
>> On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:
>>
>>> Hi,
>>>
>>> The problem is it's unclear what your question is. Can you be clearer 
>>> about what outcome you're trying to achieve? 
>>>
>>>
>>> ---
>>> Elena Williams
>>> Github: elena <http://github.com/elena/>
>>>
>>>
>>> On Mon, 22 Nov 2021 at 15:20, Trippy Samurai  
>>> wrote:
>>>
>>>> Any one plz
>>>>
>>>>
>>>> On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
>>>>
>>>>> Hello,
>>>>> I have different views for displaying different templates how do i 
>>>>> write them into one single Listview so that i can take care of DRY
>>>>>
>>>>>
>>>>> [image: Screenshot 2021-11-21 at 3.08.58 PM.png]
>>>>>
>>>> -- 
>>>> 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...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> -- 
>> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/a000369b-b20f-4737-9bdc-f913f5af0a08n%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-21 Thread David Nugent
Hi Lalit,

On Mon, Nov 22, 2021 at 6:12 PM Lalit Suthar 
wrote:

> we can go like
>
> ```
>
> class Manager(...):
> def get_context_data(self, **kwargs):
> context = super() 
> context["open_tickets"] = Ticket.objects.filter(status="OPEN")
> context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")
> context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")
> return context
> ```
>
> 


That is certainly one value solution, though for any call there are
potentially (ignoring cache) 3 db queries.

To avoid that, an arg or kwarg could be passed to the view by implementing
`get` and allowing for it in the associated path in urls.py. This is
typically a better pattern and very similar to what Dango admin does when a
filter is enabled.

I would also avoid the word `Manager` in a CBV, since `Manager` has a
special meaning in Django.

Regards, David

-- 
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/CAE5VhgW3WcZASeOpfqo4_nxzPpZRJZrV-SWAKFByiDG56fxNGQ%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Lalit Suthar
we can go like

```

class Manager(...):
def get_context_data(self, **kwargs):
context = super() 
context["open_tickets"] = Ticket.objects.filter(status="OPEN")
context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")
context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")
return context
```

On Mon, 22 Nov 2021 at 12:19, Trippy Samurai 
wrote:

> Hi Elena Thanks for the reply i have three different html pages to display
> open tickets closed tickets accepted tickets etc each of them have
> different ticket statuses i have them written in different views as above
> to display each type of ticket at different pages how can i combine all
> three in  a single view so that i dont repeat my logic in views.Is there a
> way to acheive all the three views writing in a single view?
>
> On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:
>
>> Hi,
>>
>> The problem is it's unclear what your question is. Can you be clearer
>> about what outcome you're trying to achieve?
>>
>>
>> ---
>> Elena Williams
>> Github: elena <http://github.com/elena/>
>>
>>
>> On Mon, 22 Nov 2021 at 15:20, Trippy Samurai 
>> wrote:
>>
>>> Any one plz
>>>
>>>
>>> On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
>>>
>>>> Hello,
>>>> I have different views for displaying different templates how do i
>>>> write them into one single Listview so that i can take care of DRY
>>>>
>>>>
>>>> [image: Screenshot 2021-11-21 at 3.08.58 PM.png]
>>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> 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/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAGp2JVHGLavBh8sZLqepP5QMcQYVdv1m0_AO_rKK0PAHun1NGA%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Trippy Samurai
Hi Elena Thanks for the reply i have three different html pages to display 
open tickets closed tickets accepted tickets etc each of them have 
different ticket statuses i have them written in different views as above 
to display each type of ticket at different pages how can i combine all 
three in  a single view so that i dont repeat my logic in views.Is there a 
way to acheive all the three views writing in a single view?

On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:

> Hi,
>
> The problem is it's unclear what your question is. Can you be clearer 
> about what outcome you're trying to achieve? 
>
>
> ---
> Elena Williams
> Github: elena <http://github.com/elena/>
>
>
> On Mon, 22 Nov 2021 at 15:20, Trippy Samurai  
> wrote:
>
>> Any one plz
>>
>>
>> On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
>>
>>> Hello,
>>> I have different views for displaying different templates how do i write 
>>> them into one single Listview so that i can take care of DRY
>>>
>>>
>>> [image: Screenshot 2021-11-21 at 3.08.58 PM.png]
>>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Elena Williams
Hi,

The problem is it's unclear what your question is. Can you be clearer about
what outcome you're trying to achieve?


---
Elena Williams
Github: elena <http://github.com/elena/>


On Mon, 22 Nov 2021 at 15:20, Trippy Samurai 
wrote:

> Any one plz
>
>
> On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
>
>> Hello,
>> I have different views for displaying different templates how do i write
>> them into one single Listview so that i can take care of DRY
>>
>>
>> [image: Screenshot 2021-11-21 at 3.08.58 PM.png]
>>
> --
> 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/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAMRRKVfEu7vdQsmPr7wD4Ep3j-UhUKwUQqZ5J4yVFAY2JW-TVQ%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Trippy Samurai
Any one plz


On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:

> Hello,
> I have different views for displaying different templates how do i write 
> them into one single Listview so that i can take care of DRY
>
>
> [image: Screenshot 2021-11-21 at 3.08.58 PM.png]
>

-- 
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/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com.


Re: Recognize Tags in templates

2021-10-28 Thread N'BE SORO
Hello
Django tag is: {%  %}

Le jeu. 28 oct. 2021 à 14:48, Keila Z. Carpio T.  a
écrit :

> Good morning,
>
> Hello Everybody,
>
> I use the tags to templates but it is being recognized for Server to show
> content
>
>
>
> Please Help me.
>
> Greetings,
>
> --
> 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/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAOtSHp_Y-vYDJuNp9WqzuX6RBHKg%2Bp0QsLsqEEMOV7V%2BFQs-SQ%40mail.gmail.com.


Re: Recognize Tags in templates

2021-10-28 Thread Manuel Pita
Hi,

Try changing what <% %> to {% %}

El El jue, 28 oct 2021 a las 16:49, Keila Z. Carpio T. 
escribió:

> Good morning,
>
> Hello Everybody,
>
> I use the tags to templates but it is being recognized for Server to show
> content
>
>
>
> Please Help me.
>
> Greetings,
>
> --
> 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/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
-- 
*Manuel Pita*

*Ingeniero en Computación*

*e-mail:* mpita1...@gmail.com

*Twitter:* @manuel_pita

*Skype:* mpita1984

*Cel:* +34663491168

*Por favor, Antes de imprimir este e-mail piense bien si es necesario
hacerlo.*

-- 
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/CAJP2%2B-_e7z2SoBi3b%3DBanxyeECutAArNF_3m8dTgP4eJ_6of6Q%40mail.gmail.com.


Re: Recognize Tags in templates

2021-10-28 Thread sachinbg sachin
it seems like, use curly encoded  <{}>


thank you
sachin b.g

On Thu, 28 Oct 2021 at 20:18, Keila Z. Carpio T. 
wrote:

> Good morning,
>
> Hello Everybody,
>
> I use the tags to templates but it is being recognized for Server to show
> content
>
>
>
> Please Help me.
>
> Greetings,
>
> --
> 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/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAOs61ryYPQySjx5YPduQGxHk%3DkhXiKZe7h5Or-AO6fewfh%3Dbdw%40mail.gmail.com.


making TemplateView.template_name point to a file NOT in the templates directory.

2021-05-20 Thread Sharif Mehedi

I do not have a django-admin project and using django views (along with 
other django submodules) in my python app, so, i do not have a directory 
structure like django projects has and I never had a templates directory in 
my app. The way we configured it, serving from templates directory is out 
of the question.

I want to know, if there's an easy solution in making django take a 
template_name as (django.views.generic.base).TemplateView.template_name 
that is (simply said) outside the templates directory.

TIA
Regards,
Sharif

-- 
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/b2291451-6d15-432d-9f35-db60e4f4e65bn%40googlegroups.com.


RES: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread samuel nogueira bacelar
Adding Bootstrap's class="text-lowercase" was the way to go. Thank you!! Enviado do Email para Windows 10 De: Jason TurnerEnviado:terça-feira, 18 de maio de 2021 10:28Para: django-users@googlegroups.comAssunto: Re: how to prevent Django do auto capitalize static text in templates Have you tried Bootstrap's class="text-lowercase"? On Tue, May 18, 2021, 8:23 AM Samuel Nogueira <hu3mule...@gmail.com> wrote:I am using bootstrap, so my CSS shouldn't go wrong  Em ter., 18 de mai. de 2021 às 10:04, 712189512 <gabrielstonede...@gmail.com> escreveu:It’s not django that’s doing that,have you checked your css? On Tue, 18 May 2021 at 12:56 David Tobrise <april7b...@gmail.com> wrote:What happens if you try outputting the units from dynamically instead of hard-coding it? Best Regards,David O. T.On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <hu3mule...@gmail.com> wrote:Hi guys!I have something that appears to be a simple problem but I didn’t find anything useful anywhere. My problem is that my text in a template next to a Django tag keeps auto capitalizing but I don’t want this to happen. In the image above you can see that m³/ano and m² is not capitalized at all. But bellow my text keeps capitalizing.  How can I prevent that to happen? -- 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol.-- 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com.-- Gabrielstone-- 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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%40mail.gmail.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/CAOJT-cDo50jVF-QCZDWaoTTNQ4yrk3BnC2sszsp6a%3DgyhGmcOg%40mail.gmail.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/CADoyC14XpJ2mFgF5i2xL2QcPmXCZHnNP_AMc7t4U3o-9gs05mQ%40mail.gmail.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/6884DB1C-0CB9-4820-9A5D-964965F7E52F%40hxcore.ol.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Jason Turner
Have you tried Bootstrap's class="text-lowercase"?

On Tue, May 18, 2021, 8:23 AM Samuel Nogueira  wrote:

> I am using bootstrap, so my CSS shouldn't go wrong
>
>
> Em ter., 18 de mai. de 2021 às 10:04, 712189512 <
> gabrielstonede...@gmail.com> escreveu:
>
>> It’s not django that’s doing that,have you checked your css?
>>
>> On Tue, 18 May 2021 at 12:56 David Tobrise  wrote:
>>
>>> What happens if you try outputting the units from dynamically instead of
>>> hard-coding it?
>>>
>>> *Best Regards,*
>>> *David O. T.*
>>>
>>>
>>>
>>>
>>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>>> hu3mule...@gmail.com> wrote:
>>>
 Hi guys!

 I have something that appears to be a simple problem but I didn’t find
 anything useful anywhere. My problem is that my text in a template next to
 a Django tag keeps auto capitalizing but I don’t want this to happen.



 In the image above you can see that m³/ano and m² is not capitalized at
 all. But bellow my text keeps capitalizing.





 How can I prevent that to happen?



 --
 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
 
 .

>>> --
>>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> Gabrielstone
>>
>> --
>> 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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%40mail.gmail.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/CAOJT-cDo50jVF-QCZDWaoTTNQ4yrk3BnC2sszsp6a%3DgyhGmcOg%40mail.gmail.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/CADoyC14XpJ2mFgF5i2xL2QcPmXCZHnNP_AMc7t4U3o-9gs05mQ%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Liu Zheng
Checking CSS is the right way to go. To verify, simply comment out all css
styles (internal or external ones) and strip off the classes from these few
lines. You shouldn’t have capitalisation problem any more

On Tue, 18 May 2021 at 9:23 PM, Samuel Nogueira 
wrote:

> I am using bootstrap, so my CSS shouldn't go wrong
>
>
> Em ter., 18 de mai. de 2021 às 10:04, 712189512 <
> gabrielstonede...@gmail.com> escreveu:
>
>> It’s not django that’s doing that,have you checked your css?
>>
>> On Tue, 18 May 2021 at 12:56 David Tobrise  wrote:
>>
>>> What happens if you try outputting the units from dynamically instead of
>>> hard-coding it?
>>>
>>> *Best Regards,*
>>> *David O. T.*
>>>
>>>
>>>
>>>
>>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>>> hu3mule...@gmail.com> wrote:
>>>
 Hi guys!

 I have something that appears to be a simple problem but I didn’t find
 anything useful anywhere. My problem is that my text in a template next to
 a Django tag keeps auto capitalizing but I don’t want this to happen.



 In the image above you can see that m³/ano and m² is not capitalized at
 all. But bellow my text keeps capitalizing.





 How can I prevent that to happen?



 --
 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
 
 .

>>> --
>>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> Gabrielstone
>>
>> --
>> 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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%40mail.gmail.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/CAOJT-cDo50jVF-QCZDWaoTTNQ4yrk3BnC2sszsp6a%3DgyhGmcOg%40mail.gmail.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/CAGQ3pf97JKCnJshVEoHN%2Bi-OMB-x3-njaH%3DOZHVyqPtgbGPhmg%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Samuel Nogueira
I am using bootstrap, so my CSS shouldn't go wrong


Em ter., 18 de mai. de 2021 às 10:04, 712189512 
escreveu:

> It’s not django that’s doing that,have you checked your css?
>
> On Tue, 18 May 2021 at 12:56 David Tobrise  wrote:
>
>> What happens if you try outputting the units from dynamically instead of
>> hard-coding it?
>>
>> *Best Regards,*
>> *David O. T.*
>>
>>
>>
>>
>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>> hu3mule...@gmail.com> wrote:
>>
>>> Hi guys!
>>>
>>> I have something that appears to be a simple problem but I didn’t find
>>> anything useful anywhere. My problem is that my text in a template next to
>>> a Django tag keeps auto capitalizing but I don’t want this to happen.
>>>
>>>
>>>
>>> In the image above you can see that m³/ano and m² is not capitalized at
>>> all. But bellow my text keeps capitalizing.
>>>
>>>
>>>
>>>
>>>
>>> How can I prevent that to happen?
>>>
>>>
>>>
>>> --
>>> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
>>> 
>>> .
>>>
>> --
>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>> 
>> .
>>
> --
> Gabrielstone
>
> --
> 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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%40mail.gmail.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/CAOJT-cDo50jVF-QCZDWaoTTNQ4yrk3BnC2sszsp6a%3DgyhGmcOg%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread 712189512
Put that in a span and use css text-transform and set it to lowercase

On Tue, 18 May 2021 at 13:18 Samuel Nogueira  wrote:

> Unfortunately didnt worked
>
>
> Em ter., 18 de mai. de 2021 às 10:03, RANGA BHARATH JINKA <
> bharathjink...@gmail.com> escreveu:
>
>> Hi,
>>
>> Try this jinja templating lower filter
>>
>> {{ 'helLo WOrlD'|lower }}
>>
>>
>> On Tue, May 18, 2021 at 6:26 PM David Tobrise 
>> wrote:
>>
>>> What happens if you try outputting the units from dynamically instead of
>>> hard-coding it?
>>>
>>> *Best Regards,*
>>> *David O. T.*
>>>
>>>
>>>
>>>
>>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>>> hu3mule...@gmail.com> wrote:
>>>
 Hi guys!

 I have something that appears to be a simple problem but I didn’t find
 anything useful anywhere. My problem is that my text in a template next to
 a Django tag keeps auto capitalizing but I don’t want this to happen.



 In the image above you can see that m³/ano and m² is not capitalized at
 all. But bellow my text keeps capitalizing.





 How can I prevent that to happen?



 --
 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
 
 .

>>> --
>>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Thanks and Regards
>>
>> J. Ranga Bharath
>> cell: 9110334114
>>
>> --
>> 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/CAK5m316_JKZ3hZFoZMm8zy01ZVm_wyeh%3DjtvYDNAYcpK7rMN3Q%40mail.gmail.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/CAOJT-cDrh83_30EhmJvuVfcd0QqtNc_Le%2BJFAexbXOOsFqhFUw%40mail.gmail.com
> 
> .
>
-- 
Gabrielstone

-- 
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/CAL-5MpXkGPmLT8UUcmE0i9%2B7uLrf%3DWRhJ5482Pm0xs8QZBHzDQ%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Samuel Nogueira
I didnt tried this yet, maybe should.


Em ter., 18 de mai. de 2021 às 09:55, David Tobrise 
escreveu:

> What happens if you try outputting the units from dynamically instead of
> hard-coding it?
>
> *Best Regards,*
> *David O. T.*
>
>
>
>
> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
> hu3mule...@gmail.com> wrote:
>
>> Hi guys!
>>
>> I have something that appears to be a simple problem but I didn’t find
>> anything useful anywhere. My problem is that my text in a template next to
>> a Django tag keeps auto capitalizing but I don’t want this to happen.
>>
>>
>>
>> In the image above you can see that m³/ano and m² is not capitalized at
>> all. But bellow my text keeps capitalizing.
>>
>>
>>
>>
>>
>> How can I prevent that to happen?
>>
>>
>>
>> --
>> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
>> 
>> .
>>
> --
> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.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/CAOJT-cAAhgPYGMb6X_D-zatdeE34KabJKZdi8HjjJSEhZ4c%3DeQ%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Samuel Nogueira
Unfortunately didnt worked


Em ter., 18 de mai. de 2021 às 10:03, RANGA BHARATH JINKA <
bharathjink...@gmail.com> escreveu:

> Hi,
>
> Try this jinja templating lower filter
>
> {{ 'helLo WOrlD'|lower }}
>
>
> On Tue, May 18, 2021 at 6:26 PM David Tobrise 
> wrote:
>
>> What happens if you try outputting the units from dynamically instead of
>> hard-coding it?
>>
>> *Best Regards,*
>> *David O. T.*
>>
>>
>>
>>
>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>> hu3mule...@gmail.com> wrote:
>>
>>> Hi guys!
>>>
>>> I have something that appears to be a simple problem but I didn’t find
>>> anything useful anywhere. My problem is that my text in a template next to
>>> a Django tag keeps auto capitalizing but I don’t want this to happen.
>>>
>>>
>>>
>>> In the image above you can see that m³/ano and m² is not capitalized at
>>> all. But bellow my text keeps capitalizing.
>>>
>>>
>>>
>>>
>>>
>>> How can I prevent that to happen?
>>>
>>>
>>>
>>> --
>>> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
>>> 
>>> .
>>>
>> --
>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Thanks and Regards
>
> J. Ranga Bharath
> cell: 9110334114
>
> --
> 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/CAK5m316_JKZ3hZFoZMm8zy01ZVm_wyeh%3DjtvYDNAYcpK7rMN3Q%40mail.gmail.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/CAOJT-cDrh83_30EhmJvuVfcd0QqtNc_Le%2BJFAexbXOOsFqhFUw%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread 712189512
It’s not django that’s doing that,have you checked your css?

On Tue, 18 May 2021 at 12:56 David Tobrise  wrote:

> What happens if you try outputting the units from dynamically instead of
> hard-coding it?
>
> *Best Regards,*
> *David O. T.*
>
>
>
>
> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
> hu3mule...@gmail.com> wrote:
>
>> Hi guys!
>>
>> I have something that appears to be a simple problem but I didn’t find
>> anything useful anywhere. My problem is that my text in a template next to
>> a Django tag keeps auto capitalizing but I don’t want this to happen.
>>
>>
>>
>> In the image above you can see that m³/ano and m² is not capitalized at
>> all. But bellow my text keeps capitalizing.
>>
>>
>>
>>
>>
>> How can I prevent that to happen?
>>
>>
>>
>> --
>> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
>> 
>> .
>>
> --
> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
> 
> .
>
-- 
Gabrielstone

-- 
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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread RANGA BHARATH JINKA
Hi,

Try this jinja templating lower filter

{{ 'helLo WOrlD'|lower }}


On Tue, May 18, 2021 at 6:26 PM David Tobrise  wrote:

> What happens if you try outputting the units from dynamically instead of
> hard-coding it?
>
> *Best Regards,*
> *David O. T.*
>
>
>
>
> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
> hu3mule...@gmail.com> wrote:
>
>> Hi guys!
>>
>> I have something that appears to be a simple problem but I didn’t find
>> anything useful anywhere. My problem is that my text in a template next to
>> a Django tag keeps auto capitalizing but I don’t want this to happen.
>>
>>
>>
>> In the image above you can see that m³/ano and m² is not capitalized at
>> all. But bellow my text keeps capitalizing.
>>
>>
>>
>>
>>
>> How can I prevent that to happen?
>>
>>
>>
>> --
>> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
>> 
>> .
>>
> --
> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
> 
> .
>


-- 
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

-- 
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/CAK5m316_JKZ3hZFoZMm8zy01ZVm_wyeh%3DjtvYDNAYcpK7rMN3Q%40mail.gmail.com.


Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread David Tobrise
What happens if you try outputting the units from dynamically instead of
hard-coding it?

*Best Regards,*
*David O. T.*




On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
hu3mule...@gmail.com> wrote:

> Hi guys!
>
> I have something that appears to be a simple problem but I didn’t find
> anything useful anywhere. My problem is that my text in a template next to
> a Django tag keeps auto capitalizing but I don’t want this to happen.
>
>
>
> In the image above you can see that m³/ano and m² is not capitalized at
> all. But bellow my text keeps capitalizing.
>
>
>
>
>
> How can I prevent that to happen?
>
>
>
> --
> 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
> 
> .
>

-- 
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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com.


how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread samuel nogueira bacelar
Hi guys!I have something that appears to be a simple problem but I didn’t find anything useful anywhere. My problem is that my text in a template next to a Django tag keeps auto capitalizing but I don’t want this to happen. In the image above you can see that m³/ano and m² is not capitalized at all. But bellow my text keeps capitalizing.  How can I prevent that to happen? 



-- 
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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol.


Possible Bug: when using memcache backend, fragment templates aren't stored

2021-01-11 Thread Leon Albrecht

So, in my Project I have template that generates a lot of prcedual html 
(for loop with about 150 entries at once) so cahcing that "snippet" is a 
reasonable choice, but after activating caching for that project and this 
template, I still got consistent long generation times, so I looked in the 
logs of memcached:

 Log
30 new auto-negotiating client connection

30: Client using the ascii protocol

30 get 
:1:views.decorators.cache.cache_header..d31012059d4bf0e4439b76cc89f20710.en-us.Europe/Berlin

30 sending key 
:1:views.decorators.cache.cache_header..d31012059d4bf0e4439b76cc89f20710.en-us.Europe/Berlin

30 END

30 get 
:1:views.decorators.cache.cache_page..GET.d31012059d4bf0e4439b76cc89f20710.3be2ac225dbd9a4a16937fe81272b22f.en-us.Europe/Berlin

30 END

30 get :1:template.cache.all_students.a798c302967db211ea753aca223d57d8

30 END

30 delete 
:1:template.cache.all_students.a798c302967db211ea753aca223d57d8

30 NOT_FOUND

30 set 
:1:views.decorators.cache.cache_header..d31012059d4bf0e4439b76cc89f20710.en-us.Europe/Berlin
 
1 600 29

30 STORED

30 delete 
:1:views.decorators.cache.cache_page..GET.d31012059d4bf0e4439b76cc89f20710.3be2ac225dbd9a4a16937fe81272b22f.en-us.Europe/Berlin

30 NOT_FOUND

30 connection closed.

So as you can see django tries to access the template.all_students and 
deletes it after finnishing work, but it never actually sets it.

During testing i tried the same with the filebased-cache, which worked and 
resonded after only 48ms instead of 1500-1700ms.

Here is my Configuration (cutdown and minimally changed just to get the 
point across):

Config
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'cache:11211',
}
}

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',

'django.middleware.cache.UpdateCacheMiddleware', #cache 1

'django.contrib.sessions.middleware.SessionMiddleware', 

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',  
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 

'app.Middleware.ForceAuth', # just enforce authentication

'django.middleware.cache.FetchFromCacheMiddleware', #cache 2
]

INSTALLED_APPS = [
'app.apps.appConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]


the cache tag used is:
{% cache 500 all_students search_query type|my_or_all:request.user %}

where my_or_all looks like:
@register.filter(name='my_or_all')
def my_or_all(_type:str, user:User):
if _type=='all':
return 'all'
else:
return f'{_type}:{user.username}'


-- 
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/62ca9961-8690-41d4-a498-5b2c00dc0671n%40googlegroups.com.


Shouldn't there be a library already for how to render your JS Frontend code into HTML and then insert your Django templates with jinja2 very easily?

2020-06-18 Thread Andrew


Hi all! I'm no frontend person, but I do help triage issues in 
djangorestframework-simplejwt. It's probably one of the most used 
authentication library for DRF users and most of all frontend framework 
devs of Django (i.e. React, Angular, Vue).

I've been getting lots of comments about issue #157 
 not 
getting merged. I'm still not convinced that it should be merged at this 
point, but I'm wondering if there's a better way for these frontend 
framework JS devs to integrate with Django sessions.

Again, I'm no frontend JS person. In fact, I've never actually coded with 
React or any of these frameworks before (I just generally know enough how 
most integrate with Django). But looking into the techs themselves, 
shouldn't there be a way to render the HTML content on python manage.py 
runserver (or however way you're deploying with something like gunicorn), 
map out where you want to put your template tags (like you code with the JS 
tech and a library inserts where you want the tags or variables), and then 
voila... you can use the sessions middlewear?

If this hasn't been done, someone should make it happen... If enough 
attention comes by for a better idea, I'd love to help collaborate!

My GitHub page: https://github.com/Andrew-Chen-Wang

-- 
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/4e8d86c3-1f02-4572-b447-ed4639858248n%40googlegroups.com.


DJango upvoting, downvoting - functions in templates

2020-06-02 Thread Jan Gregorczyk
I'm using this package https://pypi.org/project/django-vote/  and i want to 
do something smilar to this guy 
https://github.com/shellfly/django-vote/issues/51 - I need function 
callable in template, which will tell me if user has downvoted or upvoted, 
but exactly downvoted or exactly upvoted. I don't know where should I put 
it's code to make it work. It should take two arguments: user_id and answer.

My view:

def question(request, question_id):
question = get_object_or_404(Question, pk=question_id)
form = AnswerForm()
return render(request, 'questions/question.html', {'question': question, 
'form' : form},)

I'd like to use this function here with upvote, downvote elements.:

{% for answer in question.answers.all %}
{{answer.author}}
{{answer.content}}


{{answer.votes.count}}


{% endfor %}

Also I'm not sure which functions can be called in Django templates. Only 
those having no arguments?

-- 
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/050550b7-65db-4e08-9b22-c367f7b2a71f%40googlegroups.com.


Re: Templates vs. source code

2020-05-29 Thread אורי
Thank you.
אורי
u...@speedy.net


On Fri, May 29, 2020 at 12:56 PM Sencer Hamarat 
wrote:

> Hi Uri,
> Never expose whole settings anytime. settings is always includes sensitive
> data. At least DB access key and Django's secret value.
> This attitude is highly vulnerable. Anyone could access those sensitive
> data via response headers if you don't play settings without cautious.
>
> Saygılarımla,
> Sencer HAMARAT
>
>
>
> ‪On Fri, May 29, 2020 at 7:11 AM ‫אורי‬‎  wrote:‬
>
>> Django users,
>>
>> There was a discussion in Stack Overflow related to an answer of mine -
>> how to access settings from templates in Django [
>> https://stackoverflow.com/a/53953578/1412564]. And I would like to know
>> - is it generally unsafe to expose all my settings to templates and why?
>> Should I use the updated answer and expose only specific settings to
>> templates? Because if a hacker can change my templates, they can also
>> change my .py files, and then they can give themselves any access they want
>> to. So what is better - expose all my settings to templates or only
>> specific settings which I consider safe?
>>
>> Thanks,
>> Uri.
>> אורי
>> u...@speedy.net
>>
>> --
>> 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/CABD5YeEmHtPHMKs7ub42eeTQR8_XfDUGwyCtn9XGmvZ0JyFfwQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CABD5YeEmHtPHMKs7ub42eeTQR8_XfDUGwyCtn9XGmvZ0JyFfwQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CACp8TZhg3ES2eaUaqP0GYAXyBiWW%2BzWgB2-QEJHX%3DQi13-C5BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACp8TZhg3ES2eaUaqP0GYAXyBiWW%2BzWgB2-QEJHX%3DQi13-C5BA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CABD5YeE9bmNXEP8Z6fKia6sh7Gu4SAO5P4Guai7fk4Z%2BkBmJqA%40mail.gmail.com.


Re: Templates vs. source code

2020-05-29 Thread Sencer Hamarat
Hi Uri,
Never expose whole settings anytime. settings is always includes sensitive
data. At least DB access key and Django's secret value.
This attitude is highly vulnerable. Anyone could access those sensitive
data via response headers if you don't play settings without cautious.

Saygılarımla,
Sencer HAMARAT



‪On Fri, May 29, 2020 at 7:11 AM ‫אורי‬‎  wrote:‬

> Django users,
>
> There was a discussion in Stack Overflow related to an answer of mine -
> how to access settings from templates in Django [
> https://stackoverflow.com/a/53953578/1412564]. And I would like to know -
> is it generally unsafe to expose all my settings to templates and why?
> Should I use the updated answer and expose only specific settings to
> templates? Because if a hacker can change my templates, they can also
> change my .py files, and then they can give themselves any access they want
> to. So what is better - expose all my settings to templates or only
> specific settings which I consider safe?
>
> Thanks,
> Uri.
> אורי
> u...@speedy.net
>
> --
> 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/CABD5YeEmHtPHMKs7ub42eeTQR8_XfDUGwyCtn9XGmvZ0JyFfwQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABD5YeEmHtPHMKs7ub42eeTQR8_XfDUGwyCtn9XGmvZ0JyFfwQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CACp8TZhg3ES2eaUaqP0GYAXyBiWW%2BzWgB2-QEJHX%3DQi13-C5BA%40mail.gmail.com.


Templates vs. source code

2020-05-28 Thread אורי
Django users,

There was a discussion in Stack Overflow related to an answer of mine - how
to access settings from templates in Django [
https://stackoverflow.com/a/53953578/1412564]. And I would like to know -
is it generally unsafe to expose all my settings to templates and why?
Should I use the updated answer and expose only specific settings to
templates? Because if a hacker can change my templates, they can also
change my .py files, and then they can give themselves any access they want
to. So what is better - expose all my settings to templates or only
specific settings which I consider safe?

Thanks,
Uri.
אורי
u...@speedy.net

-- 
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/CABD5YeEmHtPHMKs7ub42eeTQR8_XfDUGwyCtn9XGmvZ0JyFfwQ%40mail.gmail.com.


Re: Can we use python related api's on the Django templates ?

2020-05-28 Thread Derek
While you cannot use Python operators and functions directly in the 
templates, you can write your own "wrappers" around those you need:

https://docs.djangoproject.com/en/3.0/howto/custom-template-tags/


On Wednesday, 27 May 2020 15:57:34 UTC+2, Daniel Roseman wrote:
>
> On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote:
>>
>> Hi all, 
>>
>> Currently I am trying to print the type of a variable from the Django 
>> template html file as follows: 
>>
>> The type of feature list report for version 
>>> {%type(version)%} is
>>
>>
>> For the above, I am getting the following error: 
>>
>> Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
>> load this tag?
>>
>>
>> So what's going wrong here? How can we use the python related api's (like 
>> type) from the html template files? I think inside the {%  %} we can 
>> use python related evaluations. Am I right? 
>>
>> Please throw some lights on this .
>>
>> Thanks. 
>>
>>
> No, you are wrong, and this is explicitly pointed out in the docs (
> https://docs.djangoproject.com/en/3.0/ref/templates/language/):
>
> > bear in mind that the Django template system is not simply Python 
> embedded into HTML. This is by design: the template system is meant to 
> express presentation, not program logic.
>
> --
> DR. 
>

-- 
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/09e739dd-60c8-4360-9f9f-d3270c7901ca%40googlegroups.com.


Re: Regarding redering data in html templates

2020-05-27 Thread VenkataSivaRamiReddy
You got solution for your query?

On Wed, May 27, 2020, 14:52 Ifeanyi Chielo 
wrote:

> at the html file of your template folder, use something like
> {{table1.skin_care1}}
> {{table1.skin_care2}} etc
>
> note skin_care1, skin_care etc are fields in your model table 'table1'
>
> Dr. Chielo C. Ifeanyi
> Chief Programmer,
> Head Webometrics Section
> ICT Unit, UNN
> 08032366433, 08154804230
> ifeanyi.chi...@unn.edu.ng
> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>
>
>
> On Mon, May 25, 2020 at 4:05 PM Karthiki Chowdary <
> karthichowdary...@gmail.com> wrote:
>
>> Hi i was beginner in django and i have a small query in templates.
>> For suppose in the home page of any client browser if we have a button
>> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
>> the data of all skin care products companies logos/ health care companies
>> logos. For that how i can render data in dictionaries suppose i want to
>> render a static data how can i or i want or render a dynamic data how can i
>> do that with dictionaries so other better option. Please help me out in this
>>
>> --
>> 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/f2306e60-f48f-4e47-959c-763e9659182b%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f2306e60-f48f-4e47-959c-763e9659182b%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAGiJVX0jiiu%3DTzyvikU5MLxxS8ESZX4c6Bj7Yn%2B%3DGu8%2Bn6z8ZQ%40mail.gmail.com.


Re: Can we use python related api's on the Django templates ?

2020-05-27 Thread Daniel Roseman
On Wednesday, 27 May 2020 13:21:24 UTC+1, ratnadeep ray wrote:
>
> Hi all, 
>
> Currently I am trying to print the type of a variable from the Django 
> template html file as follows: 
>
> The type of feature list report for version 
>> {%type(version)%} is
>
>
> For the above, I am getting the following error: 
>
> Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
> load this tag?
>
>
> So what's going wrong here? How can we use the python related api's (like 
> type) from the html template files? I think inside the {%  %} we can 
> use python related evaluations. Am I right? 
>
> Please throw some lights on this .
>
> Thanks. 
>
>
No, you are wrong, and this is explicitly pointed out in the docs 
(https://docs.djangoproject.com/en/3.0/ref/templates/language/):

> bear in mind that the Django template system is not simply Python 
embedded into HTML. This is by design: the template system is meant to 
express presentation, not program logic.

--
DR. 

-- 
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/0a73190c-06f6-4151-9777-c691d084b8b3%40googlegroups.com.


Can we use python related api's on the Django templates ?

2020-05-27 Thread ratnadeep ray
Hi all, 

Currently I am trying to print the type of a variable from the Django 
template html file as follows: 

The type of feature list report for version 
> {%type(version)%} is


For the above, I am getting the following error: 

Invalid block tag on line 9: 'type(version)'. Did you forget to register or 
load this tag?


So what's going wrong here? How can we use the python related api's (like 
type) from the html template files? I think inside the {%  %} we can 
use python related evaluations. Am I right? 

Please throw some lights on this .

Thanks. 

-- 
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/2863977e-c712-4746-bbb0-b175bc976a0d%40googlegroups.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Ifeanyi Chielo
at the html file of your template folder, use something like
{{table1.skin_care1}}
{{table1.skin_care2}} etc

note skin_care1, skin_care etc are fields in your model table 'table1'

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Mon, May 25, 2020 at 4:05 PM Karthiki Chowdary <
karthichowdary...@gmail.com> wrote:

> Hi i was beginner in django and i have a small query in templates.
> For suppose in the home page of any client browser if we have a button
> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
> the data of all skin care products companies logos/ health care companies
> logos. For that how i can render data in dictionaries suppose i want to
> render a static data how can i or i want or render a dynamic data how can i
> do that with dictionaries so other better option. Please help me out in this
>
> --
> 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/f2306e60-f48f-4e47-959c-763e9659182b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f2306e60-f48f-4e47-959c-763e9659182b%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%40mail.gmail.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Karthiki Chowdary
Thanks

On Wed, 27 May, 2020, 1:04 pm Derek,  wrote:

> Lots of examples out there, but here is one:
>
>
> https://www.gun.io/blog/how-to-list-items-in-a-dictionary-in-a-django-template
>
> For working with static files (such as CSS or images), have a look at:
>
> https://scotch.io/tutorials/working-with-django-templates-static-files
>
> On Monday, 25 May 2020 17:06:25 UTC+2, Karthiki Chowdary wrote:
>>
>> Hi i was beginner in django and i have a small query in templates.
>> For suppose in the home page of any client browser if we have a button
>> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
>> the data of all skin care products companies logos/ health care companies
>> logos. For that how i can render data in dictionaries suppose i want to
>> render a static data how can i or i want or render a dynamic data how can i
>> do that with dictionaries so other better option. Please help me out in this
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/yDu49lWWgQI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/8a4f13dc-c4fe-40aa-a892-0afc6981847c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8a4f13dc-c4fe-40aa-a892-0afc6981847c%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAOFEE42udTTtOrY6VhQ4%3D56hQ7eHZKUPfC20nCXtDRKR%2BrVw6A%40mail.gmail.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Derek
Lots of examples out there, but here is one:

https://www.gun.io/blog/how-to-list-items-in-a-dictionary-in-a-django-template

For working with static files (such as CSS or images), have a look at:

https://scotch.io/tutorials/working-with-django-templates-static-files

On Monday, 25 May 2020 17:06:25 UTC+2, Karthiki Chowdary wrote:
>
> Hi i was beginner in django and i have a small query in templates. 
> For suppose in the home page of any client browser if we have a button 
> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get 
> the data of all skin care products companies logos/ health care companies 
> logos. For that how i can render data in dictionaries suppose i want to 
> render a static data how can i or i want or render a dynamic data how can i 
> do that with dictionaries so other better option. Please help me out in this
>

-- 
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/8a4f13dc-c4fe-40aa-a892-0afc6981847c%40googlegroups.com.


Re: Regarding rendering templates query

2020-05-25 Thread Karthiki Chowdary
Okay I will try thankyou

On Mon, 25 May, 2020, 10:51 pm Joe Leger,  wrote:

> Where you are rendering a single image, instead use a for loop to render
> all of your images like so:
> {% for image in images %}
> 
> {% endfor %}
>
>
> On Monday, May 25, 2020 at 11:10:47 AM UTC-4, Karthiki Chowdary wrote:
>>
>> Hi,
>>
>>  I have a query in in templates i was a beginner in django and python.
>> Please help me out in this query .
>>
>> For suppose i have a buttons on client browser like SKINCARE or HAIR CARE
>> products if i click on that buttons it should display the logos of skin
>> care products or hair care products. Rendering a single image is very easy
>> if i want to render so many images how can i do that if yes with
>> dictionaries how can i do that?? is this possible to render such huge
>> amount of images or logos ?
>>
>> thanks
>>
>> Kartheeki.
>>
>> Please help me out .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/v00ENJFujtY/unsubscribe.
> To unsubscribe from this group and all its topics, 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/079939dd-0c8d-460a-862c-c8f5b2cf7494%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/079939dd-0c8d-460a-862c-c8f5b2cf7494%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAOFEE40NvXGF08KSCssOkqM45bnej40_y_66qGiYJKEEZZaPPg%40mail.gmail.com.


Re: Regarding rendering templates query

2020-05-25 Thread Joe Leger
Where you are rendering a single image, instead use a for loop to render 
all of your images like so:
{% for image in images %}

{% endfor %}


On Monday, May 25, 2020 at 11:10:47 AM UTC-4, Karthiki Chowdary wrote:
>
> Hi,
>  
>  I have a query in in templates i was a beginner in django and python. 
> Please help me out in this query .
>  
> For suppose i have a buttons on client browser like SKINCARE or HAIR CARE 
> products if i click on that buttons it should display the logos of skin 
> care products or hair care products. Rendering a single image is very easy 
> if i want to render so many images how can i do that if yes with 
> dictionaries how can i do that?? is this possible to render such huge 
> amount of images or logos ?
>
> thanks 
>
> Kartheeki. 
>
> Please help me out .
>

-- 
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/079939dd-0c8d-460a-862c-c8f5b2cf7494%40googlegroups.com.


Regarding rendering templates query

2020-05-25 Thread Karthiki Chowdary
Hi,
 
 I have a query in in templates i was a beginner in django and python. 
Please help me out in this query .
 
For suppose i have a buttons on client browser like SKINCARE or HAIR CARE 
products if i click on that buttons it should display the logos of skin 
care products or hair care products. Rendering a single image is very easy 
if i want to render so many images how can i do that if yes with 
dictionaries how can i do that?? is this possible to render such huge 
amount of images or logos ?

thanks 

Kartheeki. 

Please help me out .

-- 
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/ed7f5ca1-36cc-471a-8f78-614e738cd772%40googlegroups.com.


Regarding redering data in html templates

2020-05-25 Thread Karthiki Chowdary
Hi i was beginner in django and i have a small query in templates. 
For suppose in the home page of any client browser if we have a button like 
SKINCARE or HEALTH CARE and if we click on that buttons we need to get the 
data of all skin care products companies logos/ health care companies 
logos. For that how i can render data in dictionaries suppose i want to 
render a static data how can i or i want or render a dynamic data how can i 
do that with dictionaries so other better option. Please help me out in this

-- 
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/f2306e60-f48f-4e47-959c-763e9659182b%40googlegroups.com.


Templates in Django

2020-05-14 Thread אורי
Hi,

I noticed that an app's template can't extend a template with exactly the
same path in another app. Recently I had a need to extend such a template,
called 'accounts/edit_profile/base.html', so I renamed it
to 'accounts/edit_profile/core_base.html' and added a new
template 'accounts/edit_profile/base.html' which only contains one line:

{% extends 'accounts/edit_profile/core_base.html' %}

And then, in the other app, I extend the same template with my changes:

{% extends 'accounts/edit_profile/core_base.html' %}


{% load core_tags_and_filters %}
{% load i18n %}

{% block edit_profile_links_1 %}
{% if request.user.profile.is_active %}


{% endif %}
{% endblock %}

Is this the correct way to do this? Or is there a better way to extend
templates?

Thanks,
Uri.

אורי
u...@speedy.net

-- 
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/CABD5YeF8uDqt9uY%3Dy70ev-UotZdUV28dFLK4awAXvSDnukmFTg%40mail.gmail.com.


Re: django templates stop to working html autocomplete

2020-05-07 Thread Carson
What do you want to autocomplete but not?

If you use Python as the main language, It so recommends that you convert 
IDE to PyCharm.

Eren ARTUÇ於 2020年5月8日星期五 UTC+8上午7時09分18秒寫道:
>
> hello everyone,
>
> Im using Vs.Code. When i enabled to django templates, my HTML autocomlete 
> doesnt work. i want to work Python and HTML at the same time. How can i 
> solve this problem ? Do you have any idea ? 
>

-- 
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/dc093804-03b9-4a33-bf4f-4542b46294e0%40googlegroups.com.


django templates stop to working html autocomplete

2020-05-07 Thread Eren ARTUÇ
hello everyone,

Im using Vs.Code. When i enabled to django templates, my HTML autocomlete 
doesnt work. i want to work Python and HTML at the same time. How can i 
solve this problem ? Do you have any idea ? 

-- 
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/9e9fc403-ea1e-47d1-b34b-82af3268c468%40googlegroups.com.


Security question: Can Django templates be used to execute arbitrary code on the server?

2020-05-05 Thread jrief
Is it safe to keep Django template strings inside a TextField of a Django 
model and allow users with staff privileges to edit them?

I'm asking because I'm unsure how safe/dangerous this could be. Would it be 
possible to abuse a built-in templatetag to execute arbitrary code on the 
server?

What are possible attack scenarios? XSS for sure, but that's always 
possible to whom you allow to publish HTML on their servers.

-- 
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/13526179-50f4-45d1-953d-c272f1fb32bc%40googlegroups.com.


Re: Django s3 video files displaying to templates

2020-03-12 Thread Naveen Arora
Hi irfan, 
you can have a look here - 
https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md#setup-static-files

On Thursday, 12 March 2020 10:58:05 UTC+5:30, Irfan Khan wrote:
>
> Hi all,
>
> Can any one guide me how to display uploaded video files in S3 to django 
> templates.
>
> Thanks in advance for your help
>

-- 
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/cfb89952-ea92-4e0f-abc8-5c71ebc26700%40googlegroups.com.


Django s3 video files displaying to templates

2020-03-11 Thread Irfan Khan
Hi all,

Can any one guide me how to display uploaded video files in S3 to django
templates.

Thanks in advance for your help

-- 
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/CALKGVira3H-RyUUvp34uMyAQwKcTogSk84n93OUdUMz%2Bz2ZFvg%40mail.gmail.com.


Re: Beginner needs help getting templates to work - is this the right group?

2020-03-07 Thread Deborah Emeni
Hello Philip, I use the same tutorial book "Django for beginners" as you
and I understand why the author of the book refers to the pages directory
as if there is only one.
You are having two Directories because you ran this command:

 $ django-admin startproject pages

The Author of the book ran this other command below instead of yours, that
is why it bothers you that the author refers to the pages directory as if
there it were only one. See the command that makes this possible below:

$ django-admin startproject pages .

(the difference between the two commands is the space and dot after the
name of your project, 'pages')

On Sat, Mar 7, 2020, 1:18 AM Shishir Jha  wrote:

> "One thing that bothers me is that the author of the book refers to the
> pages directory as if there is only one.  In fact, django created two. The
> top level, (Is that referred to as the base?) has manage.py in it.  One of
> the childs of this is another ‘page’ which is where I put urls.py.  At one
> point I put urls.py
>
> In both ‘page’ directories, figuring the one that the one in the wrong
> place would be ignored.  This didn’t seem to make any difference.  Is it
> possible that the book was written when there was only one “page” directory
> and the code in the book won’t work with a second “page” sub-directory?"
>
>
> Outer "pages" is just the directory to store the django project and
> initialise the project using pipenv and all. That has nothing to do with
> the project itself. The "pages" inside is one of the apps of the
> project(This project has only one app). Django has this concept of
> "projects" and "apps". Project means whole web application that you are
> developing and apps are specific functionalities inside the web app. So,
> pay attention to the "pages" folder inside only, it will have "urls.py"
> file to display pages in specific routes, and other "urls.py" is inside
> "pages_project" which represents whole project. The "urls.py" file here is
> to let django know which apps have urls setup and where to look for them
>
>
> On Sat, Mar 7, 2020 at 4:04 AM Jorge Gimeno  wrote:
>
>> I think Alvaro is on to something.  I just noticed that there ins't a
>> virtual enviroment active, and the traceback shows that pipenv run wasn't
>> used either. Can we try pipenv shell and then running python manage.py
>> runserver again? If you didn't install Django using pipenv install, do that
>> first.
>>
>> -Jorge
>>
>> On Fri, Mar 6, 2020 at 3:07 AM Alvaro Orozco <
>> alvaro.orozco.t...@gmail.com> wrote:
>>
>>> It seems like you're not activating the virtual environment. Active the
>>> virtual environment and install the dependencies.
>>>
>>> On Thu, Mar 5, 2020 at 11:02 PM Shishir Jha 
>>> wrote:
>>>
>>>> Can you show the code that you have written until page 55?
>>>>
>>>>
>>>> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>>>>
>>>>> Thank you for your response.  The book is Django for Beginners, by
>>>>> William S. Vincent.  I will copy and send you the chapter I am having
>>>>> trouble with.  My directory structure, as created by Django, doesn't seem
>>>>> to be the same as his, so I will send you that as well.  The problem I am
>>>>> having
>>>>> is that after the changes to the files have been made, and I
>>>>> "runserver" (on page 55) I get a huge error dialog that seems to say that
>>>>> django can't find the app. I have deleted the project several times and
>>>>> re-entered it, so I think it is unlikely that it is a typing error.
>>>>>
>>>>>
>>>>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno 
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means 
>>>>>> wrote:
>>>>>>
>>>>>>> I am new to web development.  Wanted to help my daughter with a
>>>>>>> simple website (she does pet portraits) and learn something that 
>>>>>>> interests
>>>>>>> me.  I watched some you tube tutorials, then bought a book.  First 
>>>>>>> couple
>>>>>>> simple projects went OK.  Then I got to templates and I have not been 
>>>>>>> able
>>>>>>> to get the example project to work.  Been banging my head against the 
>>>>>>> wall
>>>>>>> for about a week.  Part of 

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-07 Thread Vikash Chitransh
I can help you in complete the book and create sample django application
through skype.
With Regards,
Vikash Kumar

On Fri, Mar 6, 2020 at 9:01 AM Philip Means  wrote:

> Thank you for your response.  The book is Django for Beginners, by William
> S. Vincent.  I will copy and send you the chapter I am having trouble
> with.  My directory structure, as created by Django, doesn't seem to be the
> same as his, so I will send you that as well.  The problem I am having
> is that after the changes to the files have been made, and I "runserver"
> (on page 55) I get a huge error dialog that seems to say that django can't
> find the app. I have deleted the project several times and re-entered it,
> so I think it is unlikely that it is a typing error.
>
>
> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>
>>
>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>
>>> I am new to web development.  Wanted to help my daughter with a simple
>>> website (she does pet portraits) and learn something that interests me.  I
>>> watched some you tube tutorials, then bought a book.  First couple simple
>>> projects went OK.  Then I got to templates and I have not been able to get
>>> the example project to work.  Been banging my head against the wall for
>>> about a week.  Part of the problem is my directory structure does not look
>>> like the authors and so I am not sure I am putting things in the right
>>> place. When I go searching for another explanation of how to set it up, I
>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>> confusing.  At this point I just want to display a simple html page.  If
>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>
>>> --
>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>> Django is a framework that supports a lot of features, and that means
>> there's a lot of moving parts.  However, similar to driving a car, you need
>> to know a few things to get things working, rather than knowing the
>> niceties of how everything works.
>>
>> To address your point about project structure, there's a lot of opinions
>> on this (most of them are subjective). I have a structure I use and I'm
>> comfortable with, but Django will support some variety in this.
>>
>> Without seeing what code you have and what happens that is not expected,
>> we don't know where we can help.  So, to help us understand, we need to
>> know a few things.
>>
>> 1.  What steps did you take to get here?
>>
>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>> invaluable.
>>
>> 3.  We may ask to see code.  Again, copying and pasting that will help us
>> understand what is going on.
>>
>> You said that your project isn't working once you get to templates.  Is
>> there a book or tutorial you are following?  That might help us know where
>> to start.
>>
>> In addition to this list, there is a forum at forum.djangoproject.com (I
>> follow posts in there as well).  That might be another resource for you, as
>> sometimes the question you have has already been answered.
>>
>> -Jorge
>>
>> --
>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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 

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Ali Abubakar Muhd
May  be you forgot to tell django where it looks for your template
directory. To do this in your project directory go to setting and create a
variable like this;
TEMPLATE_DIR = os.path.join( BASE_DIR, 'templates')
Then locate TEMPLATES in your setting and put TEMPLATE_DIR variable in
DIRS, like this 'DIRS':[TEMPLATE_DIR]. and by convension your template
directory should be templates

On Friday, 6 March 2020, Philip Means  wrote:

> I am new to web development.  Wanted to help my daughter with a simple
> website (she does pet portraits) and learn something that interests me.  I
> watched some you tube tutorials, then bought a book.  First couple simple
> projects went OK.  Then I got to templates and I have not been able to get
> the example project to work.  Been banging my head against the wall for
> about a week.  Part of the problem is my directory structure does not look
> like the authors and so I am not sure I am putting things in the right
> place. When I go searching for another explanation of how to set it up, I
> find that nobody seems to do it the same way.  Also, I find the jargon
> confusing.  At this point I just want to display a simple html page.  If
> this is in the wrong place, maybe someone can direct me to a better one.
>
> --
> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CA%2B2NpNfP%2Brw1u3%3DdOq8vh3-SrFh3bpdjyfg0yARDjGej2tg%2Baw%40mail.gmail.com.


Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Shishir Jha
"One thing that bothers me is that the author of the book refers to the
pages directory as if there is only one.  In fact, django created two. The
top level, (Is that referred to as the base?) has manage.py in it.  One of
the childs of this is another ‘page’ which is where I put urls.py.  At one
point I put urls.py

In both ‘page’ directories, figuring the one that the one in the wrong
place would be ignored.  This didn’t seem to make any difference.  Is it
possible that the book was written when there was only one “page” directory
and the code in the book won’t work with a second “page” sub-directory?"


Outer "pages" is just the directory to store the django project and
initialise the project using pipenv and all. That has nothing to do with
the project itself. The "pages" inside is one of the apps of the
project(This project has only one app). Django has this concept of
"projects" and "apps". Project means whole web application that you are
developing and apps are specific functionalities inside the web app. So,
pay attention to the "pages" folder inside only, it will have "urls.py"
file to display pages in specific routes, and other "urls.py" is inside
"pages_project" which represents whole project. The "urls.py" file here is
to let django know which apps have urls setup and where to look for them


On Sat, Mar 7, 2020 at 4:04 AM Jorge Gimeno  wrote:

> I think Alvaro is on to something.  I just noticed that there ins't a
> virtual enviroment active, and the traceback shows that pipenv run wasn't
> used either. Can we try pipenv shell and then running python manage.py
> runserver again? If you didn't install Django using pipenv install, do that
> first.
>
> -Jorge
>
> On Fri, Mar 6, 2020 at 3:07 AM Alvaro Orozco 
> wrote:
>
>> It seems like you're not activating the virtual environment. Active the
>> virtual environment and install the dependencies.
>>
>> On Thu, Mar 5, 2020 at 11:02 PM Shishir Jha 
>> wrote:
>>
>>> Can you show the code that you have written until page 55?
>>>
>>>
>>> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>>>
>>>> Thank you for your response.  The book is Django for Beginners, by
>>>> William S. Vincent.  I will copy and send you the chapter I am having
>>>> trouble with.  My directory structure, as created by Django, doesn't seem
>>>> to be the same as his, so I will send you that as well.  The problem I am
>>>> having
>>>> is that after the changes to the files have been made, and I
>>>> "runserver" (on page 55) I get a huge error dialog that seems to say that
>>>> django can't find the app. I have deleted the project several times and
>>>> re-entered it, so I think it is unlikely that it is a typing error.
>>>>
>>>>
>>>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno 
>>>> wrote:
>>>>
>>>>>
>>>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means 
>>>>> wrote:
>>>>>
>>>>>> I am new to web development.  Wanted to help my daughter with a
>>>>>> simple website (she does pet portraits) and learn something that 
>>>>>> interests
>>>>>> me.  I watched some you tube tutorials, then bought a book.  First couple
>>>>>> simple projects went OK.  Then I got to templates and I have not been 
>>>>>> able
>>>>>> to get the example project to work.  Been banging my head against the 
>>>>>> wall
>>>>>> for about a week.  Part of the problem is my directory structure does not
>>>>>> look like the authors and so I am not sure I am putting things in the 
>>>>>> right
>>>>>> place. When I go searching for another explanation of how to set it up, I
>>>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>>>> confusing.  At this point I just want to display a simple html page.  If
>>>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>>>
>>>>>> --
>>>>>> 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-us

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Jorge Gimeno
I think Alvaro is on to something.  I just noticed that there ins't a
virtual enviroment active, and the traceback shows that pipenv run wasn't
used either. Can we try pipenv shell and then running python manage.py
runserver again? If you didn't install Django using pipenv install, do that
first.

-Jorge

On Fri, Mar 6, 2020 at 3:07 AM Alvaro Orozco 
wrote:

> It seems like you're not activating the virtual environment. Active the
> virtual environment and install the dependencies.
>
> On Thu, Mar 5, 2020 at 11:02 PM Shishir Jha 
> wrote:
>
>> Can you show the code that you have written until page 55?
>>
>>
>> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>>
>>> Thank you for your response.  The book is Django for Beginners, by
>>> William S. Vincent.  I will copy and send you the chapter I am having
>>> trouble with.  My directory structure, as created by Django, doesn't seem
>>> to be the same as his, so I will send you that as well.  The problem I am
>>> having
>>> is that after the changes to the files have been made, and I "runserver"
>>> (on page 55) I get a huge error dialog that seems to say that django can't
>>> find the app. I have deleted the project several times and re-entered it,
>>> so I think it is unlikely that it is a typing error.
>>>
>>>
>>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno 
>>> wrote:
>>>
>>>>
>>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means 
>>>> wrote:
>>>>
>>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>>> website (she does pet portraits) and learn something that interests me.  I
>>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>>> the example project to work.  Been banging my head against the wall for
>>>>> about a week.  Part of the problem is my directory structure does not look
>>>>> like the authors and so I am not sure I am putting things in the right
>>>>> place. When I go searching for another explanation of how to set it up, I
>>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>>> confusing.  At this point I just want to display a simple html page.  If
>>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>>
>>>>> --
>>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>
>>>> Django is a framework that supports a lot of features, and that means
>>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>>> to know a few things to get things working, rather than knowing the
>>>> niceties of how everything works.
>>>>
>>>> To address your point about project structure, there's a lot of
>>>> opinions on this (most of them are subjective). I have a structure I use
>>>> and I'm comfortable with, but Django will support some variety in this.
>>>>
>>>> Without seeing what code you have and what happens that is not
>>>> expected, we don't know where we can help.  So, to help us understand, we
>>>> need to know a few things.
>>>>
>>>> 1.  What steps did you take to get here?
>>>>
>>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it
>>>> is invaluable.
>>>>
>>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>>> us understand what is going on.
>>>>
>>>> You said that your project isn't working once you get to templates.  Is
>>>> there a book or tutorial you are following?  That might help us know where
>>>> to start.
>>>>
>>>> In addition to this list, there is a forum at forum.djangoproject.com
>>>> (I f

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Philip Means
Thank you all for your help and your interest.  I am not sure how best to
handle getting

Information that you all have requested.  Don’t want to clutter up the
thread more than

necessary, so I will send the information to all that have shown interest
as .pdf attachments in emails.





To Jorge Gimeno:  I checked the settings.py as you suggested to see if

'pages.apps.PagesConfig'  was correctly added and it appears OK



I also checked pages/urls.py and pages_project urls.py and they also appear
correct.



Alvaro Orozco suggested that I might not have the virtual environment
activated.  I think that was a possibility, so I did a “pipenv shell” and
then “runserver” and the traceback appears to have changed a little.  I
will email the new traceback to all who responded.



One thing that bothers me is that the author of the book refers to the
pages directory as if there is only one.  In fact, django created two. The
top level, (Is that referred to as the base?) has manage.py in it.  One of
the childs of this is another ‘page’ which is where I put urls.py.  At one
point I put urls.py

In both ‘page’ directories, figuring the one that the one in the wrong
place would be ignored.  This didn’t seem to make any difference.  Is it
possible that the book was written when there was only one “page” directory
and the code in the book won’t work with a second “page” sub-directory?



To Shankar Jha:  Yes, I did compare my code with the Github code posted by
the author and it matches perfectly, with one exception.  The exception is
where a second template is added later in the chapter.  That is beyond
where I encountered the error.



To Alvaro Orozco:  You are probably correct.  I may not have had the
virtual environment active.  I have run it again and the traceback seems to
have changed slightly. I will send you the new one by email.



To all:  I still have the problem and welcome your suggestions.

On Fri, Mar 6, 2020 at 5:06 AM Byiringiro Yves 
wrote:

> Hello guys, I need your help!
> How can I give a staff user a permission to create a user account in
> django?
>
> On Fri, 6 Mar 2020 at 06:01 Shishir Jha  wrote:
>
>> Can you show the code that you have written until page 55?
>>
>>
>> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>>
>>> Thank you for your response.  The book is Django for Beginners, by
>>> William S. Vincent.  I will copy and send you the chapter I am having
>>> trouble with.  My directory structure, as created by Django, doesn't seem
>>> to be the same as his, so I will send you that as well.  The problem I am
>>> having
>>> is that after the changes to the files have been made, and I "runserver"
>>> (on page 55) I get a huge error dialog that seems to say that django can't
>>> find the app. I have deleted the project several times and re-entered it,
>>> so I think it is unlikely that it is a typing error.
>>>
>>>
>>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno 
>>> wrote:
>>>
>>>>
>>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means 
>>>> wrote:
>>>>
>>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>>> website (she does pet portraits) and learn something that interests me.  I
>>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>>> the example project to work.  Been banging my head against the wall for
>>>>> about a week.  Part of the problem is my directory structure does not look
>>>>> like the authors and so I am not sure I am putting things in the right
>>>>> place. When I go searching for another explanation of how to set it up, I
>>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>>> confusing.  At this point I just want to display a simple html page.  If
>>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>>
>>>>> --
>>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer&g

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread SHANKAR JHA
Why don't you compare your code with the Github repo provided by the
author: https://github.com/wsvincent/djangoforbeginners.

You can share your code with us for more clarity.

On Fri, Mar 6, 2020 at 9:31 AM Shishir Jha  wrote:

> Can you show the code that you have written until page 55?
>
>
> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>
>> Thank you for your response.  The book is Django for Beginners, by
>> William S. Vincent.  I will copy and send you the chapter I am having
>> trouble with.  My directory structure, as created by Django, doesn't seem
>> to be the same as his, so I will send you that as well.  The problem I am
>> having
>> is that after the changes to the files have been made, and I "runserver"
>> (on page 55) I get a huge error dialog that seems to say that django can't
>> find the app. I have deleted the project several times and re-entered it,
>> so I think it is unlikely that it is a typing error.
>>
>>
>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>>
>>>
>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>>
>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>> website (she does pet portraits) and learn something that interests me.  I
>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>> the example project to work.  Been banging my head against the wall for
>>>> about a week.  Part of the problem is my directory structure does not look
>>>> like the authors and so I am not sure I am putting things in the right
>>>> place. When I go searching for another explanation of how to set it up, I
>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>> confusing.  At this point I just want to display a simple html page.  If
>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>
>>>> --
>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>> Django is a framework that supports a lot of features, and that means
>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>> to know a few things to get things working, rather than knowing the
>>> niceties of how everything works.
>>>
>>> To address your point about project structure, there's a lot of opinions
>>> on this (most of them are subjective). I have a structure I use and I'm
>>> comfortable with, but Django will support some variety in this.
>>>
>>> Without seeing what code you have and what happens that is not expected,
>>> we don't know where we can help.  So, to help us understand, we need to
>>> know a few things.
>>>
>>> 1.  What steps did you take to get here?
>>>
>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>>> invaluable.
>>>
>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>> us understand what is going on.
>>>
>>> You said that your project isn't working once you get to templates.  Is
>>> there a book or tutorial you are following?  That might help us know where
>>> to start.
>>>
>>> In addition to this list, there is a forum at forum.djangoproject.com
>>> (I follow posts in there as well).  That might be another resource for you,
>>> as sometimes the question you have has already been answered.
>>>
>>> -Jorge
>>>
>>> --
>>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Alvaro Orozco
It seems like you're not activating the virtual environment. Active the
virtual environment and install the dependencies.

On Thu, Mar 5, 2020 at 11:02 PM Shishir Jha  wrote:

> Can you show the code that you have written until page 55?
>
>
> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>
>> Thank you for your response.  The book is Django for Beginners, by
>> William S. Vincent.  I will copy and send you the chapter I am having
>> trouble with.  My directory structure, as created by Django, doesn't seem
>> to be the same as his, so I will send you that as well.  The problem I am
>> having
>> is that after the changes to the files have been made, and I "runserver"
>> (on page 55) I get a huge error dialog that seems to say that django can't
>> find the app. I have deleted the project several times and re-entered it,
>> so I think it is unlikely that it is a typing error.
>>
>>
>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>>
>>>
>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>>
>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>> website (she does pet portraits) and learn something that interests me.  I
>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>> the example project to work.  Been banging my head against the wall for
>>>> about a week.  Part of the problem is my directory structure does not look
>>>> like the authors and so I am not sure I am putting things in the right
>>>> place. When I go searching for another explanation of how to set it up, I
>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>> confusing.  At this point I just want to display a simple html page.  If
>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>
>>>> --
>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>> Django is a framework that supports a lot of features, and that means
>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>> to know a few things to get things working, rather than knowing the
>>> niceties of how everything works.
>>>
>>> To address your point about project structure, there's a lot of opinions
>>> on this (most of them are subjective). I have a structure I use and I'm
>>> comfortable with, but Django will support some variety in this.
>>>
>>> Without seeing what code you have and what happens that is not expected,
>>> we don't know where we can help.  So, to help us understand, we need to
>>> know a few things.
>>>
>>> 1.  What steps did you take to get here?
>>>
>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>>> invaluable.
>>>
>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>> us understand what is going on.
>>>
>>> You said that your project isn't working once you get to templates.  Is
>>> there a book or tutorial you are following?  That might help us know where
>>> to start.
>>>
>>> In addition to this list, there is a forum at forum.djangoproject.com
>>> (I follow posts in there as well).  That might be another resource for you,
>>> as sometimes the question you have has already been answered.
>>>
>>> -Jorge
>>>
>>> --
>>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>>> &l

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-06 Thread Byiringiro Yves
Hello guys, I need your help!
How can I give a staff user a permission to create a user account in django?

On Fri, 6 Mar 2020 at 06:01 Shishir Jha  wrote:

> Can you show the code that you have written until page 55?
>
>
> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>
>> Thank you for your response.  The book is Django for Beginners, by
>> William S. Vincent.  I will copy and send you the chapter I am having
>> trouble with.  My directory structure, as created by Django, doesn't seem
>> to be the same as his, so I will send you that as well.  The problem I am
>> having
>> is that after the changes to the files have been made, and I "runserver"
>> (on page 55) I get a huge error dialog that seems to say that django can't
>> find the app. I have deleted the project several times and re-entered it,
>> so I think it is unlikely that it is a typing error.
>>
>>
>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>>
>>>
>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>>
>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>> website (she does pet portraits) and learn something that interests me.  I
>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>> the example project to work.  Been banging my head against the wall for
>>>> about a week.  Part of the problem is my directory structure does not look
>>>> like the authors and so I am not sure I am putting things in the right
>>>> place. When I go searching for another explanation of how to set it up, I
>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>> confusing.  At this point I just want to display a simple html page.  If
>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>
>>>> --
>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>> Django is a framework that supports a lot of features, and that means
>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>> to know a few things to get things working, rather than knowing the
>>> niceties of how everything works.
>>>
>>> To address your point about project structure, there's a lot of opinions
>>> on this (most of them are subjective). I have a structure I use and I'm
>>> comfortable with, but Django will support some variety in this.
>>>
>>> Without seeing what code you have and what happens that is not expected,
>>> we don't know where we can help.  So, to help us understand, we need to
>>> know a few things.
>>>
>>> 1.  What steps did you take to get here?
>>>
>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>>> invaluable.
>>>
>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>> us understand what is going on.
>>>
>>> You said that your project isn't working once you get to templates.  Is
>>> there a book or tutorial you are following?  That might help us know where
>>> to start.
>>>
>>> In addition to this list, there is a forum at forum.djangoproject.com
>>> (I follow posts in there as well).  That might be another resource for you,
>>> as sometimes the question you have has already been answered.
>>>
>>> -Jorge
>>>
>>> --
>>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>>> <https://group

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Jorge Gimeno
On Thu, Mar 5, 2020 at 8:01 PM Shishir Jha  wrote:

> Can you show the code that you have written until page 55?
>
>
> On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:
>
>> Thank you for your response.  The book is Django for Beginners, by
>> William S. Vincent.  I will copy and send you the chapter I am having
>> trouble with.  My directory structure, as created by Django, doesn't seem
>> to be the same as his, so I will send you that as well.  The problem I am
>> having
>> is that after the changes to the files have been made, and I "runserver"
>> (on page 55) I get a huge error dialog that seems to say that django can't
>> find the app. I have deleted the project several times and re-entered it,
>> so I think it is unlikely that it is a typing error.
>>
>>
>> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>>
>>>
>>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>>
>>>> I am new to web development.  Wanted to help my daughter with a simple
>>>> website (she does pet portraits) and learn something that interests me.  I
>>>> watched some you tube tutorials, then bought a book.  First couple simple
>>>> projects went OK.  Then I got to templates and I have not been able to get
>>>> the example project to work.  Been banging my head against the wall for
>>>> about a week.  Part of the problem is my directory structure does not look
>>>> like the authors and so I am not sure I am putting things in the right
>>>> place. When I go searching for another explanation of how to set it up, I
>>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>>> confusing.  At this point I just want to display a simple html page.  If
>>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>>
>>>> --
>>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>> Django is a framework that supports a lot of features, and that means
>>> there's a lot of moving parts.  However, similar to driving a car, you need
>>> to know a few things to get things working, rather than knowing the
>>> niceties of how everything works.
>>>
>>> To address your point about project structure, there's a lot of opinions
>>> on this (most of them are subjective). I have a structure I use and I'm
>>> comfortable with, but Django will support some variety in this.
>>>
>>> Without seeing what code you have and what happens that is not expected,
>>> we don't know where we can help.  So, to help us understand, we need to
>>> know a few things.
>>>
>>> 1.  What steps did you take to get here?
>>>
>>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>>> invaluable.
>>>
>>> 3.  We may ask to see code.  Again, copying and pasting that will help
>>> us understand what is going on.
>>>
>>> You said that your project isn't working once you get to templates.  Is
>>> there a book or tutorial you are following?  That might help us know where
>>> to start.
>>>
>>> In addition to this list, there is a forum at forum.djangoproject.com
>>> (I follow posts in there as well).  That might be another resource for you,
>>> as sometimes the question you have has already been answered.
>>>
>>> -Jorge
>>>
>>> --
>>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.co

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Shishir Jha
Can you show the code that you have written until page 55?


On Fri, 6 Mar 2020, 9:01 am Philip Means,  wrote:

> Thank you for your response.  The book is Django for Beginners, by William
> S. Vincent.  I will copy and send you the chapter I am having trouble
> with.  My directory structure, as created by Django, doesn't seem to be the
> same as his, so I will send you that as well.  The problem I am having
> is that after the changes to the files have been made, and I "runserver"
> (on page 55) I get a huge error dialog that seems to say that django can't
> find the app. I have deleted the project several times and re-entered it,
> so I think it is unlikely that it is a typing error.
>
>
> On Thu, Mar 5, 2020 at 8:27 PM Jorge Gimeno  wrote:
>
>>
>> On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:
>>
>>> I am new to web development.  Wanted to help my daughter with a simple
>>> website (she does pet portraits) and learn something that interests me.  I
>>> watched some you tube tutorials, then bought a book.  First couple simple
>>> projects went OK.  Then I got to templates and I have not been able to get
>>> the example project to work.  Been banging my head against the wall for
>>> about a week.  Part of the problem is my directory structure does not look
>>> like the authors and so I am not sure I am putting things in the right
>>> place. When I go searching for another explanation of how to set it up, I
>>> find that nobody seems to do it the same way.  Also, I find the jargon
>>> confusing.  At this point I just want to display a simple html page.  If
>>> this is in the wrong place, maybe someone can direct me to a better one.
>>>
>>> --
>>> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>
>> Django is a framework that supports a lot of features, and that means
>> there's a lot of moving parts.  However, similar to driving a car, you need
>> to know a few things to get things working, rather than knowing the
>> niceties of how everything works.
>>
>> To address your point about project structure, there's a lot of opinions
>> on this (most of them are subjective). I have a structure I use and I'm
>> comfortable with, but Django will support some variety in this.
>>
>> Without seeing what code you have and what happens that is not expected,
>> we don't know where we can help.  So, to help us understand, we need to
>> know a few things.
>>
>> 1.  What steps did you take to get here?
>>
>> 2..  What goes wrong?  If there's a traceback, copying and pasting it is
>> invaluable.
>>
>> 3.  We may ask to see code.  Again, copying and pasting that will help us
>> understand what is going on.
>>
>> You said that your project isn't working once you get to templates.  Is
>> there a book or tutorial you are following?  That might help us know where
>> to start.
>>
>> In addition to this list, there is a forum at forum.djangoproject.com (I
>> follow posts in there as well).  That might be another resource for you, as
>> sometimes the question you have has already been answered.
>>
>> -Jorge
>>
>> --
>> 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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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.co

Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Shishir Jha
Can you show the code that you have written upto page 55?

-- 
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/82205517-3178-41a8-bf51-1e5c16491099%40googlegroups.com.


Re: Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Jorge Gimeno
On Thu, Mar 5, 2020 at 6:04 PM Philip Means  wrote:

> I am new to web development.  Wanted to help my daughter with a simple
> website (she does pet portraits) and learn something that interests me.  I
> watched some you tube tutorials, then bought a book.  First couple simple
> projects went OK.  Then I got to templates and I have not been able to get
> the example project to work.  Been banging my head against the wall for
> about a week.  Part of the problem is my directory structure does not look
> like the authors and so I am not sure I am putting things in the right
> place. When I go searching for another explanation of how to set it up, I
> find that nobody seems to do it the same way.  Also, I find the jargon
> confusing.  At this point I just want to display a simple html page.  If
> this is in the wrong place, maybe someone can direct me to a better one.
>
> --
> 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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com?utm_medium=email_source=footer>
> .
>

Django is a framework that supports a lot of features, and that means
there's a lot of moving parts.  However, similar to driving a car, you need
to know a few things to get things working, rather than knowing the
niceties of how everything works.

To address your point about project structure, there's a lot of opinions on
this (most of them are subjective). I have a structure I use and I'm
comfortable with, but Django will support some variety in this.

Without seeing what code you have and what happens that is not expected, we
don't know where we can help.  So, to help us understand, we need to know a
few things.

1.  What steps did you take to get here?

2..  What goes wrong?  If there's a traceback, copying and pasting it is
invaluable.

3.  We may ask to see code.  Again, copying and pasting that will help us
understand what is going on.

You said that your project isn't working once you get to templates.  Is
there a book or tutorial you are following?  That might help us know where
to start.

In addition to this list, there is a forum at forum.djangoproject.com (I
follow posts in there as well).  That might be another resource for you, as
sometimes the question you have has already been answered.

-Jorge

-- 
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/CANfN%3DK9POCHxkn8-OoU2Yoy3rj%3D%3D9%3DPVOZo0E07fOrPbqcV87w%40mail.gmail.com.


Beginner needs help getting templates to work - is this the right group?

2020-03-05 Thread Philip Means
I am new to web development.  Wanted to help my daughter with a simple 
website (she does pet portraits) and learn something that interests me.  I 
watched some you tube tutorials, then bought a book.  First couple simple 
projects went OK.  Then I got to templates and I have not been able to get 
the example project to work.  Been banging my head against the wall for 
about a week.  Part of the problem is my directory structure does not look 
like the authors and so I am not sure I am putting things in the right 
place. When I go searching for another explanation of how to set it up, I 
find that nobody seems to do it the same way.  Also, I find the jargon 
confusing.  At this point I just want to display a simple html page.  If 
this is in the wrong place, maybe someone can direct me to a better one.

-- 
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/fe83a557-759d-460d-96ec-2c7fd18117bb%40googlegroups.com.


New to Django, need help using my intermediate table to show the m2m relationship in my templates.

2020-02-24 Thread Silas Nicholls
Hello

Sorry I am very new to Django and have come across quite the stumbling 
block. The details to the issue are in this Stack Overflow post I made a 
while ago with no answers:

https://stackoverflow.com/questions/60223686/how-do-i-use-my-intermediate-table-to-show-the-m2m-relationship-in-my-templates

Thank you in advance.

-- 
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/609a095c-6a5a-4ccf-9a02-5ff517871a99%40googlegroups.com.


Re: Access to choice-value-constants from templates when using IntegerChoices

2020-01-29 Thread Integr@te System
Hi Dick,

Consider declaring model field by:
https://docs.djangoproject.com/en/3.0/ref/models/fields/#field-choices-named-groups

and template settings




On Thu, Jan 30, 2020, 02:13 Bernhard Dick  wrote:

> Hi,
>
> I'm having trouble with the template-side when I'm converting my code to
> make use of the in version 3 introduced IntegerChoices-Class and I'd like
> to get some tips on doing it right.
>
> My version 2 Code looks like this:
>
> class StateModel(models.Model):
> STATE_DRAFT = 0
> STATE_PUBLISHED = 1
>
> STATE_CHOICES = [
> (STATE_DRAFT, 'draft'),
> (STATE_PUBLISHED, 'published'),
> ]
> state = models.PositiveIntegerField(choices=STATE_CHOICES,
> default=STATE_DRAFT)
>
> In the template for a ListView I want to show an edit button next to all
> instances that are not yet published or where the current user has
> administrative permissions. Currently that can by done via
> {% if instance.state == instance.STATE_DRAFT or
> perms.appname.manage_entries %} edit {% endif %}.
>
> Now with the use of the IntegerChoices my model looks cleaner:
> class StateModel(models.Model):
> class State(models.IntegerChoices):
> DRAFT = 0, 'draft'
> PUBLISHED = 1, 'published'
> state = models.PositiveIntegerField(choices=State, default=State.DRAFT)
>
> But then I'm not able to access the constant values for the states from my
> templates. Is there a preffered way to circumvent this? One idea would to
> simply add some methods like:
> def isDraft(self):
> return self.state == State.DRAFT
> but that seems a bit boilerplate to me. I think the ideal solution would
> be to have something like a method named isAllowedToEdit in the model,
> which runs all my checks (and could be used elsewhere in the python-side of
> the project). But here I have the problem that I can't pass the permission
> information when calling from the template.
>
>   Regards
> Bernhard
>
> --
> 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/d68305ec-b5cf-4ffe-b4a8-71bed3e690ec%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d68305ec-b5cf-4ffe-b4a8-71bed3e690ec%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAP5HUWpG2VO7zh9M2O4wTFY32FJ1JFvOakHFLZ%2B7cpNuikqa%3Dg%40mail.gmail.com.


Access to choice-value-constants from templates when using IntegerChoices

2020-01-29 Thread Bernhard Dick
Hi,

I'm having trouble with the template-side when I'm converting my code to 
make use of the in version 3 introduced IntegerChoices-Class and I'd like 
to get some tips on doing it right.

My version 2 Code looks like this:

class StateModel(models.Model):
STATE_DRAFT = 0
STATE_PUBLISHED = 1

STATE_CHOICES = [
(STATE_DRAFT, 'draft'),
(STATE_PUBLISHED, 'published'),
]
state = models.PositiveIntegerField(choices=STATE_CHOICES, 
default=STATE_DRAFT)

In the template for a ListView I want to show an edit button next to all 
instances that are not yet published or where the current user has 
administrative permissions. Currently that can by done via
{% if instance.state == instance.STATE_DRAFT or 
perms.appname.manage_entries %} edit {% endif %}.

Now with the use of the IntegerChoices my model looks cleaner:
class StateModel(models.Model):
class State(models.IntegerChoices):
DRAFT = 0, 'draft'
PUBLISHED = 1, 'published'
state = models.PositiveIntegerField(choices=State, default=State.DRAFT)

But then I'm not able to access the constant values for the states from my 
templates. Is there a preffered way to circumvent this? One idea would to 
simply add some methods like:
def isDraft(self):
return self.state == State.DRAFT
but that seems a bit boilerplate to me. I think the ideal solution would be 
to have something like a method named isAllowedToEdit in the model, which 
runs all my checks (and could be used elsewhere in the python-side of the 
project). But here I have the problem that I can't pass the permission 
information when calling from the template.

  Regards
Bernhard

-- 
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/d68305ec-b5cf-4ffe-b4a8-71bed3e690ec%40googlegroups.com.


Re: Removing Hardcoded urls in Templates

2019-12-10 Thread Bruckner de Villiers
Thank you Daniel.

 

Bruckner de Villiers

083 625 1086

 

From:  on behalf of Daniel Hepper 

Reply to: 
Date: Tuesday, 10 December 2019 at 13:54
To: 
Subject: Re: Removing Hardcoded urls in Templates

 

It should be {% url 'polls:detail' question.id %}

 

I think you mixed up the steps "Removing hardcoded URLs in templates" and 
"Namespacing URL names"

 

Hope that helps,

Daniel

 

On Tue, Dec 10, 2019 at 11:58 AM Bruckner de Villiers 
 wrote:

Running Django 3.0 & Python 3.7.3.

 

Issue with Tutorial Part 3:
I replaced “{{ question.question_text 
}}” with
“{{ question.question_text 
}}” and get the following error:
Reverse for 'detail' not found. 'detail' is not a valid view function or 
pattern name.
{{ question.question_text 
}}
index.html:
{% if latest_question_list %}



{% for question in latest_question_list %}

{% comment %} {{ question.id }} 
{{ question.question_text }} {{ question.pub_date }} {% endcomment %}

{{ question.question_text 
}} {% comment %} - Why doesn't this work?-->  {% endcomment %}

{% endfor %}



{% else %}

No polls are available.

{% endif %}
urls.py:
from os import \

path

 

from django.urls import \

path

from . import \

views

 

app_name = 'polls'

urlpatterns = [

path('', views.index, name='index'),

path('/', views.detail, name='detail'),

path('/results/', views.results, name='results'),

path('/vote/', views.vote, name='vote'),

]
views.py:
from django.shortcuts import get_object_or_404, render

from django.http import \

HttpResponse

from django.shortcuts import \

render

#from django.template import loader

from .models import Question

 

# Create your views here.

def index(request):

latest_question_list = Question.objects.order_by('-pub_date')[:10]

context = {'latest_question_list': latest_question_list}

return render(request, 'polls/index.html', context)

 

def detail(request, question_id):

question = get_object_or_404(Question, pk=question_id)

return render(request, 'polls/detail.html', {'question': question})

 

def results(request, question_id):

response = "You're looking at the results of question %s."

return HttpResponse(response % question_id)

 

def vote(request, question_id):

return HttpResponse("You're voting on question %s." % question_id)

 
Much obliged,
 
 

 

Bruckner de Villiers

083 625 1086

-- 
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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.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/CAHEnUVW5AxWDmgRdvHEUYrd%3D%3D%2BFA6y4htqJjv9sJc-OkiCHQpA%40mail.gmail.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/641E4430-80FE-4BF0-9EEF-1CD0B1B2449B%40gmail.com.


Re: Removing Hardcoded urls in Templates

2019-12-10 Thread Bruckner de Villiers
Thank you Sencer.

 

 

Bruckner de Villiers

083 625 1086

 

From:  on behalf of Sencer Hamarat 

Reply to: 
Date: Tuesday, 10 December 2019 at 13:51
To: 
Subject: Re: Removing Hardcoded urls in Templates

 

Would you please replace url name with 'polls:detail', as described at 
https://docs.djangoproject.com/en/3.0/topics/http/urls/#id5

 


Saygılarımla,

Sencer HAMARAT

 

 

On Tue, Dec 10, 2019 at 1:58 PM Bruckner de Villiers 
 wrote:

Running Django 3.0 & Python 3.7.3.

 

Issue with Tutorial Part 3:
I replaced “{{ question.question_text 
}}” with
“{{ question.question_text 
}}” and get the following error:
Reverse for 'detail' not found. 'detail' is not a valid view function or 
pattern name.
{{ question.question_text 
}}
index.html:
{% if latest_question_list %}



{% for question in latest_question_list %}

{% comment %} {{ question.id }} 
{{ question.question_text }} {{ question.pub_date }} {% endcomment %}

{{ question.question_text 
}} {% comment %} - Why doesn't this work?-->  {% endcomment %}

{% endfor %}



{% else %}

No polls are available.

{% endif %}
urls.py:
from os import \

path

 

from django.urls import \

path

from . import \

views

 

app_name = 'polls'

urlpatterns = [

path('', views.index, name='index'),

path('/', views.detail, name='detail'),

path('/results/', views.results, name='results'),

path('/vote/', views.vote, name='vote'),

]
views.py:
from django.shortcuts import get_object_or_404, render

from django.http import \

HttpResponse

from django.shortcuts import \

render

#from django.template import loader

from .models import Question

 

# Create your views here.

def index(request):

latest_question_list = Question.objects.order_by('-pub_date')[:10]

context = {'latest_question_list': latest_question_list}

return render(request, 'polls/index.html', context)

 

def detail(request, question_id):

question = get_object_or_404(Question, pk=question_id)

return render(request, 'polls/detail.html', {'question': question})

 

def results(request, question_id):

response = "You're looking at the results of question %s."

return HttpResponse(response % question_id)

 

def vote(request, question_id):

return HttpResponse("You're voting on question %s." % question_id)

 
Much obliged,
 
 

 

Bruckner de Villiers

083 625 1086

-- 
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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.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/CACp8TZhfYfRH32oHh8Q4vFFWos9QoCXH2%3DrrjQCuxoOETjLc2A%40mail.gmail.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/56E2FE35-0C16-487C-ACE7-5D5ECDF13583%40gmail.com.


Re: Removing Hardcoded urls in Templates

2019-12-10 Thread GGFU GAME
Your code:

“<*li*><*a* href="{% *url* 'detail' question.id %}">{{
question.question_text }}”


Try addinga polls:detail like this:

“<*li*><*a* href="{% *url* 'polls:detail' question.id %}">{{
question.question_text }}”


uto, 10. dec 2019. 11:58 Bruckner de Villiers 
је написао/ла:

> Running Django 3.0 & Python 3.7.3.
>
>
>
> Issue with Tutorial Part 3:
>
> I replaced “<*li*><*a* href="/polls/{{ question.id }}/">{{ 
> question.question_text }}” with
>
> “<*li*><*a* href="{% *url* 'detail' question.id %}">{{ question.question_text 
> }}” and get the following error:
>
> Reverse for 'detail' not found. 'detail' is not a valid view function or 
> pattern name.
>
> http://question.id> %}*">{{
> question.question_text }}
>
> index.html:
>
> {% if latest_question_list %}
>
> 
>
> {% for question in latest_question_list %}
>
> *{% comment %} http://question.id> }}/">{{ question.id  }} {{
> question.question_text }} {{ question.pub_date }} {% endcomment %}*
>
> {{ question.
> question_text }} *{% comment %} - Why doesn't this work?-->  {%
> endcomment %}*
>
> {% endfor %}
>
> 
>
> {% else %}
>
> No polls are available.
>
> {% endif %}
>
> urls.py:
>
> from os import \
>
> path
>
>
>
> from django.urls import \
>
> path
>
> from . import \
>
> views
>
>
>
> app_name = 'polls'
>
> urlpatterns = [
>
> path('', views.index, name='index'),
>
> path('/', views.detail, name='detail'),
>
> path('/results/', views.results, name='results'),
>
> path('/vote/', views.vote, name='vote'),
>
> ]
>
> views.py:
>
> from django.shortcuts import get_object_or_404, render
>
> from django.http import \
>
> HttpResponse
>
> from django.shortcuts import \
>
> render
>
> *#from django.template import loader*
>
> from .models import Question
>
>
>
> *# Create your views here.*
>
> *def* index(request):
>
> latest_question_list = Question.objects.order_by('-pub_date')[:10]
>
> context = {'latest_question_list': latest_question_list}
>
> return render(request, 'polls/index.html', context)
>
>
>
> *def* detail(request, question_id):
>
> question = get_object_or_404(Question, pk=question_id)
>
> return render(request, 'polls/detail.html', {'question': question})
>
>
>
> *def* results(request, question_id):
>
> response = "You're looking at the results of question %s."
>
> return HttpResponse(response % question_id)
>
>
>
> *def* vote(request, question_id):
>
> return HttpResponse("You're voting on question %s." % question_id)
>
>
>
> Much obliged,
>
>
>
>
>
>
>
> Bruckner de Villiers
>
> 083 625 1086
>
> --
> 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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.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/CAFoRdwRCkV-rsr13BiK7j3z5HoX7DCPw%3Dzif%2Bj2q2-fw4W3mkw%40mail.gmail.com.


Re: Removing Hardcoded urls in Templates

2019-12-10 Thread Daniel Hepper
It should be {% url 'polls:detail' question.id %}

I think you mixed up the steps "Removing hardcoded URLs in templates" and
"Namespacing URL names"

Hope that helps,
Daniel

On Tue, Dec 10, 2019 at 11:58 AM Bruckner de Villiers <
bruckner.devilli...@gmail.com> wrote:

> Running Django 3.0 & Python 3.7.3.
>
>
>
> Issue with Tutorial Part 3:
>
> I replaced “<*li*><*a* href="/polls/{{ question.id }}/">{{ 
> question.question_text }}” with
>
> “<*li*><*a* href="{% *url* 'detail' question.id %}">{{ question.question_text 
> }}” and get the following error:
>
> Reverse for 'detail' not found. 'detail' is not a valid view function or 
> pattern name.
>
> http://question.id> %}*">{{
> question.question_text }}
>
> index.html:
>
> {% if latest_question_list %}
>
> 
>
> {% for question in latest_question_list %}
>
> *{% comment %} http://question.id> }}/">{{ question.id <http://question.id> }} {{
> question.question_text }} {{ question.pub_date }} {% endcomment %}*
>
> {{ question.
> question_text }} *{% comment %} - Why doesn't this work?-->  {%
> endcomment %}*
>
> {% endfor %}
>
> 
>
> {% else %}
>
> No polls are available.
>
> {% endif %}
>
> urls.py:
>
> from os import \
>
> path
>
>
>
> from django.urls import \
>
> path
>
> from . import \
>
> views
>
>
>
> app_name = 'polls'
>
> urlpatterns = [
>
> path('', views.index, name='index'),
>
> path('/', views.detail, name='detail'),
>
> path('/results/', views.results, name='results'),
>
> path('/vote/', views.vote, name='vote'),
>
> ]
>
> views.py:
>
> from django.shortcuts import get_object_or_404, render
>
> from django.http import \
>
> HttpResponse
>
> from django.shortcuts import \
>
> render
>
> *#from django.template import loader*
>
> from .models import Question
>
>
>
> *# Create your views here.*
>
> *def* index(request):
>
> latest_question_list = Question.objects.order_by('-pub_date')[:10]
>
> context = {'latest_question_list': latest_question_list}
>
> return render(request, 'polls/index.html', context)
>
>
>
> *def* detail(request, question_id):
>
> question = get_object_or_404(Question, pk=question_id)
>
> return render(request, 'polls/detail.html', {'question': question})
>
>
>
> *def* results(request, question_id):
>
> response = "You're looking at the results of question %s."
>
> return HttpResponse(response % question_id)
>
>
>
> *def* vote(request, question_id):
>
> return HttpResponse("You're voting on question %s." % question_id)
>
>
>
> Much obliged,
>
>
>
>
>
>
>
> Bruckner de Villiers
>
> 083 625 1086
>
> --
> 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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.com
> <https://groups.google.com/d/msgid/django-users/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAHEnUVW5AxWDmgRdvHEUYrd%3D%3D%2BFA6y4htqJjv9sJc-OkiCHQpA%40mail.gmail.com.


Re: Removing Hardcoded urls in Templates

2019-12-10 Thread Sencer Hamarat
Would you please replace url name with 'polls:detail', as described at
https://docs.djangoproject.com/en/3.0/topics/http/urls/#id5


Saygılarımla,
Sencer HAMARAT



On Tue, Dec 10, 2019 at 1:58 PM Bruckner de Villiers <
bruckner.devilli...@gmail.com> wrote:

> Running Django 3.0 & Python 3.7.3.
>
>
>
> Issue with Tutorial Part 3:
>
> I replaced “<*li*><*a* href="/polls/{{ question.id }}/">{{ 
> question.question_text }}” with
>
> “<*li*><*a* href="{% *url* 'detail' question.id %}">{{ question.question_text 
> }}” and get the following error:
>
> Reverse for 'detail' not found. 'detail' is not a valid view function or 
> pattern name.
>
> http://question.id> %}*">{{
> question.question_text }}
>
> index.html:
>
> {% if latest_question_list %}
>
> 
>
> {% for question in latest_question_list %}
>
> *{% comment %} http://question.id> }}/">{{ question.id  }} {{
> question.question_text }} {{ question.pub_date }} {% endcomment %}*
>
> {{ question.
> question_text }} *{% comment %} - Why doesn't this work?-->  {%
> endcomment %}*
>
> {% endfor %}
>
> 
>
> {% else %}
>
> No polls are available.
>
> {% endif %}
>
> urls.py:
>
> from os import \
>
> path
>
>
>
> from django.urls import \
>
> path
>
> from . import \
>
> views
>
>
>
> app_name = 'polls'
>
> urlpatterns = [
>
> path('', views.index, name='index'),
>
> path('/', views.detail, name='detail'),
>
> path('/results/', views.results, name='results'),
>
> path('/vote/', views.vote, name='vote'),
>
> ]
>
> views.py:
>
> from django.shortcuts import get_object_or_404, render
>
> from django.http import \
>
> HttpResponse
>
> from django.shortcuts import \
>
> render
>
> *#from django.template import loader*
>
> from .models import Question
>
>
>
> *# Create your views here.*
>
> *def* index(request):
>
> latest_question_list = Question.objects.order_by('-pub_date')[:10]
>
> context = {'latest_question_list': latest_question_list}
>
> return render(request, 'polls/index.html', context)
>
>
>
> *def* detail(request, question_id):
>
> question = get_object_or_404(Question, pk=question_id)
>
> return render(request, 'polls/detail.html', {'question': question})
>
>
>
> *def* results(request, question_id):
>
> response = "You're looking at the results of question %s."
>
> return HttpResponse(response % question_id)
>
>
>
> *def* vote(request, question_id):
>
> return HttpResponse("You're voting on question %s." % question_id)
>
>
>
> Much obliged,
>
>
>
>
>
>
>
> Bruckner de Villiers
>
> 083 625 1086
>
> --
> 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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.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/CACp8TZhfYfRH32oHh8Q4vFFWos9QoCXH2%3DrrjQCuxoOETjLc2A%40mail.gmail.com.


Removing Hardcoded urls in Templates

2019-12-10 Thread Bruckner de Villiers
Running Django 3.0 & Python 3.7.3.

 

Issue with Tutorial Part 3:
I replaced “{{ question.question_text 
}}” with
“{{ question.question_text 
}}” and get the following error:
Reverse for 'detail' not found. 'detail' is not a valid view function or 
pattern name.
{{ question.question_text 
}}
index.html:
{% if latest_question_list %}

    

    {% for question in latest_question_list %}

    {% comment %} {{ question.id }} 
{{ question.question_text }} {{ question.pub_date }} {% endcomment %}

    {{ question.question_text 
}} {% comment %} - Why doesn't this work?-->  {% endcomment %}

    {% endfor %}

    

{% else %}

    No polls are available.

{% endif %}
urls.py:
from os import \

    path

 

from django.urls import \

    path

from . import \

    views

 

app_name = 'polls'

urlpatterns = [

    path('', views.index, name='index'),

    path('/', views.detail, name='detail'),

    path('/results/', views.results, name='results'),

    path('/vote/', views.vote, name='vote'),

]
views.py:
from django.shortcuts import get_object_or_404, render

from django.http import \

    HttpResponse

from django.shortcuts import \

    render

#from django.template import loader

from .models import Question

 

# Create your views here.

def index(request):

    latest_question_list = Question.objects.order_by('-pub_date')[:10]

    context = {'latest_question_list': latest_question_list}

    return render(request, 'polls/index.html', context)

 

def detail(request, question_id):

    question = get_object_or_404(Question, pk=question_id)

    return render(request, 'polls/detail.html', {'question': question})

 

def results(request, question_id):

    response = "You're looking at the results of question %s."

    return HttpResponse(response % question_id)

 

def vote(request, question_id):

    return HttpResponse("You're voting on question %s." % question_id)

 
Much obliged,
 
 

 

Bruckner de Villiers

083 625 1086

-- 
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/0072F811-155B-41C2-BDCD-3C529150941B%40gmail.com.


Re: [Django] How to traverse through query set in java script using django templates?

2019-12-09 Thread Andréas Kühne
This is a strange way to do things - but all you need to do is to add a
template for loop in the javascript part of your template. For example:



 {% for gsp in apply_gsp_model %}

   var value1 = {% gsp.id %};

 {% endfor %}




What will happen then is that the iteration will create that line for each
gsp in your apply_gsp_model qs.

Regards,

Andréas


Den fre 6 dec. 2019 kl 20:42 skrev Dilipkumar Noone :

> Hi,
>
> I  have a model named ApplyGSP in models.py.
>
> *In my views.py:*
>
> apply_gsp_model = ApplyGSP.objects.all()
>
> context = {'form': form,'apply_gsp_model':apply_gsp_model, 'Message': 
> message, 'action': action}
> if action == 'edit':
> print("action is edit")
> return render(request, 'EditApplyGSP.html', context)
> else:
> print("action is submit")
> return render(request, 'ApplyGSP.html', context)
>
>
> I want to traverse through the model instance in javascript using django 
> template.
>
>
> can some one suggest how to traverse through django queryset and access the 
> database fields inside java script.
>
>
> 
>
>
> 
>
>
> Regards,
>
> N.Dilip kumar.
>
> --
> 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/789645b6-91f2-40ea-b4c0-44580fb2bdef%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/CAK4qSCc9xZBV4%3DUL_ShKSMRpftrmFdZgDP3VXfetwTexpYjqPA%40mail.gmail.com.


[Django] How to traverse through query set in java script using django templates?

2019-12-06 Thread Dilipkumar Noone
Hi,

I  have a model named ApplyGSP in models.py.

*In my views.py:*

apply_gsp_model = ApplyGSP.objects.all()

context = {'form': form,'apply_gsp_model':apply_gsp_model, 'Message': message, 
'action': action}
if action == 'edit':
print("action is edit")
return render(request, 'EditApplyGSP.html', context)
else:
print("action is submit")
return render(request, 'ApplyGSP.html', context)


I want to traverse through the model instance in javascript using django 
template. 


can some one suggest how to traverse through django queryset and access the 
database fields inside java script.




 



Regards,

N.Dilip kumar.

-- 
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/789645b6-91f2-40ea-b4c0-44580fb2bdef%40googlegroups.com.


Re: Django Admin templates not being overwritten by app templates

2019-11-10 Thread Aldian Fazrihady
You need to reorder the app list in INSTALLED_APP setting, so
`django.contrib.admin` is located lower than your app`.

On Mon, Nov 11, 2019 at 3:49 AM Alexander Beach  wrote:

> I am trying to create registration forms using Django's built in auth
> forms.  However, when using the Django admin, the Django admin templates
> are always being used.
>
> My application structure is as follows:
>
> ├── bug
> │   ├── __init__.py
> │   ├── __pycache__
> │   ├── settings.py
> │   ├── urls.py
> │   └── wsgi.py
> ├── db.sqlite3
> ├── manage.py
> └── mysite
> ├── admin.py
> ├── apps.py
> ├── __init__.py
> ├── migrations
> │   └── __init__.py
> ├── models.py
> ├── registration
> ├── templates
> │   └── registration
> │   └── password_reset_form.html
> ├── tests.py
> └── views.py
>
>
>
> My urls.py is the following:
>
>
> from django.contrib import admin
> from django.conf.urls import include, url
> from django.urls import path
>
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> url(r'^accounts/', include('django.contrib.auth.urls'), name="auth"),
> ]
>
>
>
> The mysite/templates/registration/password_reset_form.html is not being
> rendered.  When I navigate to localhost:8000/accounts/password_reset, i can
> see that its using the Django Admin template. See attached screenshot.  I
> am expecting my custom template for the reset form to be rendered.
>
> I am using Django version 2.2.5 and python 3.7.3
>
> Is this a bug or the expected behavior? I don't want to remove the admin
> app.
>
>
>
>
> --
> 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/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com?utm_medium=email_source=footer>
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAabPjVcLDgou_Ee_aK899E3KiVvxSGSkqA0hqXhDiU1BQ%40mail.gmail.com.


Re: Django Admin templates not being overwritten by app templates

2019-11-10 Thread Alexander Beach
This behavior seems counter intuitive, and contrary to what the 
documentation says

For example: my settings.py file is as follows:

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',
],
},
},
]


According to this documentation, APP_DIR should behave as follows:

https://docs.djangoproject.com/en/2.2/howto/overriding-templates/#overriding-from-an-app-s-template-directory

> With APP_DIRS 
<https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-TEMPLATES-APP_DIRS>
 set 
to True, the template loader will look in the app’s templates directory and 
find the templates.

This isn't the behavior that is happening. djang_admin and mysite are 
technically separate apps, and have seperate template directories. 

On Sunday, November 10, 2019 at 3:49:32 PM UTC-5, Alexander Beach wrote:
>
> I am trying to create registration forms using Django's built in auth 
> forms.  However, when using the Django admin, the Django admin templates 
> are always being used.
>
> My application structure is as follows:
>
> ├── bug
> │   ├── __init__.py
> │   ├── __pycache__
> │   ├── settings.py
> │   ├── urls.py
> │   └── wsgi.py
> ├── db.sqlite3
> ├── manage.py
> └── mysite
> ├── admin.py
> ├── apps.py
> ├── __init__.py
> ├── migrations
> │   └── __init__.py
> ├── models.py
> ├── registration
> ├── templates
> │   └── registration
> │   └── password_reset_form.html
> ├── tests.py
> └── views.py
>
>
>
> My urls.py is the following:
>
>
> from django.contrib import admin
> from django.conf.urls import include, url
> from django.urls import path
>
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> url(r'^accounts/', include('django.contrib.auth.urls'), name="auth"),
> ]
>
>
>
> The mysite/templates/registration/password_reset_form.html is not being 
> rendered.  When I navigate to localhost:8000/accounts/password_reset, i can 
> see that its using the Django Admin template. See attached screenshot.  I 
> am expecting my custom template for the reset form to be rendered.
>
> I am using Django version 2.2.5 and python 3.7.3
>
> Is this a bug or the expected behavior? I don't want to remove the admin 
> app. 
>
>
>
>
>

-- 
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/0520c4c2-abbb-441c-bd81-1aeeb8c355b8%40googlegroups.com.


Re: Django Admin templates not being overwritten by app templates

2019-11-10 Thread Mike Dewhirst

On 11/11/2019 7:02 am, Alexander Beach wrote:
I am trying to create registration forms using Django's built in auth 
forms.  However, when using the Django admin, the Django admin 
templates are always being used.


My application structure is as follows:

|
├──bug
│├──__init__.py
│├──__pycache__
│├──settings.py
│├──urls.py
│└──wsgi.py
├──db.sqlite3
├──manage.py
└──mysite
├──admin.py
├──apps.py
├──__init__.py
├──migrations
│└──__init__.py
├──models.py
├──registration
├──templates
|

| mysite/templates/admin/password_reset_form.html

Not tested but that's the principle. Django will default to using the 
template from your site rather than its own. The admin is one of your 
apps so it will use any templates it finds (that urls.conf knows about) 
in your main templates directory.


Cheers

Mike

|

|
│└──registration
│└──password_reset_form.html
├──tests.py
└──views.py

|


My urls.py is the following:


|
fromdjango.contrib importadmin
fromdjango.conf.urls importinclude,url
fromdjango.urls importpath


urlpatterns =[
    path('admin/',admin.site.urls),
    url(r'^accounts/',include('django.contrib.auth.urls'),name="auth"),
]

|


The mysite/templates/registration/password_reset_form.html is not 
being rendered.  When I navigate to 
localhost:8000/accounts/password_reset, i can see that its using the 
Django Admin template. See attached screenshot.  I am expecting my 
custom template for the reset form to be rendered.


I am using Django version 2.2.5 and python 3.7.3

Is this a bug or the expected behavior? I don't want to remove the 
admin app.





--
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 
<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com?utm_medium=email_source=footer>.


--
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/2e77a76e-e6a5-392c-acd9-4694e260a42e%40dewhirst.com.au.


Django Admin templates not being overwritten by app templates

2019-11-10 Thread Alexander Beach
I am trying to create registration forms using Django's built in auth 
forms.  However, when using the Django admin, the Django admin templates 
are always being used.

My application structure is as follows:

├── bug
│   ├── __init__.py
│   ├── __pycache__
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── db.sqlite3
├── manage.py
└── mysite
├── admin.py
├── apps.py
├── __init__.py
├── migrations
│   └── __init__.py
├── models.py
├── registration
├── templates
│   └── registration
│   └── password_reset_form.html
├── tests.py
└── views.py



My urls.py is the following:


from django.contrib import admin
from django.conf.urls import include, url
from django.urls import path


urlpatterns = [
path('admin/', admin.site.urls),
url(r'^accounts/', include('django.contrib.auth.urls'), name="auth"),
]



The mysite/templates/registration/password_reset_form.html is not being 
rendered.  When I navigate to localhost:8000/accounts/password_reset, i can 
see that its using the Django Admin template. See attached screenshot.  I 
am expecting my custom template for the reset form to be rendered.

I am using Django version 2.2.5 and python 3.7.3

Is this a bug or the expected behavior? I don't want to remove the admin 
app. 




-- 
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/c718299d-53f6-4e56-8976-a2040f3449ac%40googlegroups.com.


Re: Query regarding Jija templates with django project

2019-10-30 Thread 'Amitesh Sahay' via Django users
Hey Red, 

Thank you for your reply.
Your suggestion did the trick. 
Now I am facing issues with static files, especially for CSS files. There were 
issues for images files, but I got that rectified. I know that the location 
that I have mentioned in the HTML pages has the CSS files. Still  I am getting 
the below error:

Not Found: /blog/contact/%{ static 'CSS/tooplate_style.css' %}
Not Found: /blog/contact/%{ static 'CSS/ddsmoothmenu.css' %}
[30/Oct/2019 10:41:07] "GET 
/blog/contact/%%7B%20static%20'CSS/tooplate_style.css'%20%%7D HTTP/1.1" 404 3124
[30/Oct/2019 10:41:07] "GET 
/blog/contact/%%7B%20static%20'CSS/ddsmoothmenu.css'%20%%7D HTTP/1.1" 404 3118
Not Found: /blog/contact/%{ static 'CSS/ddsmoothmenu.css' %}
[30/Oct/2019 10:41:07] "GET 
/blog/contact/%%7B%20static%20'CSS/ddsmoothmenu.css'%20%%7D HTTP/1.1" 404 3118

Below is the snippet of my static file settings:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = (
   os.path.join(BASE_DIR, 'static'),
   )Below is my static dir structure as seen in my pycharm.


I went through below stackoverflow web link, but the suggestion don't seem to 
be working for me.
Django - Static file not found

| 
| 
| 
|  |  |

 |

 |
| 
|  | 
Django - Static file not found

I've seen several posts for this issue but didn't found my solution. I'm trying 
to serve static files within my...
 |

 |

 |




It would great if you could suggest .



Regards,
Amitesh
 

On Saturday, 26 October, 2019, 4:42:05 AM IST, red  
wrote:  
 
  
Hello,
 
Your views have a 'name' attribute. You can also give a name to an app in the 
urls.py file of the app, right above your urlpatterns list:
 app_name = "myappname"

urlpatterns = [
path('', views.index, name='index'),
path('about', views.about, name='about'),
path('blog', views.blog, name='blog'),

] 

 
 
Then, when you need to put a link to a another page in your template, use the 
following syntax:
 Home
About Us 
Regards,
 
 
Red
 On 25/10/2019 21:01, 'Amitesh Sahay' via Django users wrote:
  
 
  Hello Team, 
  
  I am kind of new to software development, and trying to find my feat. I have 
a queries which could be quite dumb to most of you, but I need to know.   As 
far as I know, we need Jija templates in the HTML files, so that we can assign 
correct path of the static files. 
  
  Its a general practice to create base.html and extend this in other HTML 
files. Since, I am new to development, so I want to do things in a stupid way, 
I have a HTML templates, and I do not wish to create base.html for now. 
Therefore, if I want to render the html page, I need to create views.py , 
urls.py, and modify the HTML pages to use 'static' any where required. Below 
are the snippet of my test environment. 
  views.py 
from django.shortcuts import render, get_object_or_404


def index(request):
return render(request, 'index.html')


def blog(request):
return render(request, 'blog.html')


def about(request):
return render(request, 'about.html')
  project/urls.py 
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('BLOG.urls'))
]

if settings.DEBUG:
   urlpatterns += static(settings.STATIC_URL, 
document_root=settings.STATIC_ROOT)  APP/urls.py 
from django.urls import path
from django.conf import settings
from . import views

urlpatterns = [
path('', views.index, name='index'),
path('about', views.about, name='about'),
path('blog', views.blog, name='blog'),

]  below is the HTML(index.html) file, which I modified as per my limited 
understanding. 
{% load staticfiles %}
{% block content %}

http://www.w3.org/1999/xhtml;>


Orange Theme - Free Website Template







   var flashvars = {};
   flashvars.xml_file = "photo_list.xml";
   var params = {};
   params.wmode = "transparent";
   var attributes = {};
   attributes.id = "slider";
   swfobject.embedSWF("flash_slider.swf", "flash_grid_slider", "440", "220", 
"9.0.0", false, flashvars, params, attributes);







/***
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library 
(www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at <a  rel="nofollow" href="http://www.dynamicdrive.com/">http://www.dynamicdrive.com/</a> for full source code
***/





ddsmoothmenu.init({
   mainmenuid: "tooplate_menu", //menu DIV id
   orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
   classname: 'ddsmoothmenu', //class added to menu's outer DIV
   //customtheme: ["#1c5a80", "

  1   2   3   4   5   6   7   8   9   10   >