Hi,

You don't need to check for superuser explicitly Django does that when you check does user have a permission and returns true for all perm checks.

So it's just simple check.

Unless you meant something else, maybe giving a sample code would help understand your problem better.

On 16.03.2017 11:29, guettli wrote:
This is not a question, just a feeling. I want to know if you feel the same pain.

Checking for permission in django is done in two steps:

 check1: check if user is superuser, then user is allowed.
 check2: check if user has the given permission.

This OR is solvable. It's easy to code. It is just a simple "if".

The OR can be done in SQL, too.... But not much better.

But somehow it makes my code messy.

I would like to get the answer directly from postgres/DB, I don't write a condition.

I want it to be straight forward.

In our custom code we already skip check1 and do only check2.

But this makes the whole situation not much better.

I am just speaking out my thoughts.

Dear django (core) developer: I like django very much and it is a great
framework which I use daily with joy. Don't get me wrong!

Unfortunately I have no clue which strategy could lead me to the goal if this particular issue without doing stuff in my code completely different than django does. I want to avoid doing uncommon things
and stick to upstream.

Regards,
  Thomas Güttler




--
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 [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d629dba5-cc73-4625-9d91-92741b7010a2%40googlegroups.com <https://groups.google.com/d/msgid/django-users/d629dba5-cc73-4625-9d91-92741b7010a2%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
Jani Tiainen

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/472278f7-898e-07d9-ebd6-cab399825afb%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to