I would like to participate and contribute in your project

2023-02-05 Thread Mohammed Shoaib
Hi Mentors, I would like to contribute to your project. I'm a 1st year
Engineering student who is pursuing Electrical & Electronics in PSG College
of Technology. Please Suggest me some resources to learn the technologies
that you use as well as codebases. I'm a good learner. I'll spend more time
learning those.

 Thank you

with regards
Mohammed Shoaib S.T

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


Re: Model icons

2023-02-05 Thread Yeonggwang Yang
that sounds good with me

2023년 2월 5일 일요일 오전 9시 36분 17초 UTC+9에 Marty님이 작성:

> Hi all,
>
> Recently, it's trend to use icons or emoji before menu items and I like 
> this idea because  IMHO people orient better and more quickly when they see 
> picture.
>
> What about to add this feature to native django? I thought the easiest way 
> would be to add new Meta option to Model. The default Meta icon would be 
> empty string so everything would work like now. If I want to make menu more 
> readable, I just add emoji (🔨) or html (Awesome font - * class="fa-solid fa-hammer">* , Bootstrap icon - **, etc.) to Meta icon.
>
> Code example:
>
> *Model:*
> class Hammer(models.Model):
> ...
>
> Meta:
> icon = ''
>
> *app_list.html template:*
> ...
> {{model.icon}} {{model.name}}
> ...
>
> Final result:
> [image: admin navbar.png]
>
> Maybe own icon could have even the parent app (AppConfig). And the model 
> icon could be in breadcrumbs.
>
> What do you think about this idea? 🙂
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6c859cc5-ea41-4695-9fcf-5cd435310364n%40googlegroups.com.


Re: Async wrappers in contrib packages

2023-02-05 Thread Jon Janzen
Hey,

Sorry about the delay in my response, holidays came early and stayed late for 
me this year.

> TBH I'd prefer it if you pondered the design here without opening a ticket 
> until such a point (if ever) that you have a concrete plan. (We'd likely just 
> close it as wontfix unless there's a specific idea on the table anyway, so 
> it's just noise at that point.) 

Understood, sorry for my ignorance on the process. I appreciate your patience!

>>> There's: https://code.djangoproject.com/ticket/31949 "Allow builtin view 
>>> decorators to be applied directly to async views."
>>> I think this is likely the next step.
>>> 
>>> There's a PR for that, which I think took a too complex approach (see 
>>> discussion). A simpler (more inline) take be good to see. 
>> 
>> Thanks, I saw this ticket but it didn't look relevant when I was skimming 
>> the tracker. I'll take a closer look.

Replying to myself here, I took a look at this ticket and associated PRs and 
that’s not quite do what I’m looking for (even if all the various constituent 
parts got merged) but the changes to the `auth` decorators are related.

I’m interested in an async interface of the auth app itself, i.e. the 
functionality exposed in `django/contrib/auth/__init__.py`.

(the next few paragraphs are background info on my personal investment in this, 
feel free to skip to the section marked “Proposal")

For some background on my interest in this: I’m running Django as an asgi app 
and all codepaths down to the django framework boundary are async. That means 
all my middleware, views, and ORM usage are all using the async versions, where 
applicable/possible. There are a number of reasons for this, but the most 
notable are simplicity (easier to reason about code if it is all either sync or 
async) and efficiency (most of the code is GraphQL resolvers which are more 
efficient to execute concurrently).

Also important to know that I almost exclusively use django as an API server, 
there is only one template for all “views” which just loads a javascript 
webpack bundle and renders using React, which then fetches data from the server 
using GraphQL. Effectively, that means I‘m calling the django auth APIs 
directly instead of using the default `LoginView` or `login_required` or 
anything like that.

Anyway, right now almost all of the sync/async boundaries are “invisible” to me 
in that they are inside Django. I’ve replaced all my own wrappers around the 
ORM’s synchronous-only methods with the `a`-prefixed methods provided over the 
last few Django releases (and that will be provided in 4.2!). So `aget` instead 
of `get`, `acreate` instead of `create` and so forth.

One area of async/sync boundaries that is currently prevalent in my codebase is 
my `sync_to_async` wrappers around `django.contrib.auth` methods. I’d like to 
push those down into Django, and then as deep into Django as is expedient right 
now.

# Proposal
Add asynchronous versions of the auth app’s API (i.e. `__init__.py`), then 
allow backends to have async-native versions and use that from the public API, 
and finally update the provided middleware (and maybe decorators) to use 
async-native functionality if they are running in ASGI mode.


## Part 1: Async API
The “simple” part of this proposal is just to define a bunch of functions with 
“a” prefixes in `__init__.py` and use `sync_to_async` to call the synchronous 
versions as has been done to, for example, QuerySet. This would involve 
asynchronous versions of the following functions in `auth/__init__.py`:

* `get_user`
* `authenticate`
* `login`
* `update_session_auth_hash`
* `logout`


## Part 2: async backends
I think once that interface is defined it makes sense to try and make as much 
of this framework as natively async-compatible as possible. That would mean 
adding support for async auth backends and then connecting the async API 
methods (as enumerated above) to the async versions of the backend methods.

This could mean that there would be no `sync_to_async` calls within the `auth` 
app itself (except for sessions and signals, see Open Questions below), and any 
sync/async boundaries would be “below” the `auth` app. For example, for 
`ModelBackend` and its children the sync/async boundary would be in the ORM 
layer, as `QuerySet` presents an async API that is currently just a wrapper 
around the sync internals.

Allowing async backends would involve introducing the following async functions 
to `BaseBackend` that just call the sync versions by default, and can be 
overridden in child classes to have natively async versions:

* `authenticate`
* `get_user`
* `get_user_permissions`
* `get_group_permissions`
* `get_all_permissions`
* `has_perm`

Then `ModelBackend` would be augmented to have async-native versions of the 
above. `RemoteUserBackend` would also need some tweaks to be async-native, but 
overall this isn’t terribly much work. Oh and to support `ModelBackend` being 
async-native `BaseUserModel` would need an