Re: How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Luis Zárate
Also a recomendation, see that `dispatch` method call the view as

handler(request, *args, **kwargs)

So maybe is a good idea do something like:

class MyView(view):
 def put(self, request, *args, **kwargs):
...


Regards,

El vie, 12 abr 2024 a las 16:13, Luis Zárate ()
escribió:

> See
> https://docs.djangoproject.com/en/5.0/topics/class-based-views/#supporting-other-http-methods
> Also on view you have a variable called, where you can limit the available
> methods.
>
> http_method_names
>
>
> El vie, 12 abr 2024 a las 7:20, Mamadou Alpha Bah (<
> mamadoualphabah...@gmail.com>) escribió:
>
>> <https://stackoverflow.com/posts/78314829/timeline>
>>
>> I'm setting up a CRUD system with Django, using Class-Based Views.
>> Currently I'm trying to figure out how to handle HTTP PUT and DELETE
>> requests in my application. Despite searching the Django documentation
>> extensively, I'm having trouble finding concrete examples and clear
>> explanations of how to submit these types of queries to a class-based view.
>>
>> I created a view class named CategoryView, extending from:
>> django.views.View, in which I implemented the get and post methods
>> successfully. And I want to build my urls like this:
>>
>>1. New Category: 127.0.0.1:8000/backendapp/categories/create
>>2. List all Category: 127.0.0.1:8000/backendapp/categories/
>>3. Retrieve only one Category: 127.0.0.1:8000/backendapp/categories/1
>>4. Etc...
>>
>> However, when I try to implement the put and delete methods, I get stuck.
>>
>> For example :
>> from django.views import View
>>
>> class CategoryView(View):
>>  template_name = 'backendapp/pages/category/categories.html'
>>
>>  def get(self, request):
>>   categories = Category.objects.all()
>>   context = { 'categories': categories }
>>   return render(request, self.template_name, context)
>>
>>  def post(self, request):
>>   return
>>
>>  def delete(self, request, pk):
>>   return
>>
>>  def put(self, request):
>>   return
>>
>> I read through the Django documentation and found that Class-Based Views
>> support HTTP requests: ["get", "post", "put", "patch", "delete", "head ",
>> "options", "trace"].
>>
>> link:
>> https://docs.djangoproject.com/en/5.0/ref/class-based-views/base/#django.views.generic.base.View
>> <https://stackoverflow.com>
>>
>> Despite this, I can't figure out how to do it.
>>
>> So I'm asking for your help to unblock me.
>>
>> I looked at the Django documentation and searched online for examples and
>> tutorials on handling HTTP requests in class-based views. I also tried
>> experimenting with adding the put and delete methods to my CategoryView
>> view class, but without success. I expected to find resources that clearly
>> explain how to integrate these queries into my Django application, as well
>> as practical examples demonstrating their use. However, I haven't found a
>> working solution and am now seeking help from the community to overcome
>> this difficulty.
>>
>> --
>> 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/b1ecd4a7-5946-4da5-80ae-5923b6648a70n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/b1ecd4a7-5946-4da5-80ae-5923b6648a70n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>

-- 
"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/CAG%2B5VyNQtHhV3TPMtB4qLyipdjcnZBZA8_mwf-1_j2F%2B_sER5g%40mail.gmail.com.


Re: How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Luis Zárate
See
https://docs.djangoproject.com/en/5.0/topics/class-based-views/#supporting-other-http-methods
Also on view you have a variable called, where you can limit the available
methods.

http_method_names


El vie, 12 abr 2024 a las 7:20, Mamadou Alpha Bah (<
mamadoualphabah...@gmail.com>) escribió:

> <https://stackoverflow.com/posts/78314829/timeline>
>
> I'm setting up a CRUD system with Django, using Class-Based Views.
> Currently I'm trying to figure out how to handle HTTP PUT and DELETE
> requests in my application. Despite searching the Django documentation
> extensively, I'm having trouble finding concrete examples and clear
> explanations of how to submit these types of queries to a class-based view.
>
> I created a view class named CategoryView, extending from:
> django.views.View, in which I implemented the get and post methods
> successfully. And I want to build my urls like this:
>
>1. New Category: 127.0.0.1:8000/backendapp/categories/create
>2. List all Category: 127.0.0.1:8000/backendapp/categories/
>3. Retrieve only one Category: 127.0.0.1:8000/backendapp/categories/1
>4. Etc...
>
> However, when I try to implement the put and delete methods, I get stuck.
>
> For example :
> from django.views import View
>
> class CategoryView(View):
>  template_name = 'backendapp/pages/category/categories.html'
>
>  def get(self, request):
>   categories = Category.objects.all()
>   context = { 'categories': categories }
>   return render(request, self.template_name, context)
>
>  def post(self, request):
>   return
>
>  def delete(self, request, pk):
>   return
>
>  def put(self, request):
>   return
>
> I read through the Django documentation and found that Class-Based Views
> support HTTP requests: ["get", "post", "put", "patch", "delete", "head ",
> "options", "trace"].
>
> link:
> https://docs.djangoproject.com/en/5.0/ref/class-based-views/base/#django.views.generic.base.View
> <https://stackoverflow.com>
>
> Despite this, I can't figure out how to do it.
>
> So I'm asking for your help to unblock me.
>
> I looked at the Django documentation and searched online for examples and
> tutorials on handling HTTP requests in class-based views. I also tried
> experimenting with adding the put and delete methods to my CategoryView
> view class, but without success. I expected to find resources that clearly
> explain how to integrate these queries into my Django application, as well
> as practical examples demonstrating their use. However, I haven't found a
> working solution and am now seeking help from the community to overcome
> this difficulty.
>
> --
> 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/b1ecd4a7-5946-4da5-80ae-5923b6648a70n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b1ecd4a7-5946-4da5-80ae-5923b6648a70n%40googlegroups.com?utm_medium=email_source=footer>
> .
>


-- 
"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/CAG%2B5VyNsQdYWD4W_Mfr%3DMfdP-DrbYeWf0qAgWDEN6TDbVOpR7A%40mail.gmail.com.


How to effectively use PUT and DELETE HTTP methods in Django Class-Based Views?

2024-04-12 Thread Mamadou Alpha Bah
 <https://stackoverflow.com/posts/78314829/timeline>

I'm setting up a CRUD system with Django, using Class-Based Views. 
Currently I'm trying to figure out how to handle HTTP PUT and DELETE 
requests in my application. Despite searching the Django documentation 
extensively, I'm having trouble finding concrete examples and clear 
explanations of how to submit these types of queries to a class-based view.

I created a view class named CategoryView, extending from: 
django.views.View, in which I implemented the get and post methods 
successfully. And I want to build my urls like this:

   1. New Category: 127.0.0.1:8000/backendapp/categories/create 
   2. List all Category: 127.0.0.1:8000/backendapp/categories/ 
   3. Retrieve only one Category: 127.0.0.1:8000/backendapp/categories/1 
   4. Etc... 

However, when I try to implement the put and delete methods, I get stuck.

For example :
from django.views import View 

class CategoryView(View):
 template_name = 'backendapp/pages/category/categories.html'
 
 def get(self, request):
  categories = Category.objects.all()
  context = { 'categories': categories }
  return render(request, self.template_name, context)

 def post(self, request):
  return

 def delete(self, request, pk):
  return

 def put(self, request):
  return

I read through the Django documentation and found that Class-Based Views 
support HTTP requests: ["get", "post", "put", "patch", "delete", "head ", 
"options", "trace"].

link: 
https://docs.djangoproject.com/en/5.0/ref/class-based-views/base/#django.views.generic.base.View
 
<https://stackoverflow.com>

Despite this, I can't figure out how to do it.

So I'm asking for your help to unblock me.

I looked at the Django documentation and searched online for examples and 
tutorials on handling HTTP requests in class-based views. I also tried 
experimenting with adding the put and delete methods to my CategoryView 
view class, but without success. I expected to find resources that clearly 
explain how to integrate these queries into my Django application, as well 
as practical examples demonstrating their use. However, I haven't found a 
working solution and am now seeking help from the community to overcome 
this difficulty.

-- 
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/b1ecd4a7-5946-4da5-80ae-5923b6648a70n%40googlegroups.com.


OneSignal Push Notification for iOS and Android via Django Views

2023-12-28 Thread Lightning Bit
Hello, 

The OneSignal API does not have a segment that details how to send a 
OneSignal Push Notification to iOS and Android devices w/ Python. Is there 
any way to have a Push Notification delivered after an email is delivered 
via Django Views?

Thanks 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/ea378ebf-d0db-4c2f-852a-616773f5402dn%40googlegroups.com.


Re: Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-20 Thread awe...@foxmail.com

I think you may split the async endpoints and the sync endpoints into two 
different procress group and start them in different ways( different start 
up command, worker and different port). And config the Load Balancer 
(Nginx?) to point to different ports by path..
I would handle the migration in this way to make sure everything is going 
right in production.
在2023年4月18日星期二 UTC+8 07:14:36 写道:

> I know you can run gunicorn with uvicorn workers. But the sync views will 
> be running sync, no longer gevent patched, meaning performance could 
> change. I’m also unsure if sync views are serialized into one thread if you 
> don’t set DJANGO_ALLOW_ASYNC_UNSAFE, which could be a bottleneck.
>
> I did some more research and thinking and I made two errors in my first 
> post, but it doesn’t really change the matter. 1) doing something like 
> monkey.patch_all() to patch things out with async versions does not work, 
> because you can’t get the patched things to magically somehow be awaited 
> instead of being called normally 2) I didn’t realize you can run django 
> hybrid (both sync and async views) both under WSGI as well as ASGI.
>
> On Monday, April 17, 2023 at 8:34:55 AM UTC+2 TITAS ONLINE MARKET wrote:
>
>> Thanks 
>>
>> On Mon, 17 Apr 2023, 11:42 am Fortune Osho,  wrote:
>>
>>> You can simply run gunicorn with unicorn workers... which is very 
>>> performance using uvloop... test it performance against pure gunicorn... 
>>> note that performance is not totally dependent on server used(a whole lot 
>>> of things can affect performance like moddlewares, serialization etc)
>>>
>>>
>>> On Sun, Apr 16, 2023 at 5:34 PM Chris Barber  
>>> wrote:
>>>
>>>> Hello
>>>>
>>>> Production django app, currently 100% sync views, running under 
>>>> gunicorn with gevent worker class.
>>>>
>>>> @andrewgodwin suggests here it is possible to migrate slowly, just run 
>>>> hybrid sync-async and add or convert views as desired
>>>> https://www.youtube.com/watch?v=19Uh_PA_8Rc=1728s
>>>>
>>>> But to get a single async view one has to switch to uvicorn workers or 
>>>> similar, right? Now one is no longer getting the gevent patching for sync 
>>>> views, which could be a major impact on performance/scaling, and could 
>>>> trigger re-evaluation of the production deployment & tuning!
>>>>
>>>> Questions:
>>>>
>>>> 1. How to approach this? It has me wondering if monkey.patch_all() 
>>>> should be ported to asyncio and tested under uvicorn. This would smooth 
>>>> the 
>>>> transition since the sync views should perform and scale roughly the same 
>>>> as before.
>>>>
>>>> 2. Also an important technical question on how sync views under ASGI 
>>>> work. By default they will run all in the same thread (*per worker*) 
>>>> which could be really bad for performance with tons of sync views, 
>>>> correct? 
>>>> If I enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in 
>>>> more threads, right? How many threads?Should I expect to have to tune this?
>>>>
>>>> In general, regardless of the approach, one could presumably A/B test 
>>>> in a live environment - run some workers / nodes under uvicorn, partition 
>>>> the traffic accordingly, and see how it compares. Tune, stress test, and 
>>>> then rolling transition.
>>>>
>>>> -C
>>>>
>>>> -- 
>>>> 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/8cc88d44-df9f-4232-8f57-89a1b07fb769n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/8cc88d44-df9f-4232-8f57-89a1b07fb769n%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/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%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/03c48517-73e2-4483-b9fe-52f680868ae8n%40googlegroups.com.


Re: Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-17 Thread Chris Barber
I know you can run gunicorn with uvicorn workers. But the sync views will 
be running sync, no longer gevent patched, meaning performance could 
change. I’m also unsure if sync views are serialized into one thread if you 
don’t set DJANGO_ALLOW_ASYNC_UNSAFE, which could be a bottleneck.

I did some more research and thinking and I made two errors in my first 
post, but it doesn’t really change the matter. 1) doing something like 
monkey.patch_all() to patch things out with async versions does not work, 
because you can’t get the patched things to magically somehow be awaited 
instead of being called normally 2) I didn’t realize you can run django 
hybrid (both sync and async views) both under WSGI as well as ASGI.

On Monday, April 17, 2023 at 8:34:55 AM UTC+2 TITAS ONLINE MARKET wrote:

> Thanks 
>
> On Mon, 17 Apr 2023, 11:42 am Fortune Osho,  wrote:
>
>> You can simply run gunicorn with unicorn workers... which is very 
>> performance using uvloop... test it performance against pure gunicorn... 
>> note that performance is not totally dependent on server used(a whole lot 
>> of things can affect performance like moddlewares, serialization etc)
>>
>>
>> On Sun, Apr 16, 2023 at 5:34 PM Chris Barber  wrote:
>>
>>> Hello
>>>
>>> Production django app, currently 100% sync views, running under gunicorn 
>>> with gevent worker class.
>>>
>>> @andrewgodwin suggests here it is possible to migrate slowly, just run 
>>> hybrid sync-async and add or convert views as desired
>>> https://www.youtube.com/watch?v=19Uh_PA_8Rc=1728s
>>>
>>> But to get a single async view one has to switch to uvicorn workers or 
>>> similar, right? Now one is no longer getting the gevent patching for sync 
>>> views, which could be a major impact on performance/scaling, and could 
>>> trigger re-evaluation of the production deployment & tuning!
>>>
>>> Questions:
>>>
>>> 1. How to approach this? It has me wondering if monkey.patch_all() 
>>> should be ported to asyncio and tested under uvicorn. This would smooth the 
>>> transition since the sync views should perform and scale roughly the same 
>>> as before.
>>>
>>> 2. Also an important technical question on how sync views under ASGI 
>>> work. By default they will run all in the same thread (*per worker*) 
>>> which could be really bad for performance with tons of sync views, correct? 
>>> If I enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in 
>>> more threads, right? How many threads?Should I expect to have to tune this?
>>>
>>> In general, regardless of the approach, one could presumably A/B test in 
>>> a live environment - run some workers / nodes under uvicorn, partition the 
>>> traffic accordingly, and see how it compares. Tune, stress test, and then 
>>> rolling transition.
>>>
>>> -C
>>>
>>> -- 
>>> 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/8cc88d44-df9f-4232-8f57-89a1b07fb769n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/8cc88d44-df9f-4232-8f57-89a1b07fb769n%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/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%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/68a3f159-9c6b-4216-b476-9f4ef37e2a06n%40googlegroups.com.


Re: Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-17 Thread TITAS ONLINE MARKET
Thanks

On Mon, 17 Apr 2023, 11:42 am Fortune Osho,  wrote:

> You can simply run gunicorn with unicorn workers... which is very
> performance using uvloop... test it performance against pure gunicorn...
> note that performance is not totally dependent on server used(a whole lot
> of things can affect performance like moddlewares, serialization etc)
>
>
> On Sun, Apr 16, 2023 at 5:34 PM Chris Barber 
> wrote:
>
>> Hello
>>
>> Production django app, currently 100% sync views, running under gunicorn
>> with gevent worker class.
>>
>> @andrewgodwin suggests here it is possible to migrate slowly, just run
>> hybrid sync-async and add or convert views as desired
>> https://www.youtube.com/watch?v=19Uh_PA_8Rc=1728s
>>
>> But to get a single async view one has to switch to uvicorn workers or
>> similar, right? Now one is no longer getting the gevent patching for sync
>> views, which could be a major impact on performance/scaling, and could
>> trigger re-evaluation of the production deployment & tuning!
>>
>> Questions:
>>
>> 1. How to approach this? It has me wondering if monkey.patch_all() should
>> be ported to asyncio and tested under uvicorn. This would smooth the
>> transition since the sync views should perform and scale roughly the same
>> as before.
>>
>> 2. Also an important technical question on how sync views under ASGI
>> work. By default they will run all in the same thread (*per worker*)
>> which could be really bad for performance with tons of sync views, correct?
>> If I enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in
>> more threads, right? How many threads?Should I expect to have to tune this?
>>
>> In general, regardless of the approach, one could presumably A/B test in
>> a live environment - run some workers / nodes under uvicorn, partition the
>> traffic accordingly, and see how it compares. Tune, stress test, and then
>> rolling transition.
>>
>> -C
>>
>> --
>> 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/8cc88d44-df9f-4232-8f57-89a1b07fb769n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/8cc88d44-df9f-4232-8f57-89a1b07fb769n%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/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%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/CAHdtJhU-ohRUcqju5xKkmf5vEcJ0p%2BHJtEP7zB13HC_4B3CJGw%40mail.gmail.com.


Re: Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-16 Thread Fortune Osho
You can simply run gunicorn with unicorn workers... which is very
performance using uvloop... test it performance against pure gunicorn...
note that performance is not totally dependent on server used(a whole lot
of things can affect performance like moddlewares, serialization etc)


On Sun, Apr 16, 2023 at 5:34 PM Chris Barber 
wrote:

> Hello
>
> Production django app, currently 100% sync views, running under gunicorn
> with gevent worker class.
>
> @andrewgodwin suggests here it is possible to migrate slowly, just run
> hybrid sync-async and add or convert views as desired
> https://www.youtube.com/watch?v=19Uh_PA_8Rc=1728s
>
> But to get a single async view one has to switch to uvicorn workers or
> similar, right? Now one is no longer getting the gevent patching for sync
> views, which could be a major impact on performance/scaling, and could
> trigger re-evaluation of the production deployment & tuning!
>
> Questions:
>
> 1. How to approach this? It has me wondering if monkey.patch_all() should
> be ported to asyncio and tested under uvicorn. This would smooth the
> transition since the sync views should perform and scale roughly the same
> as before.
>
> 2. Also an important technical question on how sync views under ASGI work.
> By default they will run all in the same thread (*per worker*) which
> could be really bad for performance with tons of sync views, correct? If I
> enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in more
> threads, right? How many threads?Should I expect to have to tune this?
>
> In general, regardless of the approach, one could presumably A/B test in a
> live environment - run some workers / nodes under uvicorn, partition the
> traffic accordingly, and see how it compares. Tune, stress test, and then
> rolling transition.
>
> -C
>
> --
> 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/8cc88d44-df9f-4232-8f57-89a1b07fb769n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8cc88d44-df9f-4232-8f57-89a1b07fb769n%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/CABqs0Mwr%3DXjg6OLUAN9kxsqCKREJW1%2BtrkDHbTq0pnazKgqQkQ%40mail.gmail.com.


Async views means dropping gunicorn gevent for uvicorn, affecting sync view performance

2023-04-16 Thread Chris Barber
Hello

Production django app, currently 100% sync views, running under gunicorn 
with gevent worker class.

@andrewgodwin suggests here it is possible to migrate slowly, just run 
hybrid sync-async and add or convert views as desired
https://www.youtube.com/watch?v=19Uh_PA_8Rc=1728s

But to get a single async view one has to switch to uvicorn workers or 
similar, right? Now one is no longer getting the gevent patching for sync 
views, which could be a major impact on performance/scaling, and could 
trigger re-evaluation of the production deployment & tuning!

Questions:

1. How to approach this? It has me wondering if monkey.patch_all() should 
be ported to asyncio and tested under uvicorn. This would smooth the 
transition since the sync views should perform and scale roughly the same 
as before.

2. Also an important technical question on how sync views under ASGI work. 
By default they will run all in the same thread (*per worker*) which could 
be really bad for performance with tons of sync views, correct? If I 
enable DJANGO_ALLOW_ASYNC_UNSAFE, then the sync views will be run in more 
threads, right? How many threads?Should I expect to have to tune this?

In general, regardless of the approach, one could presumably A/B test in a 
live environment - run some workers / nodes under uvicorn, partition the 
traffic accordingly, and see how it compares. Tune, stress test, and then 
rolling transition.

-C

-- 
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/8cc88d44-df9f-4232-8f57-89a1b07fb769n%40googlegroups.com.


Re: Beginner: How to find fields that can be over-ridden in a Generic Class Based Views

2023-04-11 Thread PULKIT AGRAWAL
Thanks Chetan for your response

On Tuesday, 11 April 2023 at 19:18:11 UTC+5:30 Chetan Ganji wrote:

> Hello Pulkit,
> Information you are asking is not readily available. It will become clear 
> to you as you start writing code. 
>
> However, you can use below options to make your life easier.
>
>1. https://ccbv.co.uk
>2. dir and callable methods can help you get more clarity. 
>
>
> I hope it helps you.
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji@gmail.com
> http://ryucoder.in
>
>
> On Tue, Apr 11, 2023 at 6:14 PM PULKIT AGRAWAL  wrote:
>
>> Hello Everyone,
>>
>> I am very new to Django and am still learning the ropes. If anyone can 
>> point me in the right direction, I will be thankful to you.
>>
>> My problems is as follows:
>> 1. I have learned about class based views and have started using them
>> 2. But every now and then I come across a new field that could have been 
>> overwritten in the class based view to shorted the code
>> 3. Is there a way to identify all the fields that can be over written in 
>> a class based view.
>>
>> Let me illustrate with an example:
>> class UnitCreateView(CreateView):
>> form_class = UnitCreationForm
>> template_name = 'units_of_measurement/unit_create.html'
>> success_url = reverse_lazy('units_of_measurement:unit_list')
>>
>> In the above class, can I know how many and what other fields such as 
>> "form_class" are available to over-riding? I have checked the documentation 
>> but have not found anything. Maybe its just me.
>>
>> Thanks in advance!
>>
>> Regards,
>>
>> Plkt
>>
>> -- 
>> 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/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%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/a665d290-d7ae-496a-97d1-0741c4e7172cn%40googlegroups.com.


Re: Beginner: How to find fields that can be over-ridden in a Generic Class Based Views

2023-04-11 Thread Sebastian Jung
Hello Plkt i have no idea what you mean and what is the aim sorry

PULKIT AGRAWAL  schrieb am Di., 11. Apr. 2023, 14:44:

> Hello Everyone,
>
> I am very new to Django and am still learning the ropes. If anyone can
> point me in the right direction, I will be thankful to you.
>
> My problems is as follows:
> 1. I have learned about class based views and have started using them
> 2. But every now and then I come across a new field that could have been
> overwritten in the class based view to shorted the code
> 3. Is there a way to identify all the fields that can be over written in a
> class based view.
>
> Let me illustrate with an example:
> class UnitCreateView(CreateView):
> form_class = UnitCreationForm
> template_name = 'units_of_measurement/unit_create.html'
> success_url = reverse_lazy('units_of_measurement:unit_list')
>
> In the above class, can I know how many and what other fields such as
> "form_class" are available to over-riding? I have checked the documentation
> but have not found anything. Maybe its just me.
>
> Thanks in advance!
>
> Regards,
>
> Plkt
>
> --
> 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/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%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/CAKGT9mw7cizo4JjECxJco-kU6eO%2B2skq5T9qwfD4fOAbEyCH2w%40mail.gmail.com.


Re: Beginner: How to find fields that can be over-ridden in a Generic Class Based Views

2023-04-11 Thread Chetan Ganji
Hello Pulkit,
Information you are asking is not readily available. It will become clear
to you as you start writing code.

However, you can use below options to make your life easier.

   1. https://ccbv.co.uk
   2. dir and callable methods can help you get more clarity.


I hope it helps you.

Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in


On Tue, Apr 11, 2023 at 6:14 PM PULKIT AGRAWAL 
wrote:

> Hello Everyone,
>
> I am very new to Django and am still learning the ropes. If anyone can
> point me in the right direction, I will be thankful to you.
>
> My problems is as follows:
> 1. I have learned about class based views and have started using them
> 2. But every now and then I come across a new field that could have been
> overwritten in the class based view to shorted the code
> 3. Is there a way to identify all the fields that can be over written in a
> class based view.
>
> Let me illustrate with an example:
> class UnitCreateView(CreateView):
> form_class = UnitCreationForm
> template_name = 'units_of_measurement/unit_create.html'
> success_url = reverse_lazy('units_of_measurement:unit_list')
>
> In the above class, can I know how many and what other fields such as
> "form_class" are available to over-riding? I have checked the documentation
> but have not found anything. Maybe its just me.
>
> Thanks in advance!
>
> Regards,
>
> Plkt
>
> --
> 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/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%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/CAMKMUjtB5yFCX7%2Bc9HgYNzzR7Jak8cOaXV6MEJQwyJVftzpTHg%40mail.gmail.com.


Beginner: How to find fields that can be over-ridden in a Generic Class Based Views

2023-04-11 Thread PULKIT AGRAWAL
Hello Everyone,

I am very new to Django and am still learning the ropes. If anyone can 
point me in the right direction, I will be thankful to you.

My problems is as follows:
1. I have learned about class based views and have started using them
2. But every now and then I come across a new field that could have been 
overwritten in the class based view to shorted the code
3. Is there a way to identify all the fields that can be over written in a 
class based view.

Let me illustrate with an example:
class UnitCreateView(CreateView):
form_class = UnitCreationForm
template_name = 'units_of_measurement/unit_create.html'
success_url = reverse_lazy('units_of_measurement:unit_list')

In the above class, can I know how many and what other fields such as 
"form_class" are available to over-riding? I have checked the documentation 
but have not found anything. Maybe its just me.

Thanks in advance!

Regards,

Plkt

-- 
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/1666860d-5b3a-4cc8-a4b4-0187f5dc5b48n%40googlegroups.com.


Re: I am struggling with calling consumer.py function from views to consumer in django here ismy code. Please help me. I am calling Asyncwebsocketconsumer

2023-04-02 Thread MOHAMED SABEEH VADAKKATH VALAPPIL

can you provide more details about the specific issues you are facing when 
trying to call this method? Are you getting any error messages, or is the 
function simply not being called? Any additional information you can 
provide will help me better understand your problem.

I am providing you with one of my codes for your preference. Please find 
the attached code in this email.If you have any questions or concerns, 
please do not hesitate to reach out to me.
import json
from channels.generic.websocket import AsyncWebsocketConsumer

class NotificationConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.room_name = self.scope['url_route']['kwargs']['room_name']
self.room_group_name = 'notification_%s' % self.room_name

# Join room group
await self.channel_layer.group_add(
self.room_group_name,
self.channel_name
)

await self.accept()

async def disconnect(self, close_code):
# Leave room group
await self.channel_layer.group_discard(
self.room_group_name,
self.channel_name
)

async def send_notification(self, event):
message = json.loads(event['message'])

# Send message to WebSocket
await self.send(text_data=json.dumps(message))


views.py

# order notification inside function ... when receiving order 
message = "New order received ... .. ect...messages"
channel_layer = get_channel_layer()
async_to_sync(channel_layer.group_send)(
"notification_to_admin",
{
'type': 'send_notification',
'message': json.dumps(message)
}
)

"when using Django Channels, you need to use an ASGI server instead of a 
traditional WSGI 
server to serve your Django application.ASGI (Asynchronous Server Gateway 
Interface) is a standard interface for 
Python web servers to support asynchronous web applications. It allows for 
more efficient handling of long-lived 
connections, such as WebSockets, and enables Django to handle asynchronous 
requests and responses."
asgi.py
import os
import django
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'EcomShoppers.settings')
django.setup()

from channels.auth import AuthMiddleware, AuthMiddlewareStack
from notifications.routing import websocket_urlpatterns
application = ProtocolTypeRouter({
"http": get_asgi_application(),
"websocket": AuthMiddlewareStack(
URLRouter(
websocket_urlpatterns
)
)
})
On Sunday, April 2, 2023 at 7:57:09 PM UTC+5:30 Sneha Vishwakarma wrote:

> from channels.generic.websocket import AsyncWebsocketConsumer
> import json
>
> class MyConsumer(AsyncWebsocketConsumer):
> async def connect(self):
> self.room_group_name = 'kafka'
>
> # Join room group
> await self.channel_layer.group_add(
> self.room_group_name,
> self.channel_name
> )
>
> await self.accept()
>
> async def disconnect(self, close_code):
> # Leave room group
> await self.channel_layer.group_discard(
> self.room_group_name,
> self.channel_name
> )
> # Receive message from WebSocket
> async def receive(self, text_data):
> text_data_json = json.loads(text_data)
> message = text_data_json['message']
>
> # Send message to room group
> await self.channel_layer.group_send(
> self.room_group_name,
> {
> 'type': 'kafka_message',
> 'message': message
> }
> )
>
> # Receive message from room group
> async def kafka_message(self, event):
> message = event['message']
> print('HERE')
> # Send message to WebSocket
> await self.send(text_data=json.dumps({
> 'message': message
> }))
>
>
>
> views.py
>
> from channels.layers import get_channel_layer
> from asgiref.sync import async_to_sync, sync_to_async
> from django.contrib.auth.decorators import login_required
> from django.template import loader
> from .models import artifactInfo
> from django.shortcuts import render
> from django.http import HttpResponse,  HttpResponseNotFound, JsonResponse
> import os, mimetypes, json
> from .logic import send_message
> import logging
> logger = logging.getLogger(__name__)
>
> def testview(request):
> channel_layer = get_channel_layer()
>
> async_to_sync(channel_layer.group_send(
> 'kafka',
> {
> 'type': 'kafka.message',
> 'message': 'Test message'
> }
> ))
> return HttpResponse('Done')
>
>
>

-- 
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 

I am struggling with calling consumer.py function from views to consumer in django here ismy code. Please help me. I am calling Asyncwebsocketconsumer

2023-04-02 Thread 'Sneha Vishwakarma' via Django users
from channels.generic.websocket import AsyncWebsocketConsumer
import json

class MyConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.room_group_name = 'kafka'

# Join room group
await self.channel_layer.group_add(
self.room_group_name,
self.channel_name
)

await self.accept()

async def disconnect(self, close_code):
# Leave room group
await self.channel_layer.group_discard(
self.room_group_name,
self.channel_name
)
# Receive message from WebSocket
async def receive(self, text_data):
text_data_json = json.loads(text_data)
message = text_data_json['message']

# Send message to room group
await self.channel_layer.group_send(
self.room_group_name,
{
'type': 'kafka_message',
'message': message
}
)

# Receive message from room group
async def kafka_message(self, event):
message = event['message']
print('HERE')
# Send message to WebSocket
await self.send(text_data=json.dumps({
'message': message
}))



views.py

from channels.layers import get_channel_layer
from asgiref.sync import async_to_sync, sync_to_async
from django.contrib.auth.decorators import login_required
from django.template import loader
from .models import artifactInfo
from django.shortcuts import render
from django.http import HttpResponse,  HttpResponseNotFound, JsonResponse
import os, mimetypes, json
from .logic import send_message
import logging
logger = logging.getLogger(__name__)

def testview(request):
channel_layer = get_channel_layer()

async_to_sync(channel_layer.group_send(
'kafka',
{
'type': 'kafka.message',
'message': 'Test message'
}
))
return HttpResponse('Done')


-- 
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/5cf7970c-1823-414e-bf23-f8805626194bn%40googlegroups.com.


Threading and Async Views

2023-03-07 Thread Vasanth Mohan
Hello,

I'm currently building a multitenant service on django that uses a separate 
DB configuration per tenant. The frontend adds a unique header along with 
their requests so that the app can identify the tenant and select the DB to 
be used.

The catch is the tenant reference is stored as a thread local variable, so 
that the DatabaseRouter can use it. 

However, I am currently looking up async views to see if it can help 
optimise our apis. Will my thread-based logic clash with the ASGI async 
views ? 

Thanks
Vasanth M

-- 
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/a2edc596-2c59-4ed2-8afe-9aff9c1ecb52n%40googlegroups.com.


Re: Function-based Views vs Class-based Views

2023-03-06 Thread Carsten Fuchs
I would like to recommend this excellent guide by Luke Plant:

https://spookylukey.github.io/django-views-the-right-way/

Best regards,
Carsten


Am 06.03.23 um 21:19 schrieb Michael Starr:
> What are the pros and cons of either method of rendering HTTP request 
> responses?
> 
> https://www.geeksforgeeks.org/class-based-vs-function-based-views-which-one-is-better-to-use-in-django/
> 
> In the article above it states that CBVs are DRYer, but I don't understand 
> why. The article doesn't explain, it just states it.
> 
> The rest of the article is pretty good but it's a pretty slim introduction.
> 
> I thought many of you would like to chime in on this topic. Leave your 
> opinion below! What do you use?
> 
> Mike

-- 
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/010ccb6f-bd96-c42a-40cf-b4503708edf6%40cafu.de.


Re: Function-based Views vs Class-based Views

2023-03-06 Thread Prosper Lekia
Using classes is always a good way of promoting code usability, and 
inheritance. With class base views you don't need to reinvent the wheel. 
You can access other  Django classes and methods and reduce code 
complexity. Although most codes are encapsulated, but you can always go 
back to the Django source code for review.

On Monday, March 6, 2023 at 9:19:21 PM UTC+1 Michael Starr wrote:

> What are the pros and cons of either method of rendering HTTP request 
> responses?
>
>
> https://www.geeksforgeeks.org/class-based-vs-function-based-views-which-one-is-better-to-use-in-django/
>
> In the article above it states that CBVs are DRYer, but I don't understand 
> why. The article doesn't explain, it just states it.
>
> The rest of the article is pretty good but it's a pretty slim introduction.
>
> I thought many of you would like to chime in on this topic. Leave your 
> opinion below! What do you use?
>
> Mike
>

-- 
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/d998e837-efcf-4f42-94cb-cc174135d35bn%40googlegroups.com.


Function-based Views vs Class-based Views

2023-03-06 Thread Michael Starr
What are the pros and cons of either method of rendering HTTP request 
responses?

https://www.geeksforgeeks.org/class-based-vs-function-based-views-which-one-is-better-to-use-in-django/

In the article above it states that CBVs are DRYer, but I don't understand 
why. The article doesn't explain, it just states it.

The rest of the article is pretty good but it's a pretty slim introduction.

I thought many of you would like to chime in on this topic. Leave your 
opinion below! What do you use?

Mike

-- 
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/7bfa978b-3c11-4509-9160-799e5da43b44n%40googlegroups.com.


Export table created in Views to a CSV with a button

2023-01-09 Thread Tristan Tucker
Hello,

I have built a view that takes in dataframes, runs them through a function 
and then ultimately pumps out a results dataframe that is transformed into 
a HTML object and displayed on the webapp homepage. Now, I am trying to add 
in an "Export as CSV" button that upon being clicked will download that 
table/dataframe to a .csv file to the user's downloads folder. Any help on 
how to do this? I am struggling to find anything on how specifically to do 
this.

I was thinking maybe create a new view or function within HTML code that 
uses some sort of write csv function but not sure.

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/fc48decd-31b8-4435-a6e5-9e57ba263b9dn%40googlegroups.com.


Re: EROR AT INITIAL VIEWS

2022-11-15 Thread Pooja Kumari
Try views or .views while importing and urls.py you should give path like
views.home_view()

On Tue, Nov 15, 2022, 11:25 PM Ogunsanya Opeyemi <
ogunsanyaopeye...@gmail.com> wrote:

> Your views.py is inside profiles folder not pages folder so change
> pages.views to profiles.views
>
> On Tuesday, November 15, 2022 at 6:08:56 PM UTC+1 gabk...@gmail.com wrote:
>
>> [image: 2.png][image: 3.png]
>
>
>
>> Hi, kindly help me with this error, i seem not to know what is the cause
>> and how to fix it. Thank you. Can[image: 1.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/b75d5986-4cf0-47b0-b4ce-7a9543b7a318n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b75d5986-4cf0-47b0-b4ce-7a9543b7a318n%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/CAHYvwbX8vcyygVXByB0mz%3DUkS%2BGeJdxneiJwMjKCAfzdhqU%3DJQ%40mail.gmail.com.


Anyone testing async views with django test client?

2022-09-20 Thread 'SP' via Django users
My async  CBV works when accessed through my url endpoint with REQUESTS 
package.  But with the django test client it seems to think the database 
doesn't contain the information I'm trying to pull using ORM. I've 
confirmed that the data DOES exist in the newly recreated DB (populated 
with fixtures in my TestCase based class. 

Any suggestions would be appreciated!

-- 
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/1e727d43-93ae-462d-985f-853f3ed418ccn%40googlegroups.com.


Re: Class based views with forms

2022-04-28 Thread Vishesh Mangla
Iommi forms

On Thu, 28 Apr 2022, 23:00 Ryan Nowakowski,  wrote:

> You're right, it's not very clear how to have a single class-based view
> handle both displaying details and submitting a form.  This is a
> fantastic site that shows how each class based view is set up
> inheritance-wise: https://ccbv.co.uk/
>
> Take a look the ancestors for DetailView:
>
> https://ccbv.co.uk/projects/Django/4.0/django.views.generic.detail/DetailView/
>
> ... and the ancestors for FormView:
> https://ccbv.co.uk/projects/Django/4.0/django.views.generic.edit/FormView/
>
>
> Maybe you can just add the FormMixin as an ancestor to your DetailView.
>
>
> As another option, maybe you can create a separate FormView that you can
> POST to from your DetailView.
>
>
> - Ryan N
>
> On 4/26/22 5:25 AM, alex smolyakov wrote:
> > Can anyone explain me how to make send email form on page.
> >
> > So my forms.py
> >
> > class ContactForm(forms.Form):
> > name = forms.CharField(required=True)
> > last_name = forms.CharField()
> > adults = forms.IntegerField() children = forms.IntegerField()
> > email = forms.EmailField(required=True)
> > message = forms.CharField(widget=forms.Textarea)
> >
> > views.py
> >
> > class TourDetailView(DetailView):
> > model = models.Tour
> > template_name = 'tours/tour-detail.html'
> > form_class = forms.ContactForm
> > success_url = 'tours.html'
> >
> > As far as i understand i need to get data from request , but i dont
> > know how to do it. There are a lot of information in function based
> > views, but i didnt get how to do it in class based views.
> >
> > And it would be nice of you to explain where should i put send_mail
> > function. Any help will be appreciated.
> >
>
> --
> 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/235da153-a9d7-2582-ace4-3dbf147d17f8%40fattuba.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/CACaE8x55P%2BBLgpyoSfJtwmB%3DKp9YpQ-ndYyYTMb6BM8BboTv0Q%40mail.gmail.com.


Re: Class based views with forms

2022-04-28 Thread Ryan Nowakowski
You're right, it's not very clear how to have a single class-based view 
handle both displaying details and submitting a form.  This is a 
fantastic site that shows how each class based view is set up 
inheritance-wise: https://ccbv.co.uk/


Take a look the ancestors for DetailView: 
https://ccbv.co.uk/projects/Django/4.0/django.views.generic.detail/DetailView/


... and the ancestors for FormView: 
https://ccbv.co.uk/projects/Django/4.0/django.views.generic.edit/FormView/



Maybe you can just add the FormMixin as an ancestor to your DetailView.


As another option, maybe you can create a separate FormView that you can 
POST to from your DetailView.



- Ryan N

On 4/26/22 5:25 AM, alex smolyakov wrote:

Can anyone explain me how to make send email form on page.

So my forms.py

class ContactForm(forms.Form):
    name = forms.CharField(required=True)
    last_name = forms.CharField()
    adults = forms.IntegerField() children = forms.IntegerField()
    email = forms.EmailField(required=True)
    message = forms.CharField(widget=forms.Textarea)

views.py

class TourDetailView(DetailView):
    model = models.Tour
    template_name = 'tours/tour-detail.html'
    form_class = forms.ContactForm
    success_url = 'tours.html'

As far as i understand i need to get data from request , but i dont 
know how to do it. There are a lot of information in function based 
views, but i didnt get how to do it in class based views.


And it would be nice of you to explain where should i put send_mail 
function. Any help will be appreciated.




--
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/235da153-a9d7-2582-ace4-3dbf147d17f8%40fattuba.com.


Class based views with forms

2022-04-26 Thread alex smolyakov
Can anyone explain me how to make send email form on page.

So my forms.py
class ContactForm(forms.Form): 
name = forms.CharField(required=True)
last_name = forms.CharField()
adults = forms.IntegerField() children = forms.IntegerField() 
email = forms.EmailField(required=True)
message = forms.CharField(widget=forms.Textarea) 

views.py
class TourDetailView(DetailView):
model = models.Tour 
template_name = 'tours/tour-detail.html' 
form_class = forms.ContactForm
success_url = 'tours.html' 

As far as i understand i need to get data from request , but i dont know 
how to do it. There are a lot of information in function based views, but i 
didnt get how to do it in class based views.

And it would be nice of you to explain where should i put send_mail 
function. Any help will be appreciated.

-- 
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/18a42d87-5c8a-46d6-b0ae-01ef8575eb96n%40googlegroups.com.


Re: Update to Tutorial 4 - Generic Views

2022-03-11 Thread Heman Okumbo
on your way towards becoming a great developer.

On Fri, Mar 11, 2022, 18:48 Antonis Christofides <
anto...@antonischristofides.com> wrote:

> Hello,
>
> why do you say that importing of TemplateView is missing? I don't see
> TemplateView being used anywhere in that page.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> +30-6979924665 (mobile)
>
>
> On 11/03/2022 07.42, Dan Cox wrote:
>
> Hi I've been searching on how I might contribute to the tutorials but I
> can't seem to find a way. If you could help me there I could take this
> question to a potentially more useful place.
>
> Anyway; I am pretty new to Django but I've been following the tutorials
> and in the Generic Views section here:
> https://docs.djangoproject.com/en/4.0/intro/tutorial04/
>
> I beleive that there is a missing import statement in the urls.py file:
> from django.views.generic import TemplateView
>
> I was scratching my head trying to work out why I was getting errors and
> upon adding that (which I found in the more general documentation on Views)
> everything worked.
>
> Cheers,
>
> Dan.
> --
> 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/9869e767-7255-40e4-839e-fdcb6d834257n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9869e767-7255-40e4-839e-fdcb6d834257n%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/d6191aab-6f2a-a29f-e5f8-df4852189ad4%40antonischristofides.com
> <https://groups.google.com/d/msgid/django-users/d6191aab-6f2a-a29f-e5f8-df4852189ad4%40antonischristofides.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/CAJt9CbhUG1hdAWBLcOZDgXGVgwcRDWJrRVQYWZ6ErbwP4PFN-g%40mail.gmail.com.


Re: Update to Tutorial 4 - Generic Views

2022-03-11 Thread Antonis Christofides

Hello,

why do you say that importing of TemplateView is missing? I don't see 
TemplateView being used anywhere in that page.


Regards,

Antonis

Antonis Christofides
+30-6979924665 (mobile)


On 11/03/2022 07.42, Dan Cox wrote:
Hi I've been searching on how I might contribute to the tutorials but I can't 
seem to find a way. If you could help me there I could take this question to a 
potentially more useful place.


Anyway; I am pretty new to Django but I've been following the tutorials and in 
the Generic Views section here: 
https://docs.djangoproject.com/en/4.0/intro/tutorial04/


I beleive that there is a missing import statement in the urls.py file:
from django.views.generic import TemplateView

I was scratching my head trying to work out why I was getting errors and upon 
adding that (which I found in the more general documentation on Views) 
everything worked.


Cheers,

Dan.
--
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/9869e767-7255-40e4-839e-fdcb6d834257n%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/9869e767-7255-40e4-839e-fdcb6d834257n%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/d6191aab-6f2a-a29f-e5f8-df4852189ad4%40antonischristofides.com.


Update to Tutorial 4 - Generic Views

2022-03-11 Thread Dan Cox
Hi I've been searching on how I might contribute to the tutorials but I 
can't seem to find a way. If you could help me there I could take this 
question to a potentially more useful place.

Anyway; I am pretty new to Django but I've been following the tutorials and 
in the Generic Views section 
here: https://docs.djangoproject.com/en/4.0/intro/tutorial04/

I beleive that there is a missing import statement in the urls.py file:
from django.views.generic import TemplateView

I was scratching my head trying to work out why I was getting errors and 
upon adding that (which I found in the more general documentation on Views) 
everything worked.

Cheers,

Dan.

-- 
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/9869e767-7255-40e4-839e-fdcb6d834257n%40googlegroups.com.


Re: CELERY CLASS BASED VIEWS

2022-03-08 Thread John Dollosa
I think this might help

https://docs.celeryproject.org/en/stable/userguide/tasks.html#task-custom-classes

Let me know if this works, if not I will try to find a working example.
I have been using Celery but I don't do class based tasks.

On Tuesday, 8 March 2022 at 16:30:01 UTC+8 aadil1...@gmail.com wrote:

> i am using celery version 5.2.3,
>
> How can i register this class based task,  and how can we name add name to 
> this class based task,
>
> I would appreciate your valuable 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/1f325d2e-232f-450f-8556-6038c992c64en%40googlegroups.com.


CELERY CLASS BASED VIEWS

2022-03-08 Thread Aadil Rashid
i am using celery version 5.2.3,

How can i register this class based task,  and how can we name add name to 
this class based task,

I would appreciate your valuable 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/da01b67e-5048-4cc5-a768-61c6a77a7f8dn%40googlegroups.com.


Permission view: Creating different views depending on testmixin results

2022-02-20 Thread Jian Wu
It is the first time that I am setting up a permission view for my Django 
project. From the documentation 
<https://docs.djangoproject.com/en/4.0/topics/auth/default/#django.contrib.auth.mixins.AccessMixin>
 I 
get confused on how to grant view depending on which group the user belongs 
to. Ideally after the user is logged in, I will like to create a dashboard. 
The view of this dashboard depends on the group that the user belongs to. 

My current views.py only checks if a user is logged in. If that is True the 
staffLoginIndex.html will be rendered. My question is, how can I create 
additional tests to determine which group the user belongs to and render 
out different contexts and templates depending on the user's group? 

from django.shortcuts import render
from django.views import View
from django.contrib.auth.mixins import LoginRequiredMixin

# Create your views here.
class StaffLoginIndexView(LoginRequiredMixin, View):
login_url = '/accounts/login/'

def get(self, request, *args, **kwargs):
context = dict()
context['user'] = request.user
return render(request, template_name='staff/staffLoginIndex.html', 
context=context)

-- 
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/6d926374-f241-4f32-9a2d-d4954af55d9an%40googlegroups.com.


How to display class based views

2022-02-18 Thread Wilford Chidawanyika
Good day,

Trust you are all well i have written my models and they are working very 
well.
l am struggling to create a class based view which will diplay on the 
client dashboard side so that he can enter data on a form

please i need help you can app on +27 66 3838 041

With thanks Wilford 

-- 
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/c86eed07-6a8a-483c-8749-b7dff0617e43n%40googlegroups.com.


Maintaining state across multiple views

2021-12-17 Thread Amit Karnam


Hey all,

I am working on a web app using django where in the first view i.e the 
landing page I collect a piece of info around which the web app revolves. I 
need this piece of info to be saved across different views.

GOAL : Instead of the drop down in the diseaseName I want the disease 
entered in the previous view saved and transmitted to the next views.


MODELS : 

```

class Disease\_Profile(models.Model): """ Disease Profile Model with 
One to One mapping with diseaseName , for the Author to fill. 0""" id = 
models.UUIDField(primary\_key=True, default=uuid.uuid4, editable=False) 
Disease\_Name = models.OneToOneField(diseaseName,on\_delete=CASCADE) 
Condition= models.CharField(max\_length=250,) description  = 
models.CharField(max\_length=1000)

```

```

class Physician(models.Model): """Physician Model to capture the best 
physician to be consulted for a particular disease""" 
Disease\_Name=models.ForeignKey(diseaseName,on\_delete=models.CASCADE) 
physician\_category=models.ForeignKey(PhysiciansList,on\_delete=models.CASCADE) 
rating  = models.IntegerField(choices = Rating\_model.points,help\_text='1 
: Beign the Best Choice AND 10 : Being the least favorable choice.') 

```

VIEWS : 

```

def diseaseProfile(request): form = diseaseProfileForm() context = 
{'form':form} if request.POST: form = diseaseProfileForm(request.POST) if 
form.is_valid(): form.save() Disease_Name = 
form.cleaned_data.get('Disease_Name') print(Disease_Name) return 
redirect('/physicianCare/')

```

```

def PhysicianCare(request): form = PhysicianCareForm() context = 
{'form':form,} return render(request,'physicianCare.html',context)  

```


-- 
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/ff3a693a-fa88-4054-b9af-f2eee828df71n%40googlegroups.com.


Re: Handling url in class based views.

2021-11-20 Thread Lalit Suthar
you can get that slug value from kwargs

def get(self, request, *args, **kwargs):
slug = self.kwargs.get("slug")

also if you like to pass it in the context you can override get_context_data

refer: https://ccbv.co.uk/
to know more about class based views you can refer to this playlist from
video number 36
https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW

On Fri, 19 Nov 2021 at 20:41, Perry Bates  wrote:

> You can use the DetailListView from generic views.
> Pass in the template name, form class, and query(which in this case takes
> in the slug to query the db)
>
>
> On Mon, Nov 15, 2021, 21:27 Aadil Rashid  wrote:
>
>> Hello my dear Friends, I have a question regarding Class Based Views.
>>
>> If we have a url e.g,
>> path('item//',  views.funView)
>>
>> We can handle it in  Function Based Views,
>> By simply
>> def funView(request, slug) :
>>#logic
>>return render(request, "tempName")
>>
>>
>> We can even pass this slug as a context in this template,
>>
>>
>> My question is how can we achieve this by using class Based Views.
>>
>>
>> Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%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/CANMtYSTrHPFaGsmPqp8w6PhPUbxTiU_u8qxvqLQj%2BoJ3O_eZdA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANMtYSTrHPFaGsmPqp8w6PhPUbxTiU_u8qxvqLQj%2BoJ3O_eZdA%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/CAGp2JVHoOSiEYnr3-7_rrfdo%3DGymGBRVwuc54fd_a6Y%3DC_C%3DBw%40mail.gmail.com.


Re: Handling url in class based views.

2021-11-19 Thread Perry Bates
You can use the DetailListView from generic views.
Pass in the template name, form class, and query(which in this case takes
in the slug to query the db)


On Mon, Nov 15, 2021, 21:27 Aadil Rashid  wrote:

> Hello my dear Friends, I have a question regarding Class Based Views.
>
> If we have a url e.g,
> path('item//',  views.funView)
>
> We can handle it in  Function Based Views,
> By simply
> def funView(request, slug) :
>#logic
>return render(request, "tempName")
>
>
> We can even pass this slug as a context in this template,
>
>
> My question is how can we achieve this by using class Based Views.
>
>
> Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%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/CANMtYSTrHPFaGsmPqp8w6PhPUbxTiU_u8qxvqLQj%2BoJ3O_eZdA%40mail.gmail.com.


Re: Handling url in class based views.

2021-11-15 Thread Aadil Rashid
Thank you very much Pankaj Palmate, I really appreciate it.
I have tried using def get(self, request, *args, **kwargs) but This method
is not been invoked,
Actually the thing is that,
I am calling this ClassBasedView by an anchor tag, which passes URL to this
link and I need to get the information in which is present in the URL,
I am confused, weather the request initiated by an anchor tag is a get
request or not,
Indeed get method does not worked here,

I once again thank you very much
pankaj palmate

On Tue, Nov 16, 2021 at 9:41 AM pankaj palmate 
wrote:

> Also request in def get itself
>
> On Tue, 16 Nov, 2021, 9:40 am pankaj palmate, <
> pankajpalmate61...@gmail.com> wrote:
>
>> def get(self, pk, *args,**kwargs ) :
>> ...body..
>>
>> On Tue, 16 Nov, 2021, 2:57 am Aadil Rashid, 
>> wrote:
>>
>>> Hello my dear Friends, I have a question regarding Class Based Views.
>>>
>>> If we have a url e.g,
>>> path('item//',  views.funView)
>>>
>>> We can handle it in  Function Based Views,
>>> By simply
>>> def funView(request, slug) :
>>>#logic
>>>return render(request, "tempName")
>>>
>>>
>>> We can even pass this slug as a context in this template,
>>>
>>>
>>> My question is how can we achieve this by using class Based Views.
>>>
>>>
>>> Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%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/CAPyMU1%2BNbEnuO6nDL_hmo6zqVq6cE7SN%3DciA_JgbyZxwcft0Pw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPyMU1%2BNbEnuO6nDL_hmo6zqVq6cE7SN%3DciA_JgbyZxwcft0Pw%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/CAAYXZx9-Jx3Cm7TzU-weg8Q1gMh203L3ssGThSZh4Uy%3DQM5RLg%40mail.gmail.com.


Re: Handling url in class based views.

2021-11-15 Thread pankaj palmate
Also request in def get itself

On Tue, 16 Nov, 2021, 9:40 am pankaj palmate, 
wrote:

> def get(self, pk, *args,**kwargs ) :
> ...body..
>
> On Tue, 16 Nov, 2021, 2:57 am Aadil Rashid, 
> wrote:
>
>> Hello my dear Friends, I have a question regarding Class Based Views.
>>
>> If we have a url e.g,
>> path('item//',  views.funView)
>>
>> We can handle it in  Function Based Views,
>> By simply
>> def funView(request, slug) :
>>#logic
>>return render(request, "tempName")
>>
>>
>> We can even pass this slug as a context in this template,
>>
>>
>> My question is how can we achieve this by using class Based Views.
>>
>>
>> Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%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/CAPyMU1%2BNbEnuO6nDL_hmo6zqVq6cE7SN%3DciA_JgbyZxwcft0Pw%40mail.gmail.com.


Re: Handling url in class based views.

2021-11-15 Thread pankaj palmate
def get(self, pk, *args,**kwargs ) :
...body..

On Tue, 16 Nov, 2021, 2:57 am Aadil Rashid,  wrote:

> Hello my dear Friends, I have a question regarding Class Based Views.
>
> If we have a url e.g,
> path('item//',  views.funView)
>
> We can handle it in  Function Based Views,
> By simply
> def funView(request, slug) :
>#logic
>return render(request, "tempName")
>
>
> We can even pass this slug as a context in this template,
>
>
> My question is how can we achieve this by using class Based Views.
>
>
> Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%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/CAPyMU1%2BV-e%3Dw-ZRN31d%3D_BtgPWujn%3DK7ExwJ6fOug8oLP7vPNQ%40mail.gmail.com.


Handling url in class based views.

2021-11-15 Thread Aadil Rashid
Hello my dear Friends, I have a question regarding Class Based Views.

If we have a url e.g,
path('item//',  views.funView)

We can handle it in  Function Based Views,
By simply
def funView(request, slug) :
   #logic
   return render(request, "tempName")


We can even pass this slug as a context in this template,


My question is how can we achieve this by using class Based Views.


Thanks 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/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com.


Re: How to show views when an endpoint is called

2021-10-05 Thread Adeyemi Deji
Hi, what you are trying to achieve isn't clear to me. Kindly elaborate pls

On Sunday, October 3, 2021 at 4:30:31 AM UTC+2 iroegbu...@gmail.com wrote:

> Hello guys, thanks for helping the last time.
> I am trying to show course views on django admin.  Django is serving as an 
> API to a flutter app
>
> Am i to create another endpoint to count views? 
>

-- 
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/d8a2-ace5-4360-812f-fcb9bd21208fn%40googlegroups.com.


How to show views when an endpoint is called

2021-10-02 Thread Sophia Iroegbu
Hello guys, thanks for helping the last time.
I am trying to show course views on django admin.  Django is serving as an
API to a flutter app

Am i to create another endpoint to count views?

-- 
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/CAEa7H7fyFD-16-4%2BV%3Dt9HiAdvdxezNvi%3D4sdJEKwT0RwwLi7nw%40mail.gmail.com.


Re: Unable to run requests-html functions from Django views

2021-03-24 Thread Prashanjeet Halder
On Thursday, March 25, 2021 at 8:12:46 AM UTC+5:30 Prashanjeet Halder wrote:

> Hello all,
> I'm trying to run a python script that uses requests-HTML library every 
> time a view is triggered but getting 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/0022e3e3-a769-4c06-bb08-3c603aaf81f9n%40googlegroups.com.


Unable to run requests-html functions from Django views

2021-03-24 Thread Prashanjeet Halder
Hello all,
I'm trying to run a python script that uses requests-HTML library every 
time a view is triggered but getting 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/fbf64146-5310-479d-a9fb-8a9b7dcfa2dfn%40googlegroups.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
Won't you end up stopping  multipart  requests in that case?

On Thu, Mar 11, 2021, 02:36 Ryan Nowakowski  wrote:

> On Wed, Mar 10, 2021 at 07:43:55AM -0800, Mostapha Bouderka wrote:
> > I'm working on a project with react and django; and want to use django
> > views to be used as information source only and not show a page on the
> > browser. For example, I have a pilot sign up page that uses a pilot
> create
> > view to provide information to the pilot model. I want the users to be
> able
> > to sign up only by using the sign up page, but if someone accesses the
> > create pilot view, he shouldn't see anything.
> > ( if the url is domain.com/sign-up, he can see the react form )
> > (if the url is domain.com/pilot/create, he shouldn't see anything or
> get an
> > error, this url should only be used by the react form)
>
> You can probably do something like:
>
> if not request.accept('application/json'):
> raise SuspiciousOperation("Sorry we only handle JSON")
>
> --
> 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/20210310210601.GM15054%40fattuba.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/CAOecAny0ZCrqmzfN_e9vrAShJ7RiV69M3N6GUAwUHen382kUaQ%40mail.gmail.com.


Re: How to disable django views in the browser

2021-03-10 Thread Ryan Nowakowski
On Wed, Mar 10, 2021 at 07:43:55AM -0800, Mostapha Bouderka wrote:
> I'm working on a project with react and django; and want to use django 
> views to be used as information source only and not show a page on the 
> browser. For example, I have a pilot sign up page that uses a pilot create 
> view to provide information to the pilot model. I want the users to be able 
> to sign up only by using the sign up page, but if someone accesses the 
> create pilot view, he shouldn't see anything.
> ( if the url is domain.com/sign-up, he can see the react form )
> (if the url is domain.com/pilot/create, he shouldn't see anything or get an 
> error, this url should only be used by the react form) 

You can probably do something like:

if not request.accept('application/json'):
raise SuspiciousOperation("Sorry we only handle JSON")

-- 
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/20210310210601.GM15054%40fattuba.com.


Re: How to disable django views in the browser

2021-03-10 Thread Mostapha Bouderka
Alright i'll check it right now

Many thanks for the assistance.

On Wednesday, March 10, 2021 at 8:15:08 PM UTC kunalsol...@gmail.com wrote:

> Also you will need to add allowed hosts in djnago settung to stop requests 
> from untrusted origins
>
> On Thu, Mar 11, 2021, 01:43 Kunal Solanke  wrote:
>
>> By doing this you won't be able to stop the get requests from browser, 
>> but post requests can be stopped.
>>
>> On Thu, Mar 11, 2021, 01:42 Kunal Solanke  wrote:
>>
>>> Ok in that case, drf by default sets a browsableapi render on all of the 
>>> views and viewsets, either overide that in settings, or use 
>>> renderer_classes=(JSONRendere,) in views in which yiu want to stop it. 
>>>
>>> Search for BrowsableAPIRenderer. 
>>>
>>> Ig you should have mentioned drf sooner. 
>>>
>>>
>>>
>>>
>>> On Thu, Mar 11, 2021, 01:35 Mostapha Bouderka  
>>> wrote:
>>>
>>>> I'am using the django rest framework
>>>>
>>>>
>>>> On Wednesday, March 10, 2021 at 8:01:26 PM UTC kunalsol...@gmail.com 
>>>> wrote:
>>>>
>>>>> Idk the overall use case here ,
>>>>> But if the prject is reasonably bigger and you want to use class based 
>>>>> views, I'd suggest you to use drf. 
>>>>> But you if you don't want to use that,you will have to overide most to 
>>>>> the CBV given by djnango as most of them expect a success url or a 
>>>>> template 
>>>>> that they render. 
>>>>>
>>>>> If you are fine with functional views, do as kasper said,just use post 
>>>>> method. And moreover send JsonResponse .
>>>>>
>>>>> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  
>>>>> wrote:
>>>>>
>>>>>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>>>>>> > I'm working on a project with react and django; and want to use 
>>>>>> django 
>>>>>> > views to be used as information source only and not show a page on 
>>>>>> the 
>>>>>> > browser. For example, I have a pilot sign up page that uses a pilot 
>>>>>> > create view to provide information to the pilot model. I want the 
>>>>>> users 
>>>>>> > to be able to sign up only by using the sign up page, but if 
>>>>>> someone 
>>>>>> > accesses the create pilot view, he shouldn't see anything.
>>>>>> > ( if the url is domain.com/sign-up, he can see the react form )
>>>>>> > (if the url is domain.com/pilot/create, he shouldn't see anything 
>>>>>> or get 
>>>>>> > an error, this url should only be used by the react form)
>>>>>> > 
>>>>>> > I hope the question is clear and thanks in advance.
>>>>>> >
>>>>>>
>>>>>> If I understand correctly, wouldn't it work simply to look at the 
>>>>>> request method for the "domain.com/pilot/create" page and only 
>>>>>> return a 
>>>>>> response in case the method is POST very similar to any other form 
>>>>>> handling like this example:
>>>>>>
>>>>>>
>>>>>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>>>>>
>>>>>> but leaving out the else branch and the default return (which would 
>>>>>> then 
>>>>>> make Django return an HTTP 405 error)?
>>>>>>
>>>>>> I don't know anything about React, but from a quick look at the 
>>>>>> documentation it like it's just normal HTTP forms using POST.
>>>>>>
>>>>>> Kind regards,
>>>>>>
>>>>>> Kasper Laudrup
>>>>>>
>>>>>> -- 
>>>>>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>>>>>> .
>>>>>>
>>>>> -- 
>>>> 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/30357e43-13fd-404a-88a3-90ca135aeff7n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/30357e43-13fd-404a-88a3-90ca135aeff7n%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/f94b895f-e241-4529-80a5-d102212f11b5n%40googlegroups.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
Also you will need to add allowed hosts in djnago settung to stop requests
from untrusted origins

On Thu, Mar 11, 2021, 01:43 Kunal Solanke 
wrote:

> By doing this you won't be able to stop the get requests from browser, but
> post requests can be stopped.
>
> On Thu, Mar 11, 2021, 01:42 Kunal Solanke 
> wrote:
>
>> Ok in that case, drf by default sets a browsableapi render on all of the
>> views and viewsets, either overide that in settings, or use
>> renderer_classes=(JSONRendere,) in views in which yiu want to stop it.
>>
>> Search for BrowsableAPIRenderer.
>>
>> Ig you should have mentioned drf sooner.
>>
>>
>>
>>
>> On Thu, Mar 11, 2021, 01:35 Mostapha Bouderka 
>> wrote:
>>
>>> I'am using the django rest framework
>>>
>>>
>>> On Wednesday, March 10, 2021 at 8:01:26 PM UTC kunalsol...@gmail.com
>>> wrote:
>>>
>>>> Idk the overall use case here ,
>>>> But if the prject is reasonably bigger and you want to use class based
>>>> views, I'd suggest you to use drf.
>>>> But you if you don't want to use that,you will have to overide most to
>>>> the CBV given by djnango as most of them expect a success url or a template
>>>> that they render.
>>>>
>>>> If you are fine with functional views, do as kasper said,just use post
>>>> method. And moreover send JsonResponse .
>>>>
>>>> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup 
>>>> wrote:
>>>>
>>>>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>>>>> > I'm working on a project with react and django; and want to use
>>>>> django
>>>>> > views to be used as information source only and not show a page on
>>>>> the
>>>>> > browser. For example, I have a pilot sign up page that uses a pilot
>>>>> > create view to provide information to the pilot model. I want the
>>>>> users
>>>>> > to be able to sign up only by using the sign up page, but if someone
>>>>> > accesses the create pilot view, he shouldn't see anything.
>>>>> > ( if the url is domain.com/sign-up, he can see the react form )
>>>>> > (if the url is domain.com/pilot/create, he shouldn't see anything
>>>>> or get
>>>>> > an error, this url should only be used by the react form)
>>>>> >
>>>>> > I hope the question is clear and thanks in advance.
>>>>> >
>>>>>
>>>>> If I understand correctly, wouldn't it work simply to look at the
>>>>> request method for the "domain.com/pilot/create" page and only return
>>>>> a
>>>>> response in case the method is POST very similar to any other form
>>>>> handling like this example:
>>>>>
>>>>>
>>>>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>>>>
>>>>> but leaving out the else branch and the default return (which would
>>>>> then
>>>>> make Django return an HTTP 405 error)?
>>>>>
>>>>> I don't know anything about React, but from a quick look at the
>>>>> documentation it like it's just normal HTTP forms using POST.
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Kasper Laudrup
>>>>>
>>>>> --
>>>>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>>>>> .
>>>>>
>>>> --
>>> 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/30357e43-13fd-404a-88a3-90ca135aeff7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/30357e43-13fd-404a-88a3-90ca135aeff7n%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/CAOecAnz4T5tYLBJrnVyJE5WJqPCMVXhEJmigbkJK_K%2BqekvxXg%40mail.gmail.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
By doing this you won't be able to stop the get requests from browser, but
post requests can be stopped.

On Thu, Mar 11, 2021, 01:42 Kunal Solanke 
wrote:

> Ok in that case, drf by default sets a browsableapi render on all of the
> views and viewsets, either overide that in settings, or use
> renderer_classes=(JSONRendere,) in views in which yiu want to stop it.
>
> Search for BrowsableAPIRenderer.
>
> Ig you should have mentioned drf sooner.
>
>
>
>
> On Thu, Mar 11, 2021, 01:35 Mostapha Bouderka 
> wrote:
>
>> I'am using the django rest framework
>>
>>
>> On Wednesday, March 10, 2021 at 8:01:26 PM UTC kunalsol...@gmail.com
>> wrote:
>>
>>> Idk the overall use case here ,
>>> But if the prject is reasonably bigger and you want to use class based
>>> views, I'd suggest you to use drf.
>>> But you if you don't want to use that,you will have to overide most to
>>> the CBV given by djnango as most of them expect a success url or a template
>>> that they render.
>>>
>>> If you are fine with functional views, do as kasper said,just use post
>>> method. And moreover send JsonResponse .
>>>
>>> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  wrote:
>>>
>>>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>>>> > I'm working on a project with react and django; and want to use
>>>> django
>>>> > views to be used as information source only and not show a page on
>>>> the
>>>> > browser. For example, I have a pilot sign up page that uses a pilot
>>>> > create view to provide information to the pilot model. I want the
>>>> users
>>>> > to be able to sign up only by using the sign up page, but if someone
>>>> > accesses the create pilot view, he shouldn't see anything.
>>>> > ( if the url is domain.com/sign-up, he can see the react form )
>>>> > (if the url is domain.com/pilot/create, he shouldn't see anything or
>>>> get
>>>> > an error, this url should only be used by the react form)
>>>> >
>>>> > I hope the question is clear and thanks in advance.
>>>> >
>>>>
>>>> If I understand correctly, wouldn't it work simply to look at the
>>>> request method for the "domain.com/pilot/create" page and only return
>>>> a
>>>> response in case the method is POST very similar to any other form
>>>> handling like this example:
>>>>
>>>>
>>>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>>>
>>>> but leaving out the else branch and the default return (which would
>>>> then
>>>> make Django return an HTTP 405 error)?
>>>>
>>>> I don't know anything about React, but from a quick look at the
>>>> documentation it like it's just normal HTTP forms using POST.
>>>>
>>>> Kind regards,
>>>>
>>>> Kasper Laudrup
>>>>
>>>> --
>>>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>>>> .
>>>>
>>> --
>> 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/30357e43-13fd-404a-88a3-90ca135aeff7n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/30357e43-13fd-404a-88a3-90ca135aeff7n%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/CAOecAnztt-yDHsWHRECBarfmab1rUiQDLfs%3Dxy%2Bo7cW1u%3DXRDQ%40mail.gmail.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
Ok in that case, drf by default sets a browsableapi render on all of the
views and viewsets, either overide that in settings, or use
renderer_classes=(JSONRendere,) in views in which yiu want to stop it.

Search for BrowsableAPIRenderer.

Ig you should have mentioned drf sooner.




On Thu, Mar 11, 2021, 01:35 Mostapha Bouderka 
wrote:

> I'am using the django rest framework
>
>
> On Wednesday, March 10, 2021 at 8:01:26 PM UTC kunalsol...@gmail.com
> wrote:
>
>> Idk the overall use case here ,
>> But if the prject is reasonably bigger and you want to use class based
>> views, I'd suggest you to use drf.
>> But you if you don't want to use that,you will have to overide most to
>> the CBV given by djnango as most of them expect a success url or a template
>> that they render.
>>
>> If you are fine with functional views, do as kasper said,just use post
>> method. And moreover send JsonResponse .
>>
>> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  wrote:
>>
>>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>>> > I'm working on a project with react and django; and want to use django
>>> > views to be used as information source only and not show a page on the
>>> > browser. For example, I have a pilot sign up page that uses a pilot
>>> > create view to provide information to the pilot model. I want the
>>> users
>>> > to be able to sign up only by using the sign up page, but if someone
>>> > accesses the create pilot view, he shouldn't see anything.
>>> > ( if the url is domain.com/sign-up, he can see the react form )
>>> > (if the url is domain.com/pilot/create, he shouldn't see anything or
>>> get
>>> > an error, this url should only be used by the react form)
>>> >
>>> > I hope the question is clear and thanks in advance.
>>> >
>>>
>>> If I understand correctly, wouldn't it work simply to look at the
>>> request method for the "domain.com/pilot/create" page and only return a
>>> response in case the method is POST very similar to any other form
>>> handling like this example:
>>>
>>>
>>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>>
>>> but leaving out the else branch and the default return (which would then
>>> make Django return an HTTP 405 error)?
>>>
>>> I don't know anything about React, but from a quick look at the
>>> documentation it like it's just normal HTTP forms using POST.
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>> --
>>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>>> .
>>>
>> --
> 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/30357e43-13fd-404a-88a3-90ca135aeff7n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/30357e43-13fd-404a-88a3-90ca135aeff7n%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/CAOecAnyY%2BMe%3Dd4EeNGSxN4AQ2vSzNnYZbFzS3ZZiPq7ztquwsg%40mail.gmail.com.


Re: How to disable django views in the browser

2021-03-10 Thread Mostapha Bouderka
I'am using the django rest framework


On Wednesday, March 10, 2021 at 8:01:26 PM UTC kunalsol...@gmail.com wrote:

> Idk the overall use case here ,
> But if the prject is reasonably bigger and you want to use class based 
> views, I'd suggest you to use drf. 
> But you if you don't want to use that,you will have to overide most to the 
> CBV given by djnango as most of them expect a success url or a template 
> that they render. 
>
> If you are fine with functional views, do as kasper said,just use post 
> method. And moreover send JsonResponse .
>
> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  wrote:
>
>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>> > I'm working on a project with react and django; and want to use django 
>> > views to be used as information source only and not show a page on the 
>> > browser. For example, I have a pilot sign up page that uses a pilot 
>> > create view to provide information to the pilot model. I want the users 
>> > to be able to sign up only by using the sign up page, but if someone 
>> > accesses the create pilot view, he shouldn't see anything.
>> > ( if the url is domain.com/sign-up, he can see the react form )
>> > (if the url is domain.com/pilot/create, he shouldn't see anything or 
>> get 
>> > an error, this url should only be used by the react form)
>> > 
>> > I hope the question is clear and thanks in advance.
>> >
>>
>> If I understand correctly, wouldn't it work simply to look at the 
>> request method for the "domain.com/pilot/create" page and only return a 
>> response in case the method is POST very similar to any other form 
>> handling like this example:
>>
>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>
>> but leaving out the else branch and the default return (which would then 
>> make Django return an HTTP 405 error)?
>>
>> I don't know anything about React, but from a quick look at the 
>> documentation it like it's just normal HTTP forms using POST.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> -- 
>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>> .
>>
>

-- 
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/30357e43-13fd-404a-88a3-90ca135aeff7n%40googlegroups.com.


Re: How to disable django views in the browser

2021-03-10 Thread Mostapha Bouderka
Thanks for the reply.

However, your answer didn't really solve my issue.
The form i mentioned is just an example, in fact i have other views,. The 
issue is that i want those views to only handle information and send them 
bach to the front end, but if a user tries to access them through a 
browser, he either gets redirected to another page or gets an error message.

On Wednesday, March 10, 2021 at 7:44:26 PM UTC Kasper Laudrup wrote:

> On 10/03/2021 16.43, Mostapha Bouderka wrote:
> > I'm working on a project with react and django; and want to use django 
> > views to be used as information source only and not show a page on the 
> > browser. For example, I have a pilot sign up page that uses a pilot 
> > create view to provide information to the pilot model. I want the users 
> > to be able to sign up only by using the sign up page, but if someone 
> > accesses the create pilot view, he shouldn't see anything.
> > ( if the url is domain.com/sign-up, he can see the react form )
> > (if the url is domain.com/pilot/create, he shouldn't see anything or 
> get 
> > an error, this url should only be used by the react form)
> > 
> > I hope the question is clear and thanks in advance.
> >
>
> If I understand correctly, wouldn't it work simply to look at the 
> request method for the "domain.com/pilot/create" page and only return a 
> response in case the method is POST very similar to any other form 
> handling like this example:
>
> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>
> but leaving out the else branch and the default return (which would then 
> make Django return an HTTP 405 error)?
>
> I don't know anything about React, but from a quick look at the 
> documentation it like it's just normal HTTP forms using POST.
>
> Kind regards,
>
> Kasper Laudrup
>

-- 
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/dd57c808-7c3e-4dcf-b46f-30a5ab02d8a2n%40googlegroups.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
Please ignore typos.

On Thu, Mar 11, 2021, 01:30 Kunal Solanke 
wrote:

> Idk the overall use case here ,
> But if the prject is reasonably bigger and you want to use class based
> views, I'd suggest you to use drf.
> But you if you don't want to use that,you will have to overide most to the
> CBV given by djnango as most of them expect a success url or a template
> that they render.
>
> If you are fine with functional views, do as kasper said,just use post
> method. And moreover send JsonResponse .
>
> On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  wrote:
>
>> On 10/03/2021 16.43, Mostapha Bouderka wrote:
>> > I'm working on a project with react and django; and want to use django
>> > views to be used as information source only and not show a page on the
>> > browser. For example, I have a pilot sign up page that uses a pilot
>> > create view to provide information to the pilot model. I want the users
>> > to be able to sign up only by using the sign up page, but if someone
>> > accesses the create pilot view, he shouldn't see anything.
>> > ( if the url is domain.com/sign-up, he can see the react form )
>> > (if the url is domain.com/pilot/create, he shouldn't see anything or
>> get
>> > an error, this url should only be used by the react form)
>> >
>> > I hope the question is clear and thanks in advance.
>> >
>>
>> If I understand correctly, wouldn't it work simply to look at the
>> request method for the "domain.com/pilot/create" page and only return a
>> response in case the method is POST very similar to any other form
>> handling like this example:
>>
>> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>>
>> but leaving out the else branch and the default return (which would then
>> make Django return an HTTP 405 error)?
>>
>> I don't know anything about React, but from a quick look at the
>> documentation it like it's just normal HTTP forms using POST.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
>> .
>>
>

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


Re: How to disable django views in the browser

2021-03-10 Thread Kunal Solanke
Idk the overall use case here ,
But if the prject is reasonably bigger and you want to use class based
views, I'd suggest you to use drf.
But you if you don't want to use that,you will have to overide most to the
CBV given by djnango as most of them expect a success url or a template
that they render.

If you are fine with functional views, do as kasper said,just use post
method. And moreover send JsonResponse .

On Thu, Mar 11, 2021, 01:14 Kasper Laudrup  wrote:

> On 10/03/2021 16.43, Mostapha Bouderka wrote:
> > I'm working on a project with react and django; and want to use django
> > views to be used as information source only and not show a page on the
> > browser. For example, I have a pilot sign up page that uses a pilot
> > create view to provide information to the pilot model. I want the users
> > to be able to sign up only by using the sign up page, but if someone
> > accesses the create pilot view, he shouldn't see anything.
> > ( if the url is domain.com/sign-up, he can see the react form )
> > (if the url is domain.com/pilot/create, he shouldn't see anything or
> get
> > an error, this url should only be used by the react form)
> >
> > I hope the question is clear and thanks in advance.
> >
>
> If I understand correctly, wouldn't it work simply to look at the
> request method for the "domain.com/pilot/create" page and only return a
> response in case the method is POST very similar to any other form
> handling like this example:
>
> https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
>
> but leaving out the else branch and the default return (which would then
> make Django return an HTTP 405 error)?
>
> I don't know anything about React, but from a quick look at the
> documentation it like it's just normal HTTP forms using POST.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk
> .
>

-- 
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/CAOecAnwasg%3DXnDYLpQPiXfZ7UEwKzr9townw%3DYixhZ4%3DvJagpQ%40mail.gmail.com.


Re: How to disable django views in the browser

2021-03-10 Thread Kasper Laudrup

On 10/03/2021 16.43, Mostapha Bouderka wrote:
I'm working on a project with react and django; and want to use django 
views to be used as information source only and not show a page on the 
browser. For example, I have a pilot sign up page that uses a pilot 
create view to provide information to the pilot model. I want the users 
to be able to sign up only by using the sign up page, but if someone 
accesses the create pilot view, he shouldn't see anything.

( if the url is domain.com/sign-up, he can see the react form )
(if the url is domain.com/pilot/create, he shouldn't see anything or get 
an error, this url should only be used by the react form)


I hope the question is clear and thanks in advance.



If I understand correctly, wouldn't it work simply to look at the 
request method for the "domain.com/pilot/create" page and only return a 
response in case the method is POST very similar to any other form 
handling like this example:


https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view

but leaving out the else branch and the default return (which would then 
make Django return an HTTP 405 error)?


I don't know anything about React, but from a quick look at the 
documentation it like it's just normal HTTP forms using POST.


Kind regards,

Kasper Laudrup

--
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/219471bc-d101-a13e-388f-25a0836e61ef%40stacktrace.dk.


How to disable django views in the browser

2021-03-10 Thread Mostapha Bouderka
Hi

I'm working on a project with react and django; and want to use django 
views to be used as information source only and not show a page on the 
browser. For example, I have a pilot sign up page that uses a pilot create 
view to provide information to the pilot model. I want the users to be able 
to sign up only by using the sign up page, but if someone accesses the 
create pilot view, he shouldn't see anything.
( if the url is domain.com/sign-up, he can see the react form )
(if the url is domain.com/pilot/create, he shouldn't see anything or get an 
error, this url should only be used by the react form) 

I hope the question is clear and thanks 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/a8be6367-ae4c-45ef-837f-fbdc6695b4d5n%40googlegroups.com.


Re: can we integrate html views that look far better then what is available with django

2021-03-07 Thread Ryan Nowakowski
Hey Sridhar,

Since you mentioned you're a "starter", I'm also going to assume you're
generally new to web programming.  I had similar questions back when I
started.  Django is really good at generating HTML but it's very
un-opinionated about what kind of HTML it generates.  You have total
control over what kind of HTML is generates.  For example:

   * HTML is usually styled using CSS.  You can include any kind of CSS
 you want!
   * HTML can include images using the  tag or background images
 using CSS.  You get to decide how many images you use and how to
 display them.
   * HTML can include links to and snippets of JavaScript that get run
 by the browser.  You decide if you want to include JavaScript and
 what that JavaScript should do.

Whew!  That's a lot of flexibility but also a lot of decisions for you
to make.  Luckily there are some opinionated HTML/CSS frameworks that make
some or all of those decisions for you.  Examples include:

   * https://getbootstrap.com/
   * https://get.foundation/

...or even more opinionated (sometimes these are called "themes"):

   * https://coreui.io (for dashboards)
   * (I did a quick web search for a "stackoverflow Q theme but couldn't find 
one)

You can use any of these as your base template[1] in Django.  Hope this
helps!

- Ryan

[1] 
https://docs.djangoproject.com/en/3.1/ref/templates/language/#template-inheritance


On Sat, Mar 06, 2021 at 12:55:25PM +0530, sridhar vumma wrote:
> Does using bootstrap improve the view of each page,
> Thanks & Regards,
> Sridhar.V
> +91-9591729335
> 
> 
> On Fri, Feb 19, 2021 at 12:21 PM sridhar vumma 
> wrote:
> 
> > The look and feel with typical example flows possible for html were not
> > looking similar to websites like stackoverflow.com so i had a doubt if
> > they all look very image free. I am a starter with Django.
> >
> > Thanks & Regards,
> > Sridhar.V
> > +91-9591729335
> >
> >
> > On Thu, Feb 18, 2021 at 8:07 PM Andréas Kühne 
> > wrote:
> >
> >> Hi,
> >>
> >> This is a very strange question? You can create anything you want with
> >> Django. For example Instagram and Youtube are built with Django. The
> >> framework allows for any design that you really want yourself - you just
> >> need to design the HTML the way you want - I have personally used Django
> >> for many different projects and they all look different. There is no
> >> default layout for Django - so I think I don't really understand your
> >> question :)
> >>
> >> Regards,
> >>
> >> Andréas
> >>
> >>
> >> Den tors 18 feb. 2021 kl 14:43 skrev sridhar vumma  >> >:
> >>
> >>> we see better html views with websites like stackoverflow.com can we
> >>> integrate such high end html websites along with django is that possible
> >>>
> >>> --
> >>> 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/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com
> >>> <https://groups.google.com/d/msgid/django-users/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com?utm_medium=email_source=footer>
> >>> .
> >>>
> >> --
> >> 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/lRQXOzu-qps/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/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%40mail.gmail.com
> >> <https://groups.google.com/d/msgid/django-users/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%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/CANoZYUoZN-Y-xH2_J6NWe3yB2XgOzROhOqYFgNL%2B3G_eZZvkVg%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/20210307195810.GH15054%40fattuba.com.


Re: can we integrate html views that look far better then what is available with django

2021-03-05 Thread sridhar vumma
Does using bootstrap improve the view of each page,
Thanks & Regards,
Sridhar.V
+91-9591729335


On Fri, Feb 19, 2021 at 12:21 PM sridhar vumma 
wrote:

> The look and feel with typical example flows possible for html were not
> looking similar to websites like stackoverflow.com so i had a doubt if
> they all look very image free. I am a starter with Django.
>
> Thanks & Regards,
> Sridhar.V
> +91-9591729335
>
>
> On Thu, Feb 18, 2021 at 8:07 PM Andréas Kühne 
> wrote:
>
>> Hi,
>>
>> This is a very strange question? You can create anything you want with
>> Django. For example Instagram and Youtube are built with Django. The
>> framework allows for any design that you really want yourself - you just
>> need to design the HTML the way you want - I have personally used Django
>> for many different projects and they all look different. There is no
>> default layout for Django - so I think I don't really understand your
>> question :)
>>
>> Regards,
>>
>> Andréas
>>
>>
>> Den tors 18 feb. 2021 kl 14:43 skrev sridhar vumma > >:
>>
>>> we see better html views with websites like stackoverflow.com can we
>>> integrate such high end html websites along with django is that possible
>>>
>>> --
>>> 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/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/lRQXOzu-qps/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/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%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/CANoZYUoZN-Y-xH2_J6NWe3yB2XgOzROhOqYFgNL%2B3G_eZZvkVg%40mail.gmail.com.


Re: can we integrate html views that look far better then what is available with django

2021-02-19 Thread sridhar vumma
The look and feel with typical example flows possible for html were not
looking similar to websites like stackoverflow.com so i had a doubt if they
all look very image free. I am a starter with Django.

Thanks & Regards,
Sridhar.V
+91-9591729335


On Thu, Feb 18, 2021 at 8:07 PM Andréas Kühne 
wrote:

> Hi,
>
> This is a very strange question? You can create anything you want with
> Django. For example Instagram and Youtube are built with Django. The
> framework allows for any design that you really want yourself - you just
> need to design the HTML the way you want - I have personally used Django
> for many different projects and they all look different. There is no
> default layout for Django - so I think I don't really understand your
> question :)
>
> Regards,
>
> Andréas
>
>
> Den tors 18 feb. 2021 kl 14:43 skrev sridhar vumma  >:
>
>> we see better html views with websites like stackoverflow.com can we
>> integrate such high end html websites along with django is that possible
>>
>> --
>> 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/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/lRQXOzu-qps/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/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%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/CANoZYUqRd6hYNR22d5F3MBRXNjNHj0ea7JESvs89VHBX377PpA%40mail.gmail.com.


Re: can we integrate html views that look far better then what is available with django

2021-02-18 Thread Andréas Kühne
Hi,

This is a very strange question? You can create anything you want with
Django. For example Instagram and Youtube are built with Django. The
framework allows for any design that you really want yourself - you just
need to design the HTML the way you want - I have personally used Django
for many different projects and they all look different. There is no
default layout for Django - so I think I don't really understand your
question :)

Regards,

Andréas


Den tors 18 feb. 2021 kl 14:43 skrev sridhar vumma :

> we see better html views with websites like stackoverflow.com can we
> integrate such high end html websites along with django is that possible
>
> --
> 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/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e771045b-907f-479a-80c0-dd5f0079593cn%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/CAK4qSCekgAb3CAW4sKF3r8wcujUOmtA9xtnMSqY%2B%3DLZzT9Gw%3DA%40mail.gmail.com.


can we integrate html views that look far better then what is available with django

2021-02-18 Thread sridhar vumma
we see better html views with websites like stackoverflow.com can we 
integrate such high end html websites along with django is that possible

-- 
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/e771045b-907f-479a-80c0-dd5f0079593cn%40googlegroups.com.


Re: Hi any body help i want code video belonging views,likes and dislikes

2021-02-01 Thread Mahendra
Like youtube videos belonging to views,likes and
Dislikes
Mahendra Yadav

On Mon, 1 Feb 2021, 20:23 Kasper Laudrup,  wrote:

> If you want someone to help you with anything, at least take the minimal
> effort of asking for it in a proper way.
>
> I have no idea which kind of response you expect to get from posting
> something like this.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/687bc306-7490-ee63-76c8-8496632a4f3c%40stacktrace.dk
> .
>

-- 
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/CAN-6G3zzKZNO6EoomcE44f6G_jqFxLwWKV8FTmOO3XvT2CThSA%40mail.gmail.com.


Re: Hi any body help i want code video belonging views,likes and dislikes

2021-02-01 Thread sakshi jain
Hi - Plz help me

On Mon, Feb 1, 2021, 20:23 Kasper Laudrup  wrote:

> If you want someone to help you with anything, at least take the minimal
> effort of asking for it in a proper way.
>
> I have no idea which kind of response you expect to get from posting
> something like this.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/687bc306-7490-ee63-76c8-8496632a4f3c%40stacktrace.dk
> .
>

-- 
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/CAJhs3iNqz5PrrupAPX435-rmdqmVZToZqLbtv%3D1FaR8_H6wTDw%40mail.gmail.com.


Re: Hi any body help i want code video belonging views,likes and dislikes

2021-02-01 Thread Kasper Laudrup
If you want someone to help you with anything, at least take the minimal 
effort of asking for it in a proper way.


I have no idea which kind of response you expect to get from posting 
something like this.


Kind regards,

Kasper Laudrup

--
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/687bc306-7490-ee63-76c8-8496632a4f3c%40stacktrace.dk.


Hi any body help i want code video belonging views,likes and dislikes

2021-02-01 Thread Mahendra
Mahendra Yadav

-- 
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/CAN-6G3x0h_PgxHQsTHXSF15QiLoEFxEdykwNzdGpg%3DKWw4B6sw%40mail.gmail.com.


Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread Robert F.
Thank you to everyone who took time to answer my question!  I will check 
out the resources you mentioned.

On Tuesday, January 12, 2021 at 7:21:33 AM UTC-8 David Nugent wrote:

> Robert,
>
> I think the ultimate resource you can use on this beyond the documentation 
> is the django source code itself.
>
> It may look confusing at first, but if you check out the class hierarchy 
> from the starting points in the docs, how classes are related and mix-ins 
> are used, you gain a lot of insight you don't and can't get from the docs. 
>  With that understanding you are able to author with your own CBVs derived 
> from the bits provided by Django to create a great deal of customisation 
> for you applications where the stock ones may not fit.
>
> There is no better teacher than trying things yourself, working out what 
> went wrong when it does not work.
>
> But I'll provide a nutshell version:
>
> Essentially a CBV is a class that provides functionality around 
> dispatching a web request. At the core is the 
> dispatch() method, which passes the request onto specific method handlers. 
>  Anything else beyond that supports more specific use cases that usually 
> simplifies handling the request - i.e. templates - and each of those 
> provides its own set of patterns.
>
> HTH, 
> /d
>
>
> On 12 January 2021 at 02:15:11, Robert F. (robert@gmail.com) wrote:
>
> Are there any Django libraries that make extensive use of class-based 
> views that I might study if I want to gain an in-depth understanding of how 
> to use them? The Django documentation is OK at explaining what they are and 
> how they work but most of the examples are very trivial in nature. I'd like 
> to become a "power user" and for that I need lots of code to study. I've 
> looked at the Classy Class-Based Views <https://ccbv.co.uk/> examples but 
> they seem too "meta" to me to shed any real light on how to use them in 
> practice. 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...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%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/41a1019d-3da5-40cc-9abe-5b69d77cc542n%40googlegroups.com.


Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread David Nugent
Robert,

I think the ultimate resource you can use on this beyond the documentation is 
the django source code itself.

It may look confusing at first, but if you check out the class hierarchy from 
the starting points in the docs, how classes are related and mix-ins are used, 
you gain a lot of insight you don't and can't get from the docs.  With that 
understanding you are able to author with your own CBVs derived from the bits 
provided by Django to create a great deal of customisation for you applications 
where the stock ones may not fit.

There is no better teacher than trying things yourself, working out what went 
wrong when it does not work.

But I'll provide a nutshell version:

Essentially a CBV is a class that provides functionality around dispatching a 
web request. At the core is the
dispatch() method, which passes the request onto specific method handlers.  
Anything else beyond that supports more specific use cases that usually 
simplifies handling the request - i.e. templates - and each of those provides 
its own set of patterns.

HTH,
/d


On 12 January 2021 at 02:15:11, Robert F. 
(robert.flaug...@gmail.com<mailto:robert.flaug...@gmail.com>) wrote:

Are there any Django libraries that make extensive use of class-based views 
that I might study if I want to gain an in-depth understanding of how to use 
them? The Django documentation is OK at explaining what they are and how they 
work but most of the examples are very trivial in nature. I'd like to become a 
"power user" and for that I need lots of code to study. I've looked at the 
Classy Class-Based Views<https://ccbv.co.uk/> examples but they seem too "meta" 
to me to shed any real light on how to use them in practice. 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<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%40googlegroups.com<https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%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/etPan.5ffdbe50.37df5d44.1d8d%40uniquode.io.


Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread Benjamin Schollnick
> I recommend you consider 
> https://spookylukey.github.io/django-views-the-right-way/

I second this, I’m going through this right now, and it’s very useful 
information regarding Class Based views vs Function Based views…

It’s making me consider rewriting Quickbbs/Gallery again, with a less kludgy 
approach.

- Benjamin



> On Jan 12, 2021, at 3:48 AM, Carsten Fuchs  wrote:
> 
> Dear Robert,
> 
> I recommend you consider 
> https://spookylukey.github.io/django-views-the-right-way/
> 
> Best regards,
> Carsten
> 
> 
> Am 11.01.21 um 16:14 schrieb Robert F.:
>> Are there any Django libraries that make extensive use of class-based views 
>> that I might study if I want to gain an in-depth understanding of how to use 
>> them? The Django documentation is OK at explaining what they are and how 
>> they work but most of the examples are very trivial in nature. I'd like to 
>> become a "power user" and for that I need lots of code to study. I've looked 
>> at the Classy Class-Based Views <https://ccbv.co.uk/> examples but they seem 
>> too "meta" to me to shed any real light on how to use them in practice. 
>> 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/c3105eb8-7adf-8e95-e3d6-8908525eb3cb%40cafu.de.

-- 
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/1FDD7267-EEB3-4780-A06F-22673860709B%40schollnick.net.


Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread Carsten Fuchs
Dear Robert,

I recommend you consider 
https://spookylukey.github.io/django-views-the-right-way/

Best regards,
Carsten


Am 11.01.21 um 16:14 schrieb Robert F.:
> Are there any Django libraries that make extensive use of class-based views 
> that I might study if I want to gain an in-depth understanding of how to use 
> them? The Django documentation is OK at explaining what they are and how they 
> work but most of the examples are very trivial in nature. I'd like to become 
> a "power user" and for that I need lots of code to study. I've looked at the 
> Classy Class-Based Views <https://ccbv.co.uk/> examples but they seem too 
> "meta" to me to shed any real light on how to use them in practice. 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/c3105eb8-7adf-8e95-e3d6-8908525eb3cb%40cafu.de.


Re: Good Django libraries to read to really understand class-based views?

2021-01-11 Thread Arisophy
Hello Robert.

Did you read class based views code?
Original django class-based view code is below.

https://github.com/django/django/tree/master/django/views/generic


I made an extension class for FormView and ListView.

https://github.com/Arisophy/django-searchview

I hope it helps you understand how to extend the call-based view .

best regards.

Arisophy

2021年1月12日(火) 0:15 Robert F. :

> Are there any Django libraries that make extensive use of class-based
> views that I might study if I want to gain an in-depth understanding of how
> to use them? The Django documentation is OK at explaining what they are and
> how they work but most of the examples are very trivial in nature. I'd like
> to become a "power user" and for that I need lots of code to study. I've
> looked at the Classy Class-Based Views <https://ccbv.co.uk/> examples but
> they seem too "meta" to me to shed any real light on how to use them in
> practice. 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/eda0feed-fb61-4882-bbc3-14531b13526fn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/eda0feed-fb61-4882-bbc3-14531b13526fn%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%2B2LtkDUkWaTAX2RXj09AgNxAknW%3Dz%2BG-SYmRj_B2zEGJf%2B4bQ%40mail.gmail.com.


Good Django libraries to read to really understand class-based views?

2021-01-11 Thread Robert F.
Are there any Django libraries that make extensive use of class-based views 
that I might study if I want to gain an in-depth understanding of how to 
use them? The Django documentation is OK at explaining what they are and 
how they work but most of the examples are very trivial in nature. I'd like 
to become a "power user" and for that I need lots of code to study. I've 
looked at the Classy Class-Based Views <https://ccbv.co.uk/> examples but 
they seem too "meta" to me to shed any real light on how to use them in 
practice. 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/eda0feed-fb61-4882-bbc3-14531b13526fn%40googlegroups.com.


Re: How can I multiply 2 or more fields in django views or models

2021-01-04 Thread jose angel encinas ramos
Ok, i understood, can you show me how to multiply 2 fields?
really i can't to do that... i guess i in mental looping

i try to do that in views.py:
data = Articles.objects.all().annotate(result=F('coust_buy') * F('quantity'
)).output_field=FloatField('result')

and the result is this what to you think 

On Mon, Jan 4, 2021 at 2:06 PM Ayser shuhaib 
wrote:

> Nothing wrong with the query, the problem is that you are trying to
> multiply two values of a different type.
> You can fix that by converting the smallInteger value to decimal.
>
> On Mon, 04 Jan 2021 at 23:01, jose angel encinas ramos <
> encinasj.an...@gmail.com> wrote:
>
>> Hi everyone, i'm a new in django and python and i have a problem
>>
>> I had a inventory app and I want to multiply 2 fields, coust_buy and
>> quantity, but when execute this query:
>> views.py
>> data = Articles.objects.all().annotate(result=F('coust_buy') * F(
>> 'quantity'))
>>
>> the results is this (img down)
>>
>>
>>
>> what wrong with my query ? b
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f7e5dcbe-f6dd-47a1-8412-42c14aa70e95n%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/CAE0AZGK%3D8wTcc4kwc8tdYnw59HTRS2ncjLq%2BGNcLLEQwuam0wQ%40mail.gmail.com
> 
> .
>


-- 
José Ángel Encinas
Ing. Tecnologias de la información


Cel:  6622267620  <6622267620>

   *   Never give up...*
   I
  I   [image:
https://us04web.zoom.us/j/4514417813] 

-- 
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/CAF3iVr-hoXCQaC91TP2ARoLNzA4V3qQUOC1%3DMKWC7A-qfu%2BkHQ%40mail.gmail.com.


Re: How can I multiply 2 or more fields in django views or models

2021-01-04 Thread Ayser shuhaib
Nothing wrong with the query, the problem is that you are trying to
multiply two values of a different type.
You can fix that by converting the smallInteger value to decimal.

On Mon, 04 Jan 2021 at 23:01, jose angel encinas ramos <
encinasj.an...@gmail.com> wrote:

> Hi everyone, i'm a new in django and python and i have a problem
>
> I had a inventory app and I want to multiply 2 fields, coust_buy and
> quantity, but when execute this query:
> views.py
> data = Articles.objects.all().annotate(result=F('coust_buy') * F(
> 'quantity'))
>
> the results is this (img down)
>
>
>
> what wrong with my query ? b
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f7e5dcbe-f6dd-47a1-8412-42c14aa70e95n%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/CAE0AZGK%3D8wTcc4kwc8tdYnw59HTRS2ncjLq%2BGNcLLEQwuam0wQ%40mail.gmail.com.


Re: Built in views how to change in django watson package.

2020-12-09 Thread Omkar Parab
I'm not familiar with the Django-Watson package.

Maybe you missed some initial steps.

Go through this medium blog. you will get an idea. 

https://link.medium.com/nFPB7cMM4bb

On Wed, Dec 9, 2020, 5:35 PM Salima Begum 
wrote:

> Hi Omkar parab ,
> I have followed the suggested path but Still it is not giving the search
> results.
>  what I have to write in views.py in home function.
>
> Thanks
> ~salima
>
>
> On Wed, Dec 9, 2020 at 3:11 PM Omkar Parab  wrote:
>
>> Here's the link for template tag 
>>
>> https://github.com/etianen/django-watson/wiki/Template-tags
>>
>> This tag will return the searched list 
>>
>> {% search_results search_entry_list %}
>>
>>
>> Here's the link for the frontend structure 
>>
>>
>> https://github.com/etianen/django-watson/blob/master/watson/templates/watson/search_results.html
>>
>> Front-end code
>> 
>>  Search results {% if query %} for .
>> {{query}}{% endif %}
>>
>>
>> {% if search_results %}
>>
>> {% search_results search_results %}
>>
>> {% else %}
>>
>> {% if query %}
>>
>> There are no results to display.
>>
>> Try entering a less specific search term.
>>
>> {% else %}
>>
>> Please enter a query in the search form.
>> {% endif %}
>>
>> {% endif %}
>>
>> 
>>
>> On Wed, Dec 9, 2020, 2:35 PM Salima Begum 
>> wrote:
>>
>>> Thank you @Omkar Parab, I have tried your suggestion. It is working but
>>> the only thing i want is how to show the result search list in the front
>>> end page in template.
>>>
>>> Please can you help me out in this also.
>>>
>>> Thanks
>>> ~Salima
>>>
>>> On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab 
>>> wrote:
>>>
>>>> Here's the link for the built-in-views,
>>>>
>>>> https://github.com/etianen/django-watson/wiki/Built-in-views
>>>>
>>>> To return search results on the home page, you need to add your,
>>>>
>>>> {℅ Url "your_home_namespace" ℅}
>>>>
>>>> in
>>>>
>>>> 
>>>>
>>>> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I am using the django watson package in my project. How to achieve to
>>>>> change built in views to change default template rendering and to search
>>>>> results in the home page.
>>>>>
>>>>> This is url of django watson
>>>>>
>>>>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>>>>
>>>>> Please Help me out to achieve this, Thank you in advance,
>>>>>
>>>>> Thanks
>>>>> ~Salima
>>>>>
>>>>> --
>>>>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%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/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%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 

Re: Built in views how to change in django watson package.

2020-12-09 Thread Salima Begum
Hi Omkar parab ,
I have followed the suggested path but Still it is not giving the search
results.
 what I have to write in views.py in home function.

Thanks
~salima


On Wed, Dec 9, 2020 at 3:11 PM Omkar Parab  wrote:

> Here's the link for template tag 
>
> https://github.com/etianen/django-watson/wiki/Template-tags
>
> This tag will return the searched list 
>
> {% search_results search_entry_list %}
>
>
> Here's the link for the frontend structure 
>
>
> https://github.com/etianen/django-watson/blob/master/watson/templates/watson/search_results.html
>
> Front-end code
> 
>  Search results {% if query %} for . {{query}}{%
> endif %}
>
>
> {% if search_results %}
>
> {% search_results search_results %}
>
> {% else %}
>
> {% if query %}
>
> There are no results to display.
>
> Try entering a less specific search term.
>
> {% else %}
>
> Please enter a query in the search form.
> {% endif %}
>
> {% endif %}
>
> 
>
> On Wed, Dec 9, 2020, 2:35 PM Salima Begum 
> wrote:
>
>> Thank you @Omkar Parab, I have tried your suggestion. It is working but
>> the only thing i want is how to show the result search list in the front
>> end page in template.
>>
>> Please can you help me out in this also.
>>
>> Thanks
>> ~Salima
>>
>> On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab 
>> wrote:
>>
>>> Here's the link for the built-in-views,
>>>
>>> https://github.com/etianen/django-watson/wiki/Built-in-views
>>>
>>> To return search results on the home page, you need to add your,
>>>
>>> {℅ Url "your_home_namespace" ℅}
>>>
>>> in
>>>
>>> 
>>>
>>> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I am using the django watson package in my project. How to achieve to
>>>> change built in views to change default template rendering and to search
>>>> results in the home page.
>>>>
>>>> This is url of django watson
>>>>
>>>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>>>
>>>> Please Help me out to achieve this, Thank you in advance,
>>>>
>>>> Thanks
>>>> ~Salima
>>>>
>>>> --
>>>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%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/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%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/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%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/CAJY8mfx5h4W62qwbv7C5G0F%2BH__XMtSm%3DnGgnmjOqe_wH1RgaA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJY8mfx5h4W62qwbv7C5G0F%2BH__XMtSm%3DnGgnmjOqe_wH1RgaA%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/CAMSz6bkfyfABtF0J8hfC8_YEA2qGH1qrDgOVdjg4gc%2BNEspLKQ%40mail.gmail.com.


Re: Built in views how to change in django watson package.

2020-12-09 Thread Omkar Parab
Here's the link for template tag 

https://github.com/etianen/django-watson/wiki/Template-tags

This tag will return the searched list 

{% search_results search_entry_list %}


Here's the link for the frontend structure 

https://github.com/etianen/django-watson/blob/master/watson/templates/watson/search_results.html

Front-end code

 Search results {% if query %} for . {{query}}{%
endif %}
   

{% if search_results %}

{% search_results search_results %}

{% else %}

{% if query %}

There are no results to display.

Try entering a less specific search term.

{% else %}

Please enter a query in the search form.
{% endif %}

{% endif %}



On Wed, Dec 9, 2020, 2:35 PM Salima Begum 
wrote:

> Thank you @Omkar Parab, I have tried your suggestion. It is working but
> the only thing i want is how to show the result search list in the front
> end page in template.
>
> Please can you help me out in this also.
>
> Thanks
> ~Salima
>
> On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab  wrote:
>
>> Here's the link for the built-in-views,
>>
>> https://github.com/etianen/django-watson/wiki/Built-in-views
>>
>> To return search results on the home page, you need to add your,
>>
>> {℅ Url "your_home_namespace" ℅}
>>
>> in
>>
>> 
>>
>> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
>> wrote:
>>
>>> Hi all,
>>>
>>> I am using the django watson package in my project. How to achieve to
>>> change built in views to change default template rendering and to search
>>> results in the home page.
>>>
>>> This is url of django watson
>>>
>>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>>
>>> Please Help me out to achieve this, Thank you in advance,
>>>
>>> Thanks
>>> ~Salima
>>>
>>> --
>>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%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/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%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/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%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/CAJY8mfx5h4W62qwbv7C5G0F%2BH__XMtSm%3DnGgnmjOqe_wH1RgaA%40mail.gmail.com.


Re: Built in views how to change in django watson package.

2020-12-09 Thread Salima Begum
Thank you @Omkar Parab, I have tried your suggestion. It is working but the
only thing i want is how to show the result search list in the front end
page in template.

Please can you help me out in this also.

Thanks
~Salima

On Wed, Dec 9, 2020 at 11:16 AM Omkar Parab  wrote:

> Here's the link for the built-in-views,
>
> https://github.com/etianen/django-watson/wiki/Built-in-views
>
> To return search results on the home page, you need to add your,
>
> {℅ Url "your_home_namespace" ℅}
>
> in
>
> 
>
> On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
> wrote:
>
>> Hi all,
>>
>> I am using the django watson package in my project. How to achieve to
>> change built in views to change default template rendering and to search
>> results in the home page.
>>
>> This is url of django watson
>>
>> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>>
>> Please Help me out to achieve this, Thank you in advance,
>>
>> Thanks
>> ~Salima
>>
>> --
>> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%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/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%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/CAMSz6bky_0Lk78ose2Fu7nCfHrz0VHH_-wiyK2K%3DP%2BO45JACYA%40mail.gmail.com.


Re: Built in views how to change in django watson package.

2020-12-08 Thread Omkar Parab
Here's the link for the built-in-views,

https://github.com/etianen/django-watson/wiki/Built-in-views

To return search results on the home page, you need to add your,

{℅ Url "your_home_namespace" ℅}

in



On Wed, Dec 9, 2020, 9:35 AM Salima Begum 
wrote:

> Hi all,
>
> I am using the django watson package in my project. How to achieve to
> change built in views to change default template rendering and to search
> results in the home page.
>
> This is url of django watson
>
> '''https://github.com/etianen/django-watson/wiki/Built-in-views'''
>
> Please Help me out to achieve this, Thank you in advance,
>
> Thanks
> ~Salima
>
> --
> 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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%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/CAJY8mfwf_gcAM2ZnkUNbhh4VRFua-SYqo8nPMtaoPzawVk%3DGTw%40mail.gmail.com.


Built in views how to change in django watson package.

2020-12-08 Thread Salima Begum
Hi all,

I am using the django watson package in my project. How to achieve to
change built in views to change default template rendering and to search
results in the home page.

This is url of django watson

'''https://github.com/etianen/django-watson/wiki/Built-in-views'''

Please Help me out to achieve this, Thank you in advance,

Thanks
~Salima

-- 
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/CAMSz6bk2iK6X7sL25%3DDefbMxgcfzzokpW-T3yNoJgZp%3D8LN4jA%40mail.gmail.com.


RES: testing class based generic views

2020-10-26 Thread Samuel Nogueira
I don’t know a test tutorial, but I think you can get some help in the Django docs. https://docs.djangoproject.com/en/3.1/topics/testing/tools/  -Samuel Nogueira Bacelar GitHub: https://github.com/SamuelNoB Linkedin: https://www.linkedin.com/in/samuel-nogueira-87800b1aa/ - De: Patrick CarraEnviado:sábado, 24 de outubro de 2020 16:53Para: Django usersAssunto: testing class based generic views Can anyone point me towards a tutorial for how to test a CreateView function?  -- 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/76d377cf-a6e2-46ec-b4ee-5d1279988b32n%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/0D30453B-EAF5-4EDB-AC48-3C451052E055%40hxcore.ol.


testing class based generic views

2020-10-24 Thread Patrick Carra
Can anyone point me towards a tutorial for how to test a CreateView 
function? 

-- 
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/76d377cf-a6e2-46ec-b4ee-5d1279988b32n%40googlegroups.com.


Re: Changing ordering of model in the admin views

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices. Reply or send
email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Sat, 10 Oct 2020, 2:03 pm אורי,  wrote:

> Django users,
>
> I have a User model, in which I defined class Meta with ordering. It's
> defined like this:
>
> class Meta:
> verbose_name = _('user')
> verbose_name_plural = _('users')
> ordering = ('-speedy_net_site_profile__last_visit',)
> swappable = 'AUTH_USER_MODEL'
>
>
> But, I have two apps - Speedy Net and Speedy Match, and in Speedy Match I
> want a different order (
>   ordering = ('-speedy_match_site_profile__last_visit',)
> ). How can I do this?
>
> Thanks,
> אורי
> 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/CABD5YeEgKXis7GiwL%2BHtmAt8gSwwqaDOVpzOS-M8-NiL%3D5cPWg%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/CAH9mneVB555XkPtoiqzPkmh5ymip5vbTBMtOz-eeCXqjNVnFGw%40mail.gmail.com.


Changing ordering of model in the admin views

2020-10-10 Thread אורי
Django users,

I have a User model, in which I defined class Meta with ordering. It's
defined like this:

class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
ordering = ('-speedy_net_site_profile__last_visit',)
swappable = 'AUTH_USER_MODEL'


But, I have two apps - Speedy Net and Speedy Match, and in Speedy Match I
want a different order (
  ordering = ('-speedy_match_site_profile__last_visit',)
). How can I do this?

Thanks,
אורי
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/CABD5YeEgKXis7GiwL%2BHtmAt8gSwwqaDOVpzOS-M8-NiL%3D5cPWg%40mail.gmail.com.


Re: How to pass a set of objects in between two views?

2020-08-24 Thread Kunal Solanke
Two things come to my mind
1.Either create a questionlist model with for each user.
2.Bind questionlist to session.

On Mon, Aug 24, 2020, 20:01 vipul shinde  wrote:

> from django.shortcuts import render, redirect
> from .models import *
> from .forms import UserForm
> from django.contrib.auth.forms import AuthenticationForm
> import random
> from django.contrib.auth import login, logout, authenticate
>
> # Create your views here.
> def home(request):
> return render(request, 'testapp/home.html')
>
> def loginuser(request):
> #form = UserForm()
> if request.method == 'GET':
> form = AuthenticationForm()
> return render(request, 'testapp/login.html', {'form':form})
> else:
> user = authenticate(request, username=request.POST['username'],
> password=request.POST['password'])
> if user is None:
> return render(request, 'testapp/login.html',
> {'form':AuthenticationForm(), 'error':'Username or password incorrect'})
> else:
> login(request, user)
> return redirect('paper')
>
> def paper(request):
> #objects = Questions.objects.all()
> """count = Questions.objects.all().count()
> slice = random.random() * (count-5)
> objects = Questions.objects.all()[slice:slice+5]"""
> #objects = {{ objects }}
> objects = Questions.objects.all().order_by('?')[:5]
> return render(request, 'testapp/paper.html', {'objects':objects})
>
> On Mon, Aug 24, 2020 at 7:57 PM hans alexander  wrote:
>
>> Can you share the views.py that you wrote?
>> Actually If the page for random set of questions is same for User NOT
>> Logged In and User Logged In, the data you called from database will still
>> showing up.
>>
>> On Mon, Aug 24, 2020 at 9:19 PM vipul shinde 
>> wrote:
>>
>>>
>>> I'm building a quiz app in which I'm storing questions in the database
>>> by creating a model class. I am retrieving a random question set for each
>>> user from the database and then rendering them on an HTML page. The problem
>>> is after logging a user in, a random set of questions appears but that
>>> random set is lost after refreshing the page.
>>> How do I solve this
>>> One thing that I thought was retrieving the object set in another
>>> viewsay after logging a user in and passing it as a dictionary to
>>> another view.
>>> But I can't find the syntax or any function (if it exists). Please help.
>>> I'm using django 3.1 and MySQL as my database
>>>
>>> --
>>> 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/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%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/CANV3w%3DYE%3DP6OW4cow0q%3D8uocbUSKoi259CJbRWrJYPo7A51oEw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANV3w%3DYE%3DP6OW4cow0q%3D8uocbUSKoi259CJbRWrJYPo7A51oEw%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/CANE4xcv3hx8pkaOh0E5xJg4_mOQjdnkGHt_4%3Dq61yZfMVodFyg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANE4xcv3hx8pkaOh0E5xJg4_mOQjdnkGHt_4%3Dq61yZfMVodFyg%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/CAOecAnyPvTd-m5C1CMky8fjLPtcMMuNDTJZ1y0qgXA0%3DYKxwXg%40mail.gmail.com.


Re: How to pass a set of objects in between two views?

2020-08-24 Thread vipul shinde
from django.shortcuts import render, redirect
from .models import *
from .forms import UserForm
from django.contrib.auth.forms import AuthenticationForm
import random
from django.contrib.auth import login, logout, authenticate

# Create your views here.
def home(request):
return render(request, 'testapp/home.html')

def loginuser(request):
#form = UserForm()
if request.method == 'GET':
form = AuthenticationForm()
return render(request, 'testapp/login.html', {'form':form})
else:
user = authenticate(request, username=request.POST['username'],
password=request.POST['password'])
if user is None:
return render(request, 'testapp/login.html',
{'form':AuthenticationForm(), 'error':'Username or password incorrect'})
else:
login(request, user)
return redirect('paper')

def paper(request):
#objects = Questions.objects.all()
"""count = Questions.objects.all().count()
slice = random.random() * (count-5)
objects = Questions.objects.all()[slice:slice+5]"""
#objects = {{ objects }}
objects = Questions.objects.all().order_by('?')[:5]
return render(request, 'testapp/paper.html', {'objects':objects})

On Mon, Aug 24, 2020 at 7:57 PM hans alexander  wrote:

> Can you share the views.py that you wrote?
> Actually If the page for random set of questions is same for User NOT
> Logged In and User Logged In, the data you called from database will still
> showing up.
>
> On Mon, Aug 24, 2020 at 9:19 PM vipul shinde 
> wrote:
>
>>
>> I'm building a quiz app in which I'm storing questions in the database by
>> creating a model class. I am retrieving a random question set for each user
>> from the database and then rendering them on an HTML page. The problem is
>> after logging a user in, a random set of questions appears but that random
>> set is lost after refreshing the page.
>> How do I solve this
>> One thing that I thought was retrieving the object set in another
>> viewsay after logging a user in and passing it as a dictionary to
>> another view.
>> But I can't find the syntax or any function (if it exists). Please help.
>> I'm using django 3.1 and MySQL as my database
>>
>> --
>> 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/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%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/CANV3w%3DYE%3DP6OW4cow0q%3D8uocbUSKoi259CJbRWrJYPo7A51oEw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANV3w%3DYE%3DP6OW4cow0q%3D8uocbUSKoi259CJbRWrJYPo7A51oEw%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/CANE4xcv3hx8pkaOh0E5xJg4_mOQjdnkGHt_4%3Dq61yZfMVodFyg%40mail.gmail.com.


Re: How to pass a set of objects in between two views?

2020-08-24 Thread hans alexander
Can you share the views.py that you wrote?
Actually If the page for random set of questions is same for User NOT
Logged In and User Logged In, the data you called from database will still
showing up.

On Mon, Aug 24, 2020 at 9:19 PM vipul shinde 
wrote:

>
> I'm building a quiz app in which I'm storing questions in the database by
> creating a model class. I am retrieving a random question set for each user
> from the database and then rendering them on an HTML page. The problem is
> after logging a user in, a random set of questions appears but that random
> set is lost after refreshing the page.
> How do I solve this
> One thing that I thought was retrieving the object set in another
> viewsay after logging a user in and passing it as a dictionary to
> another view.
> But I can't find the syntax or any function (if it exists). Please help.
> I'm using django 3.1 and MySQL as my database
>
> --
> 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/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%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/CANV3w%3DYE%3DP6OW4cow0q%3D8uocbUSKoi259CJbRWrJYPo7A51oEw%40mail.gmail.com.


How to pass a set of objects in between two views?

2020-08-24 Thread vipul shinde
I'm building a quiz app in which I'm storing questions in the database by
creating a model class. I am retrieving a random question set for each user
from the database and then rendering them on an HTML page. The problem is
after logging a user in, a random set of questions appears but that random
set is lost after refreshing the page.
How do I solve this
One thing that I thought was retrieving the object set in another
viewsay after logging a user in and passing it as a dictionary to
another view.
But I can't find the syntax or any function (if it exists). Please help.
I'm using django 3.1 and MySQL as my database

-- 
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/CANE4xcuDmZCAaB4pzTqvH1d2eGf2b12%2BBPwN90e5_hmK%3DUBeQw%40mail.gmail.com.


Leverage Django 3.1+ async views to implement SSE

2020-08-22 Thread Benoit Blanchon
Hi,

Documentation for Django 3.1 
<https://docs.djangoproject.com/en/3.1/topics/async/#async-views:%7E:text=The%20main%20benefits%20are%20the%20ability,long%2Dpolling%2C%20and%20other%20exciting%20response%20types.>
 says 
this about async views:

*The main benefits are the ability to service hundreds of connections 
without using Python threads. This allows you to use slow streaming, 
long-polling, and other exciting response types.*

I believe this means we could implement an SSE (Server-Sent Events 
<https://en.wikipedia.org/wiki/Server-sent_events>) view without 
monopolizing a thread per client, but I didn't figure out exactly how.

I know about Django Channels, but I'm curious to see if we can avoid it. 

I initially thought StreamingHttpResponse was the way to go since it has 
been used successfully to implement SSE with synchronous views 
<https://stackoverflow.com/a/55522953/1164966>. Still, I would accept any 
solution based on asynchronous views.

I opened a bounty on stack-overflow 
<https://stackoverflow.com/q/63316840/1164966>, but so far, no viable 
solution was proposed.  

Does anyone know how we could leverage async views to implement SSE?

Best regards,
Benoit Blanchon





-- 
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/18e1e20f-c3a0-4a21-845e-bf6f30c452f8n%40googlegroups.com.


How to pass values of drop down from html template to views in Django?

2020-06-26 Thread ratnadeep ray


I need to send the value of the selected option in a drop down to the views.

My html code is as follows:

> 
> Select version to compare with
> {%for ver in version_list%}
> **{{ver}} option>**
> {% endfor %}
> 


The above is giving me the following error:

> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/index/11.5.1.18900-96
> http://127.0.0.1:8000/index/11.5.1.18900-97
> Using the URLconf defined in Piechart_Excel.urls, Django tried these URL 
> patterns, in this order:
> admin/
> index/
> process_data/ [name='process_data']
> The current path, index/11.5.1.18900-96, didn't match any of these.


However if I am sending the value as follows i.e. without any drop down:

> {{ver}}


everything is working as expected.


My urls.py file content is as follows:


from django.urls import path
> from fusioncharts import views urlpatterns
> urlpatterns = [
> path('index/', views.index, name='index'),
> path('process_data/', views.process_data, name='process_data'),
> ] 

Can anyone say why is it not working in the case of drop down but working 
otherwise? If we have to send any value from the html template using drop 
down, then how to do so?

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/da72e367-bc90-46cd-8b54-3502d1a126b9o%40googlegroups.com.


Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Dennis Triplett
 Thank you Cbh Bnh...  I need to know what commands are available in Django 
and this is exactly what I was looking for.  Thanks again.

On Tuesday, June 23, 2020 at 5:44:46 PM UTC-7, Dennis Triplett wrote:
>
> I have been looking for a Django Reference Manual to let me know what 
> classes, or Djanago tools
>
> are allowed in its calling syntax...  Example
>
>
> from django.urls import path
> from MyApplication import views
>
>
> What I am looking for is an explanation of what things can be imported with 
> URLS, VIEWS, HTTP 
>
> There are other classes each can use, but I have not been able to find any 
> source or book 
>
> that outlines all the classes or commands that can be used in Django 
> statements using...
>
>  From django.xxx import.yyy.
>
>
> I hope I am making myself understood.
>
>
> Does anyone have suggestions on sites, documents, or books that I can use as 
> a reference source?
>
>
> Thanks in advance for fielding my newbie question.
>
>
>

-- 
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/c68ae913-daf4-4dd9-a2f1-8c7465dd422do%40googlegroups.com.


Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Cbh Bnh
hi,
Have a look to this site https://devdocs.io/django~2.2/
They have the same content then the official django doc but add a usefull 
search engine, links between sections and organise their content regarding 
the code structure and modules
Cheers
Le mercredi 24 juin 2020 à 02:44:46 UTC+2, dlt1...@gmail.com a écrit :

> I have been looking for a Django Reference Manual to let me know what 
> classes, or Djanago tools
>
> are allowed in its calling syntax...  Example
>
>
> from django.urls import path
> from MyApplication import views
>
>
> What I am looking for is an explanation of what things can be imported with 
> URLS, VIEWS, HTTP 
>
> There are other classes each can use, but I have not been able to find any 
> source or book 
>
> that outlines all the classes or commands that can be used in Django 
> statements using...
>
>  From django.xxx import.yyy.
>
>
> I hope I am making myself understood.
>
>
> Does anyone have suggestions on sites, documents, or books that I can use as 
> a reference source?
>
>
> Thanks in advance for fielding my newbie question.
>
>
>

-- 
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/092bc768-afb0-4c3e-b04f-70bc8fe67678n%40googlegroups.com.


Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Cbh Bnh
Hi,
I don't know if this will help but from time to time I use this site to 
browse into django doc: https://devdocs.io/django~2.2/
I think they use the same content as the offcial documentation but with  
better links and quit good search tool

Cheers

Le mercredi 24 juin 2020 à 02:44:46 UTC+2, dlt1...@gmail.com a écrit :

> I have been looking for a Django Reference Manual to let me know what 
> classes, or Djanago tools
>
> are allowed in its calling syntax...  Example
>
>
> from django.urls import path
> from MyApplication import views
>
>
> What I am looking for is an explanation of what things can be imported with 
> URLS, VIEWS, HTTP 
>
> There are other classes each can use, but I have not been able to find any 
> source or book 
>
> that outlines all the classes or commands that can be used in Django 
> statements using...
>
>  From django.xxx import.yyy.
>
>
> I hope I am making myself understood.
>
>
> Does anyone have suggestions on sites, documents, or books that I can use as 
> a reference source?
>
>
> Thanks in advance for fielding my newbie question.
>
>
>

-- 
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/47a92d21-9f00-47bc-9219-320a3419a7bbn%40googlegroups.com.


Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-23 Thread Dennis Triplett


I have been looking for a Django Reference Manual to let me know what classes, 
or Djanago tools

are allowed in its calling syntax...  Example


from django.urls import path
from MyApplication import views


What I am looking for is an explanation of what things can be imported with 
URLS, VIEWS, HTTP 

There are other classes each can use, but I have not been able to find any 
source or book 

that outlines all the classes or commands that can be used in Django statements 
using...

 From django.xxx import.yyy.


I hope I am making myself understood.


Does anyone have suggestions on sites, documents, or books that I can use as a 
reference source?


Thanks in advance for fielding my newbie question.


-- 
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/4b0e3b5e-3846-49eb-b626-d077ec00776ao%40googlegroups.com.


RE: why in views we use def(functions) and model we use class, why not we use def(fuction) in models and class in views

2020-06-18 Thread Vishesh Mangla
If your wish whatever you want to use, all you have to use is the “request” variable that Django gives you. Btw see “generic views”.  Sent from Mail for Windows 10 From: yashwanth balanaguSent: 18 June 2020 12:23To: Django usersSubject: why in views we use def(functions) and model we use class, why not we use def(fuction) in models and class in views why in views we use def(functions) and model we use class, why not we use def(fuction) in models and class in views-- 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/4e4b1e4b-1a59-43d9-8835-4992e986f943o%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/42275F4A-510E-4C3B-B5CA-14C4D4156228%40hxcore.ol.


why in views we use def(functions) and model we use class, why not we use def(fuction) in models and class in views

2020-06-18 Thread yashwanth balanagu
why in views we use def(functions) and model we use class, why not we use 
def(fuction) in models and class in views

-- 
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/4e4b1e4b-1a59-43d9-8835-4992e986f943o%40googlegroups.com.


Re: Customizing Django built-in views such as LoginView

2020-05-30 Thread 'László Hegedűs' via Django users
I was a Django fan since I am freelancer, and introduced to Flask.
The best is in Django is 2 thing:
First, easy to use.
Second: consitent. So I think each of the solution is good if not have side 
effect to the other.

On Friday, May 29, 2020 at 2:31:17 PM UTC+2, Uri wrote:
>
> Django users,
>
> Which way is preferred to customize Django built-in views such as 
> LoginView:
>
> - Define a line in urls.py:
>
> path(route='login/', view=views.django_auth_views.LoginView.as_view(
> template_name='accounts/login.html', authentication_form=forms.LoginForm, 
> extra_context=None, redirect_authenticated_user=True), name='login'),
>
> Where, views.py contains:
>
> from django.contrib.auth import views as django_auth_views
>
>
> *Or:*
>
> In views.py, define a new class:
>
> class LoginView(django_auth_views.LoginView):
> template_name = 'accounts/login.html'
> authentication_form = LoginForm
> extra_context = None
> redirect_authenticated_user = True
>
> And then, define in urls.py:
>
> path(route='login/', view=views.LoginView.as_view(), name='login'),
>
>
> Will both ways work the same, and is one of them preferred from a software 
> engineering / programming perspective?
>
> 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/d0d6f677-4317-462e-bd6a-e48a06757077%40googlegroups.com.


Re: Customizing Django built-in views such as LoginView

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


On Fri, May 29, 2020 at 3:57 PM Augusto Destrero 
wrote:

> I would choose the second option and define a LoginView subclass in the
> views.py module.
> The outcome is exactly the same, but I'd prefer to have my views all
> defined in views.py file.
> Adding too much logic in the urls.py module IMHO is not a good idea and it
> makes the view less extendable in the future.
>
> Augusto
> www.guguweb.com
>
> On Friday, May 29, 2020 at 2:31:17 PM UTC+2, Uri wrote:
>>
>> Django users,
>>
>> Which way is preferred to customize Django built-in views such as
>> LoginView:
>>
>> - Define a line in urls.py:
>>
>> path(route='login/', view=views.django_auth_views.LoginView.as_view(
>> template_name='accounts/login.html', authentication_form=forms.LoginForm,
>> extra_context=None, redirect_authenticated_user=True), name='login'),
>>
>> Where, views.py contains:
>>
>> from django.contrib.auth import views as django_auth_views
>>
>>
>> *Or:*
>>
>> In views.py, define a new class:
>>
>> class LoginView(django_auth_views.LoginView):
>> template_name = 'accounts/login.html'
>> authentication_form = LoginForm
>> extra_context = None
>> redirect_authenticated_user = True
>>
>> And then, define in urls.py:
>>
>> path(route='login/', view=views.LoginView.as_view(), name='login'),
>>
>>
>> Will both ways work the same, and is one of them preferred from a
>> software engineering / programming perspective?
>>
>> 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/8b10a5cf-5f33-4035-98b2-54ac0b84f25e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8b10a5cf-5f33-4035-98b2-54ac0b84f25e%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/CABD5YeHUGHNrm2jEEKqrj%2BBo2ygd_jr%3DZqqoPy02ZFE3AU0qvA%40mail.gmail.com.


Re: Customizing Django built-in views such as LoginView

2020-05-29 Thread Augusto Destrero
I would choose the second option and define a LoginView subclass in the 
views.py module.
The outcome is exactly the same, but I'd prefer to have my views all 
defined in views.py file.
Adding too much logic in the urls.py module IMHO is not a good idea and it 
makes the view less extendable in the future.

Augusto
www.guguweb.com

On Friday, May 29, 2020 at 2:31:17 PM UTC+2, Uri wrote:
>
> Django users,
>
> Which way is preferred to customize Django built-in views such as 
> LoginView:
>
> - Define a line in urls.py:
>
> path(route='login/', view=views.django_auth_views.LoginView.as_view(
> template_name='accounts/login.html', authentication_form=forms.LoginForm, 
> extra_context=None, redirect_authenticated_user=True), name='login'),
>
> Where, views.py contains:
>
> from django.contrib.auth import views as django_auth_views
>
>
> *Or:*
>
> In views.py, define a new class:
>
> class LoginView(django_auth_views.LoginView):
> template_name = 'accounts/login.html'
> authentication_form = LoginForm
> extra_context = None
> redirect_authenticated_user = True
>
> And then, define in urls.py:
>
> path(route='login/', view=views.LoginView.as_view(), name='login'),
>
>
> Will both ways work the same, and is one of them preferred from a software 
> engineering / programming perspective?
>
> 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/8b10a5cf-5f33-4035-98b2-54ac0b84f25e%40googlegroups.com.


Customizing Django built-in views such as LoginView

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

Which way is preferred to customize Django built-in views such as LoginView:

- Define a line in urls.py:

path(route='login/', view=views.django_auth_views.LoginView.as_view(
template_name='accounts/login.html', authentication_form=forms.LoginForm,
extra_context=None, redirect_authenticated_user=True), name='login'),

Where, views.py contains:

from django.contrib.auth import views as django_auth_views


*Or:*

In views.py, define a new class:

class LoginView(django_auth_views.LoginView):
template_name = 'accounts/login.html'
authentication_form = LoginForm
extra_context = None
redirect_authenticated_user = True

And then, define in urls.py:

path(route='login/', view=views.LoginView.as_view(), name='login'),


Will both ways work the same, and is one of them preferred from a software
engineering / programming perspective?

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/CABD5YeGvexcpJTgnHtAJcmX7LL0z_xi1siU7qi-6hBwiNRrOEA%40mail.gmail.com.


Re: How to pass a variable to views from a template using href ?

2020-05-19 Thread Ignat Petrov
You should be able to do that by using a relative path instead of the 
absolute "/execute". Just use something like href="{% url 'execute' 'SQL' 
%}. For this to work you need to name the url path as 'execute'. That way 
you'll pass the 'SQL' value to the endpoint.
Here is example from the polls tutorial: 
https://docs.djangoproject.com/en/3.0/intro/tutorial03/

-- 
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/67447115-2534-420f-a433-672cd644d1b1%40googlegroups.com.


Re: How to pass a variable to views from a template using href ?

2020-05-19 Thread Desh Deepak
You can use slug

On Tue, 19 May 2020, 6:44 pm ratnadeep ray,  wrote:

> Hi all,
>
> My requirement is to pass a variable to the view from the template using
> href.
>
> For example, I have written the following line of code:
>
> SQL data
>
>
> So using the above line, can we send the value "SQL" clicking on the link
> of "SQL data" to the method "execute" written in the views? If not, then
> what way can I do so?
>
> 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/7e892826-f4c1-426d-bf9b-1a1b0b2b17be%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7e892826-f4c1-426d-bf9b-1a1b0b2b17be%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/CAJ0m4xiv67vWFfQGqub73TJeb2ekfCaqg%2BO3RoirSbM6ADYPpg%40mail.gmail.com.


  1   2   3   4   5   6   7   8   9   10   >