Re: Sometimes get "incorrect padding error"- new bug in django 3.1?

2020-08-18 Thread Matthew Hegarty
Raised a ticket 
The only workaround is to truncate the django_session table.  (clearsessions

did not work)

On Mon, 17 Aug 2020 at 21:24, Matthew Hegarty  wrote:

> Hey Diptesh - did you get anywhere with understanding this?  Did y ou get
> any response from the Django devs?
> Just happened to me on my Staging site.  Recently upgraded from 3.0 to 3.1
>
> I can login with Firefox, but Chrome crashes with the following error:
>
> ```python
> Internal Server Error: /home/
> Traceback (most recent call last):
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 215, in _get_session
> return self._session_cache
> AttributeError: 'SessionStore' object has no attribute '_session_cache'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 118, in decode
> return signing.loads(session_data, salt=self.key_salt,
> serializer=self.serializer)
> File "/usr/local/lib/python3.8/site-packages/django/core/signing.py", line
> 135, in loads
> base64d = TimestampSigner(key, salt=salt).unsign(s,
> max_age=max_age).encode()
> File "/usr/local/lib/python3.8/site-packages/django/core/signing.py", line
> 201, in unsign
> result = super().unsign(value)
> File "/usr/local/lib/python3.8/site-packages/django/core/signing.py", line
> 184, in unsign
> raise BadSignature('Signature "%s" does not match' % sig)
> django.core.signing.BadSignature: Signature
> "xxx" does not match
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File
> "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py",
> line 47, in inner
> response = get_response(request)
> File
> "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line
> 179, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
> File
> "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line
> 73, in view
> return self.dispatch(request, *args, **kwargs)
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/auth/mixins.py",
> line 50, in dispatch
> if not request.user.is_authenticated:
> File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py",
> line 240, in inner
> self._setup()
> File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py",
> line 376, in _setup
> self._wrapped = self._setupfunc()
> File "/usr/local/lib/python3.8/site-packages/django_otp/middleware.py",
> line 38, in _verify_user
> user.otp_device = None
> File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py",
> line 270, in __setattr__
> self._setup()
> File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py",
> line 376, in _setup
> self._wrapped = self._setupfunc()
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/auth/middleware.py",
> line 23, in 
> request.user = SimpleLazyObject(lambda: get_user(request))
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/auth/middleware.py",
> line 11, in get_user
> request._cached_user = auth.get_user(request)
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/auth/__init__.py",
> line 174, in get_user
> user_id = _get_user_session_key(request)
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/auth/__init__.py",
> line 58, in _get_user_session_key
> return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 65, in __getitem__
> return self._session[key]
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 220, in _get_session
> self._session_cache = self.load()
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py",
> line 44, in load
> return self.decode(s.session_data) if s else {}
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 122, in decode
> return self._legacy_decode(session_data)
> File
> "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py",
> line 126, in _legacy_decode
> encoded_data = base64.b64decode(session_data.encode('ascii'))
> File "/usr/local/lib/python3.8/base64.py", line 87, in b64decode
> return binascii.a2b_base64(s)
> binascii.Error: Incorrect padding
> ```
> On Monday, 10 August 2020 at 12:21:34 UTC+1 Diptesh Choudhuri wrote:
>
>>
>>
>> Environment:
>>
>>
>>
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/admin/
>>
>>
>> Django Version: 3.1
>> Python Version: 3.8.3
>> Installed Applications:
>> ['django.contrib.admin',
>>  'django.contrib.auth',

Re: type error

2020-08-18 Thread Rostislav Kornatsky
Hi, my name is Rostislav and I'm learning Django too, We could collaborate
and learn it together:)

пт, 14 авг. 2020 г. в 21:50, Peter Kirieny :

> hello, can somebody help with this please
>
> match = datetime_re.match(value)
> TypeError: expected string or bytes-like object
>
> I've made migrations but now i can't migrate, it brings the above error
> instead
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL8t8epXffzY6L6ox8whRQuf16n1bGOuQ9pGnHEWPt_XQBahqg%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/CAPe0rWvVEVE%2B-3vaSq5VCWmQFBY4T5FTn2tLVs_hKD%3DfHv6CaA%40mail.gmail.com.


Re: type error

2020-08-18 Thread Liu Zheng
hi,

What’s the type and value of that variable “value”? It would be helpful to
print out value and type(value) right in front of this line where error
occurs.

Best
Zheng

On Tue, 18 Aug 2020 at 9:21 PM, Rostislav Kornatsky <
info.send.o...@gmail.com> wrote:

> Hi, my name is Rostislav and I'm learning Django too, We could collaborate
> and learn it together:)
>
> пт, 14 авг. 2020 г. в 21:50, Peter Kirieny :
>
>> hello, can somebody help with this please
>>
>> match = datetime_re.match(value)
>> TypeError: expected string or bytes-like object
>>
>> I've made migrations but now i can't migrate, it brings the above error
>> instead
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>>
>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAL8t8epXffzY6L6ox8whRQuf16n1bGOuQ9pGnHEWPt_XQBahqg%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/CAPe0rWvVEVE%2B-3vaSq5VCWmQFBY4T5FTn2tLVs_hKD%3DfHv6CaA%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/CAGQ3pf9_TLkj8%3D6qD9%2BNYU3r1YnepGc-isMai2G9D-PLj4Lqfw%40mail.gmail.com.


Django ORM Model meta internal API to current API update

2020-08-18 Thread Asif Saif Uddin

Hi,
I have got an old project of django 1.8 which use codes like

links = [rel.get_accessor_name() for rel in 
self._meta.get_all_related_objects()]

How would I upgrade this code snippets to django 2.2 LTS?

TIA

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


Re: Django ORM Model meta internal API to current API update

2020-08-18 Thread Mbah Victor
I don't bro i just started new in Django

Victor

On Tue, Aug 18, 2020, 3:46 PM Asif Saif Uddin  wrote:

>
> Hi,
> I have got an old project of django 1.8 which use codes like
>
> links = [rel.get_accessor_name() for rel in
> self._meta.get_all_related_objects()]
>
> How would I upgrade this code snippets to django 2.2 LTS?
>
> TIA
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c408d424-7c94-43de-beae-4071d424e2ecn%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/CANTsAyeqNREndZeVeyxLY396Z1uQ5zkS-CrQeKD9Yfi63GGq4w%40mail.gmail.com.


Re: type error

2020-08-18 Thread 'Amitesh Sahay' via Django users
Hi, 
I have developed a django website for my company. Its schoolnskill.com. For now 
its not much to look at. But due to other work I am not able to add 
enhancements to it. 
1) I need to add payment gateway(Paytm and Paypal)2) Create one more model and 
then create respective forms.py and views.py and integrate it with frontend.( I 
can give more clarity).
Please let me know if anybody is up for it


Regards,
Amitesh 

On Tuesday, 18 August, 2020, 07:05:42 pm IST, Liu Zheng 
 wrote:  
 
 hi,
What’s the type and value of that variable “value”? It would be helpful to 
print out value and type(value) right in front of this line where error occurs.
BestZheng
On Tue, 18 Aug 2020 at 9:21 PM, Rostislav Kornatsky  
wrote:

Hi, my name is Rostislav and I'm learning Django too, We could collaborate and 
learn it together:)

пт, 14 авг. 2020 г. в 21:50, Peter Kirieny :

hello, can somebody help with this please
    match = datetime_re.match(value)
TypeError: expected string or bytes-like object

I've made migrations but now i can't migrate, it brings the above error instead









-- 


You received this message because you are subscribed to the Google Groups 
"Django users" group.


To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.


To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL8t8epXffzY6L6ox8whRQuf16n1bGOuQ9pGnHEWPt_XQBahqg%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/CAPe0rWvVEVE%2B-3vaSq5VCWmQFBY4T5FTn2tLVs_hKD%3DfHv6CaA%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/CAGQ3pf9_TLkj8%3D6qD9%2BNYU3r1YnepGc-isMai2G9D-PLj4Lqfw%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/238851525.2088150.1597816322801%40mail.yahoo.com.