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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.


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

2021-01-11 Thread Leon Albrecht

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

 Log
30 new auto-negotiating client connection

30: Client using the ascii protocol

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

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

30 END

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

30 END

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

30 END

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

30 NOT_FOUND

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

30 STORED

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

30 NOT_FOUND

30 connection closed.

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

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

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

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

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

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

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

'django.middleware.common.CommonMiddleware',

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

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

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

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


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

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


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62ca9961-8690-41d4-a498-5b2c00dc0671n%40googlegroups.com.


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


job opening for python back-end engineer

2021-01-11 Thread suresh natarajan
job opening for python back end engineer

https://www.linkedin.com/jobs/view/2364128448

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


Week in Tech

2021-01-11 Thread salesne...@gmail.com
https://youtu.be/fas9q2wr_e4

There's a python code in each headline!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0c65e875-02c7-4436-8dce-86fb8a08595cn%40googlegroups.com.