Re: Django Saving a form with Imagefield on shared host

2020-07-11 Thread Stanley Valentin
J'arrive pas à comprendre! Tu parles français. Si ça marche pas il est
possible que tu a fait une erreur

Le 15 juin 2020 14:55, "Kelvin Sajere"  a écrit :

> Did you specify a folder to use for media when you deployed your app? If
> so, then make sure it's where you are supposed to have your media folder.
> If it's a single hosting, then it should be in the public_html folder, but
> on multiple hosting, it should be in the domain-specific folder. I never
> really host my media on NameCheap or any other hosting for that matter
> though. I use either AWS or GOOGLE CLOUD SERVICES for that.
>
> On Sun, Jun 14, 2020 at 2:46 PM MUGOYA DIHFAHSIH 
> wrote:
>
>> I am working on django project and now i have deployed it with Namecheap
>> When i submit a form that does not have an ImageField, the form submits
>> successfully on the shared host
>> but when i submit a form with one of the fields ImageField, it raises 404
>> error.
>> but on the localhost, the forms work perfectly.
>> what can i do to submit such forms on a shared host.
>> 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/b79bb9b5-46b4-43eb-9ea5-3eaab14336ddo%
>> 40googlegroups.com
>> 
>> .
>>
>
>
> --
> KeLLs
>
> --
> 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/CADYqDX2jnwmxOFs5Vz2fnezxs2KMP
> Lh5uh6XVNrz1U36BuBN1g%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/CA%2BTwzF_3oPJG_REfgk32c8V_qNWq9CYyNhUJOrDOPihKQiz_%2Bw%40mail.gmail.com.


Re: Django Saving a form with Imagefield on shared host

2020-07-11 Thread Mostaq mahmud
It's about Mod_Security issue. Contact to the hosting support and tell them 
to disable Mod_Security. 

On Thursday, June 18, 2020 at 11:30:30 AM UTC+6, MUGOYA DIHFAHSIH wrote:
>
> @Mangla, essentially what i want to do is to serve uploaded images on a 
> shared host through the media directory in my project root. I have deployed 
> the web app the static files such as css and images are working fine, but 
> when i try to submit a form that has imagefield into the database, it 
> throws 404 error. I know it has to deal with the Aoache web server and the 
> mod_wsgi but how?
>
> On Wed, 17 Jun 2020 at 10:06, Vishesh Mangla  > wrote:
>
>> One thing that can be done is to save the image as a base64 string in the 
>> database. 
>> https://stackoverflow.com/questions/3715493/encoding-an-image-file-with-base64
>>
>>  
>>
>> Sent from Mail  for 
>> Windows 10
>>
>>  
>>
>> *From: *MUGOYA DIHFAHSIH 
>> *Sent: *14 June 2020 19:15
>> *To: *Django users 
>> *Subject: *Django Saving a form with Imagefield on shared host
>>
>>  
>>
>> I am working on django project and now i have deployed it with Namecheap
>>
>> When i submit a form that does not have an ImageField, the form submits 
>> successfully on the shared host
>>
>> but when i submit a form with one of the fields ImageField, it raises 404 
>> error.
>>
>> but on the localhost, the forms work perfectly.
>>
>> what can i do to submit such forms on a shared host.
>>
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/b79bb9b5-46b4-43eb-9ea5-3eaab14336ddo%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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3F4C1D42-FB11-49A2-8A6E-BF990EE847AD%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/83362928-033b-4260-96cf-0966ed37f590o%40googlegroups.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread oba stephen
It should work.

Try the link Damanjeet shared.
If you still get an error, share the error message.

On Sat, Jul 11, 2020 at 6:57 PM Damanjeet Singh 
wrote:

> Please check this answer
> https://stackoverflow.com/questions/16824004/django-conditional-login-redirect
>
> On Sat, 11 Jul 2020, 18:22 Kuntal Paul,  wrote:
>
>> Thank you for your response. I did this way and it was giving me a 405
>> error. I couldn't find my mistake. I was saving both of them as student and
>> as teacher separately from auth.user.
>>  Also, do I have to provide a separate temple for that view?
>>
>>
>> On Sat, Jul 11, 2020, 10:41 PM oba stephen  wrote:
>>
>>> You can consider redirecting to a URL that handles the request.
>>>
>>> That is a View function that checks if the user is a student or teacher,
>>> then renders the respective profiles.
>>>
>>> Regards
>>>
>>> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:
>>>
 The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
 profile page. But in scenarios like where there are *students* and
 *teachers*, both of them need their specific profile page after login.

 Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
 getting redirected to the same profile ( in my case, both of them either
 entirely to teachers profile or entirely to students profile).

 How can I set *two login redirects instead of one*? I searched in the
 documentation, online videos, and everything but couldn't find such. Please
 help me with resources/codes/guide/etc from where I can learn from and
 implement. I'm pretty new to this and have tried whatever I know till now.

 Thank You.

 --
 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%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/CAGLHGi4c2yJju-91NAivt_gOeoD%3DyhaUq___VjEuUnADrtoyNw%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/CAAJsLnob_HXQB8jRndd%2Bm4hswgKcewsn%3D28adVNw0xgnOQWi1Q%40mail.gmail.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Gabriel Araya Garcia
Kuntal:
I have resolved that issue, but we can make interchange of information:
I need the Ajax code where I can evaluate in onblur text html if one
patient is found or not. The field key in the text box is RUT (each person
have one in my country)
for example, my rut is 7841349-2, and it's only, no other person have it.
In other words, I need evaluate the information text when the user get out
of this field (text box).
It doesn't help me evaluate it in submit buttom.
I need the following things:
-The template with with two fields, rut and name
-The AJAX code
-The DJANGO VIEW, where it do the seek patient
If you send this information I will send you one bit WORD file with images
how can controller the users permissions

We can help each other to achieve our respective goals






Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos
99.7721.15.70



El sáb., 11 jul. 2020 a las 13:22, Kuntal Paul ()
escribió:

> Thank you for your response. I did this way and it was giving me a 405
> error. I couldn't find my mistake. I was saving both of them as student and
> as teacher separately from auth.user.
>  Also, do I have to provide a separate temple for that view?
>
>
> On Sat, Jul 11, 2020, 10:41 PM oba stephen  wrote:
>
>> You can consider redirecting to a URL that handles the request.
>>
>> That is a View function that checks if the user is a student or teacher,
>> then renders the respective profiles.
>>
>> Regards
>>
>> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:
>>
>>> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
>>> profile page. But in scenarios like where there are *students* and
>>> *teachers*, both of them need their specific profile page after login.
>>>
>>> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
>>> getting redirected to the same profile ( in my case, both of them either
>>> entirely to teachers profile or entirely to students profile).
>>>
>>> How can I set *two login redirects instead of one*? I searched in the
>>> documentation, online videos, and everything but couldn't find such. Please
>>> help me with resources/codes/guide/etc from where I can learn from and
>>> implement. I'm pretty new to this and have tried whatever I know till now.
>>>
>>> Thank You.
>>>
>>> --
>>> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%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/CAKVvSDC2MzBCQYiSs7CSbEYxj1LD28cMFDqF5HWVZz89TtBkGw%40mail.gmail.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Damanjeet Singh
Please check this answer
https://stackoverflow.com/questions/16824004/django-conditional-login-redirect

On Sat, 11 Jul 2020, 18:22 Kuntal Paul,  wrote:

> Thank you for your response. I did this way and it was giving me a 405
> error. I couldn't find my mistake. I was saving both of them as student and
> as teacher separately from auth.user.
>  Also, do I have to provide a separate temple for that view?
>
>
> On Sat, Jul 11, 2020, 10:41 PM oba stephen  wrote:
>
>> You can consider redirecting to a URL that handles the request.
>>
>> That is a View function that checks if the user is a student or teacher,
>> then renders the respective profiles.
>>
>> Regards
>>
>> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:
>>
>>> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
>>> profile page. But in scenarios like where there are *students* and
>>> *teachers*, both of them need their specific profile page after login.
>>>
>>> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
>>> getting redirected to the same profile ( in my case, both of them either
>>> entirely to teachers profile or entirely to students profile).
>>>
>>> How can I set *two login redirects instead of one*? I searched in the
>>> documentation, online videos, and everything but couldn't find such. Please
>>> help me with resources/codes/guide/etc from where I can learn from and
>>> implement. I'm pretty new to this and have tried whatever I know till now.
>>>
>>> Thank You.
>>>
>>> --
>>> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%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/CAGLHGi4c2yJju-91NAivt_gOeoD%3DyhaUq___VjEuUnADrtoyNw%40mail.gmail.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Kuntal Paul
Thank you for your response. I did this way and it was giving me a 405
error. I couldn't find my mistake. I was saving both of them as student and
as teacher separately from auth.user.
 Also, do I have to provide a separate temple for that view?


On Sat, Jul 11, 2020, 10:41 PM oba stephen  wrote:

> You can consider redirecting to a URL that handles the request.
>
> That is a View function that checks if the user is a student or teacher,
> then renders the respective profiles.
>
> Regards
>
> On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:
>
>> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
>> profile page. But in scenarios like where there are *students* and
>> *teachers*, both of them need their specific profile page after login.
>>
>> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
>> getting redirected to the same profile ( in my case, both of them either
>> entirely to teachers profile or entirely to students profile).
>>
>> How can I set *two login redirects instead of one*? I searched in the
>> documentation, online videos, and everything but couldn't find such. Please
>> help me with resources/codes/guide/etc from where I can learn from and
>> implement. I'm pretty new to this and have tried whatever I know till now.
>>
>> Thank You.
>>
>> --
>> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%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/CABD8006ftC%3DtPyk%2BFWikZ0mGLGpiNBnFicU6eq2cL-mRcO-LbA%40mail.gmail.com.


Re: HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread oba stephen
You can consider redirecting to a URL that handles the request.

That is a View function that checks if the user is a student or teacher,
then renders the respective profiles.

Regards

On Sat, Jul 11, 2020 at 5:58 PM Kuntal Paul  wrote:

> The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular
> profile page. But in scenarios like where there are *students* and
> *teachers*, both of them need their specific profile page after login.
>
> Using* LOGIN_REDIRECT_URL*, both the teachers and the students are
> getting redirected to the same profile ( in my case, both of them either
> entirely to teachers profile or entirely to students profile).
>
> How can I set *two login redirects instead of one*? I searched in the
> documentation, online videos, and everything but couldn't find such. Please
> help me with resources/codes/guide/etc from where I can learn from and
> implement. I'm pretty new to this and have tried whatever I know till now.
>
> Thank You.
>
> --
> 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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%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/CAAJsLnqfSPy0VEjpv9TrPS-qcFTWjrtQqhFMMQs8B6qqUX5XOw%40mail.gmail.com.


HOW TO REDIRECT DIFFERENT CATEGORY OF USERS THROUGH LOGIN REDIRECT (two login redirects instead of one)

2020-07-11 Thread Kuntal Paul
The *LOGIN_REDIRECT_URL*  only allowing to redirect to a particular profile 
page. But in scenarios like where there are *students* and *teachers*, both 
of them need their specific profile page after login. 

Using* LOGIN_REDIRECT_URL*, both the teachers and the students are getting 
redirected to the same profile ( in my case, both of them either entirely 
to teachers profile or entirely to students profile). 

How can I set *two login redirects instead of one*? I searched in the 
documentation, online videos, and everything but couldn't find such. Please 
help me with resources/codes/guide/etc from where I can learn from and 
implement. I'm pretty new to this and have tried whatever I know till now.

Thank You.

-- 
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/e185b4ba-2219-4a1b-bba2-8ef4e4466682o%40googlegroups.com.


Re: Performance queries helps

2020-07-11 Thread damanjeet kaur
 {% for news7 in newscat7 %}
{{news7.name }}
{{news7.date|date:'Y-m-d'}}
{{news7.body|safe|truncatewords:20}}
{{news7.category.all.0}}
   Read More
{% endfor %}



On Sat, Jul 11, 2020 at 10:46 AM carlos  wrote:

> Hi, i need any advice for performance queries
> i have a model name Post
> post have m2m categories and fk author
>
> the index page show 7 categories in separated row
> i try performance
> this example
> queryset_global =
> Post.objects.filter(status__contains='publish').prefetch_related('category').select_related('author')
> then i make 7 queries for 7 categories show in index page.
>
> newscat1
> = 
> queryset_global.filter(category__slug__contains="cat1_name").order_by('-date')[:5]
> newscat2
> = 
> queryset_global.filter(category__slug__contains="cat2_name").order_by('-date')[:5]
> newscat3
> = 
> queryset_global.filter(category__slug__contains="cat3_name").order_by('-date')[:5]
> newscat4
> = 
> queryset_global.filter(category__slug__contains="cat4_name").order_by('-date')[:5]
> newscat5
> = 
> queryset_global.filter(category__slug__contains="cat5_name").order_by('-date')[:5]
> newscat6
> = 
> queryset_global.filter(category__slug__contains="cat6_name").order_by('-date')[:5]
> newscat7
> = 
> queryset_global.filter(category__slug__contains="cat7_name").order_by('-date')[:5]
>
> i retrieve 35 post for show in index page
>
> *according debug toolbar this produce SQL*
> *2599.59 ms (44 queries including 34 duplicates )*
>
> Why?
>
> but when i loop in template index.html
> {% for news1 in newscat1 %}
> {{news.name}}
> {{newa.date|date:'Y-m-d'}}
> {{news.body|safe|truncatewords:20}}
> {{news.category.all.0}}
>Read More
> {% endfor %}
>  ...
> this repeat in the template 7 time
> ...
> {% for news7 in newscat7 %}
> {{news.name}}
> {{newa.date|date:'Y-m-d'}}
> {{news.body|safe|truncatewords:20}}
> {{news.category.all.0}}
>Read More
> {% endfor %}
>
>
> *according debug toolbar this produce SQL*
> *3463.65 ms (86 queries including 77 duplicates )*
>
> this is incredible it doubles the amount of queries to the db that may be
> happening?
>
> i need some ideas or tips
>
> Cheers
>
> --
> 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/CAM-7rO1nzzqWf_cpQOrjYwQmxkd77H0AJ8W03FS%3D%2BoA3gEE4zg%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/CAJTCr6E2Vk_VMuRMBpUftmGLnyCbWUq1Dkq6ZN2ttn0xmody3Q%40mail.gmail.com.


Re: 'Sandboxed' Template engine/context

2020-07-11 Thread Integr@te System
Hi Michael,

Plz look at https://pypi.org/project/django-template-engines/

And see in Django doc for your use case
as very detail with builtin jinja2 engine and must config backend
enviroment to use
https://docs.djangoproject.com/en/3.0/topics/templates/#django.template.backends.jinja2.Jinja2

Hope these useful.




On Sat, Jul 11, 2020, 12:25 PM Michael Thomas 
wrote:

> Hi,
>
> I'm aware that other template engines could be used, but it would be much
> more preferable to stick with Django's template engine for a variety of
> reasons (eg. using the same tags in the 'sandboxed' environment vs.
> regular).
>
> On Friday, 10 July 2020 14:41:30 UTC+4, Integr@te System wrote:
>>
>> Hi Michael,
>>
>> Some templates as mako, jinja, genshi...
>>
>>
>>
>>
>> On Fri, Jul 10, 2020, 4:23 PM Michael Thomas 
>> wrote:
>>
>>> Hi all,
>>>
>>> Does anyone know of a straightforward way to create an independent
>>> template engine instance with a subset of the tags/filters/etc. defined?
>>>
>>> The use-case is for allowing user-supplied template content, while
>>> preventing said users from being able to use features that could be
>>> dangerous, leak information, etc.. (Eg. {% extends %}, {% load %},
>>> {{my-secret-variable-that-is-loaded-into-global-context}})
>>>
>>> Kind Regards,
>>> Michael
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e8456f7f-e52f-4bf4-95c6-419d84600687o%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/e50f24b3-1e6e-4260-b720-5af5912ae511o%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/CAP5HUWoh8%3DYGiO5fFhM23aKg8r%2BsqytUpSZEhV9ctvQogzqOww%40mail.gmail.com.