I teach Django for beginners for free ( Live sessions )

2021-07-02 Thread Symaxx
I teach Django the Python framework for free. Those interested join my 
Whatsapp group for free live sessions 
https://chat.whatsapp.com/DpOEaJTyhcXGF4YnFe3XLm 

#pythonprogramming 

 
#python 

 
#django 


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


Re: Admin TypeError - Cannot call delete() after .distinct()

2021-07-02 Thread Mike Dewhirst
Just looked at that ticket and it seems probable that is what is happening.I'll 
be patient. Thanks for thatM--(Unsigned mail from my phone)
 Original message From: Jason  Date: 
2/7/21  22:30  (GMT+10:00) To: Django users  
Subject: Re: Admin TypeError - Cannot call delete() after .distinct() 
https://code.djangoproject.com/ticket/32682 might be the root cause, which was 
fixed end of April and part of the 3.2.1 release, doesn't seem like its been 
backported to 3.1On Friday, July 2, 2021 at 2:03:28 AM UTC-4 Mike Dewhirst 
wrote:Trying to delete a record in the Admin list view by checking the 
checkbox and selecting the delete action and clicking [Go] the following 
500 error happened.

It seems to be all within the Admin so I'm not sure how to proceed from 
here.

Thanks for any hints

Mike

Traceback (most recent call last):
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\exception.py", 
line 47, in inner
     response = get_response(request)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\base.py", 
line 181, in _get_response
     response = wrapped_callback(request, *callback_args, **callback_kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 616, in wrapper
     return self.admin_site.admin_view(view)(*args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 130, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\views\decorators\cache.py", 
line 44, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\sites.py", 
line 232, in inner
     return view(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 43, in _wrapper
     return bound_method(*args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 130, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1739, in changelist_view
     response = self.response_action(request, 
queryset=cl.get_queryset(request))
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1408, in response_action
     response = func(self, request, queryset)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\actions.py", 
line 45, in delete_selected
     modeladmin.delete_queryset(request, queryset)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1109, in delete_queryset
     queryset.delete()
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py", 
line 728, in delete
     raise TypeError('Cannot call delete() after .distinct().')

Exception Type: TypeError at /admin/chemical/chemical/
Exception Value: Cannot call delete() after .distinct().

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






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/086bef60-4422-4021-949b-84e19e9768b2n%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/60df20c4.1c69fb81.ed7bc.5675SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Admin TypeError - Cannot call delete() after .distinct()

2021-07-02 Thread Mike Dewhirst
Should have mentioned - I'm running 3.2.4M--(Unsigned mail from my phone)
 Original message From: Jason  Date: 
2/7/21  22:30  (GMT+10:00) To: Django users  
Subject: Re: Admin TypeError - Cannot call delete() after .distinct() 
https://code.djangoproject.com/ticket/32682 might be the root cause, which was 
fixed end of April and part of the 3.2.1 release, doesn't seem like its been 
backported to 3.1On Friday, July 2, 2021 at 2:03:28 AM UTC-4 Mike Dewhirst 
wrote:Trying to delete a record in the Admin list view by checking the 
checkbox and selecting the delete action and clicking [Go] the following 
500 error happened.

It seems to be all within the Admin so I'm not sure how to proceed from 
here.

Thanks for any hints

Mike

Traceback (most recent call last):
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\exception.py", 
line 47, in inner
     response = get_response(request)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\base.py", 
line 181, in _get_response
     response = wrapped_callback(request, *callback_args, **callback_kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 616, in wrapper
     return self.admin_site.admin_view(view)(*args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 130, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\views\decorators\cache.py", 
line 44, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\sites.py", 
line 232, in inner
     return view(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 43, in _wrapper
     return bound_method(*args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
line 130, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1739, in changelist_view
     response = self.response_action(request, 
queryset=cl.get_queryset(request))
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1408, in response_action
     response = func(self, request, queryset)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\actions.py", 
line 45, in delete_selected
     modeladmin.delete_queryset(request, queryset)
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
line 1109, in delete_queryset
     queryset.delete()
   File 
"D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py", 
line 728, in delete
     raise TypeError('Cannot call delete() after .distinct().')

Exception Type: TypeError at /admin/chemical/chemical/
Exception Value: Cannot call delete() after .distinct().

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






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/086bef60-4422-4021-949b-84e19e9768b2n%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/60df1f7f.1c69fb81.1daca.33a9SMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Admin TypeError - Cannot call delete() after .distinct()

2021-07-02 Thread Sebastian Jung
Hello Mike,

i don't understand why you want make a delete from a distict... Then you
delete random entrys. When you want do delete dupletes then this is a wrong
method to delete dupletes...

Regards

Am Fr., 2. Juli 2021 um 08:03 Uhr schrieb Mike Dewhirst <
mi...@dewhirst.com.au>:

> Trying to delete a record in the Admin list view by checking the
> checkbox and selecting the delete action and clicking [Go] the following
> 500 error happened.
>
> It seems to be all within the Admin so I'm not sure how to proceed from
> here.
>
> Thanks for any hints
>
> Mike
>
> Traceback (most recent call last):
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\exception.py",
>
> line 47, in inner
>  response = get_response(request)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\base.py",
> line 181, in _get_response
>  response = wrapped_callback(request, *callback_args,
> **callback_kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py",
>
> line 616, in wrapper
>  return self.admin_site.admin_view(view)(*args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py",
> line 130, in _wrapped_view
>  response = view_func(request, *args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\views\decorators\cache.py",
>
> line 44, in _wrapped_view_func
>  response = view_func(request, *args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\sites.py",
> line 232, in inner
>  return view(request, *args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py",
> line 43, in _wrapper
>  return bound_method(*args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py",
> line 130, in _wrapped_view
>  response = view_func(request, *args, **kwargs)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py",
>
> line 1739, in changelist_view
>  response = self.response_action(request,
> queryset=cl.get_queryset(request))
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py",
>
> line 1408, in response_action
>  response = func(self, request, queryset)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\actions.py",
>
> line 45, in delete_selected
>  modeladmin.delete_queryset(request, queryset)
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py",
>
> line 1109, in delete_queryset
>  queryset.delete()
>File
> "D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py",
> line 728, in delete
>  raise TypeError('Cannot call delete() after .distinct().')
>
> Exception Type: TypeError at /admin/chemical/chemical/
> Exception Value: Cannot call delete() after .distinct().
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4ceeffab-480a-aecd-a12d-01f183598d57%40dewhirst.com.au
> .
>

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


Re: paginate_by attribute not giving error.

2021-07-02 Thread Lalit Suthar
override `get_context_data` instead of `get_queryset` for this task
refer: https://ccbv.co.uk/

On Thu, 1 Jul 2021 at 14:41, sunday honesty  wrote:

> Hello guys, it's been a while here.
>
> Need some help pls.
>
> I had to override my ListView get_querryset() method to query my posts
> according to a given category. But it seem my context is not a list of
> objects again as I get this error message: "TypeError: unhashable type:
> 'slice' " when I try to add a paginate_by attribute to the view. Pls see my
> view below:
>
>
>
> class CategoryListView(ListView):
> template_name = 'blog/category.html'
> context_object_name = 'cat_list'
> paginate_by = 4
>
> def get_queryset(self):
> context = {
> 'cat': self.kwargs['category'],
> 'posts':
> Post.objects.filter(category__name=self.kwargs['category'],
> status='published')
> }
> return context
>
> Any help will be appreciated as I don't seem to be strong with Django.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALcuGNsa7gbpS7%3D_8tUNpXUVduR8tshygU7ZZNco1gjUz%3DeJTg%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/CAGp2JVF%3D8VO1vzEAPWVHRRf4z4G4ue1SQqVsfyYTU3p189TjRA%40mail.gmail.com.


Re: Admin TypeError - Cannot call delete() after .distinct()

2021-07-02 Thread Jason

https://code.djangoproject.com/ticket/32682 might be the root cause, which 
was fixed end of April and part of the 3.2.1 release, doesn't seem like its 
been backported to 3.1
On Friday, July 2, 2021 at 2:03:28 AM UTC-4 Mike Dewhirst wrote:

> Trying to delete a record in the Admin list view by checking the 
> checkbox and selecting the delete action and clicking [Go] the following 
> 500 error happened.
>
> It seems to be all within the Admin so I'm not sure how to proceed from 
> here.
>
> Thanks for any hints
>
> Mike
>
> Traceback (most recent call last):
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\exception.py",
>  
>
> line 47, in inner
> response = get_response(request)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\core\handlers\base.py", 
> line 181, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
>
> line 616, in wrapper
> return self.admin_site.admin_view(view)(*args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
> line 130, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\views\decorators\cache.py", 
>
> line 44, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\sites.py", 
> line 232, in inner
> return view(request, *args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
> line 43, in _wrapper
> return bound_method(*args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\utils\decorators.py", 
> line 130, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
>
> line 1739, in changelist_view
> response = self.response_action(request, 
> queryset=cl.get_queryset(request))
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
>
> line 1408, in response_action
> response = func(self, request, queryset)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\actions.py", 
>
> line 45, in delete_selected
> modeladmin.delete_queryset(request, queryset)
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py", 
>
> line 1109, in delete_queryset
> queryset.delete()
>   File 
> "D:\Users\mike\envs\xxai\lib\site-packages\django\db\models\query.py", 
> line 728, in delete
> raise TypeError('Cannot call delete() after .distinct().')
>
> Exception Type: TypeError at /admin/chemical/chemical/
> Exception Value: Cannot call delete() after .distinct().
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/086bef60-4422-4021-949b-84e19e9768b2n%40googlegroups.com.