Okay,
>
> *those queries that you're executing in module scope should go into 
> functions and methods that you only call when you actually need that data.*


This is enough to me. lol
I did query outside the functions, I didn't notice that it would be a 
problem.
Thank you very much.

ANi於 2019年1月14日星期一 UTC+8下午3時49分44秒寫道:
>
> Hello.
>
> I want to migrate all tables into new database but bumped into an error 
> that it said "auth_permission" is not found.
> Then I searched for the possible causes, it turned out that it is because 
> I accessed the auth model "Permission" in my code before the migrate 
> creating table in database.
> I tried to run *python manage.py migrate auth, *but nothing changed.
>
> So maybe I have to change my code ... I have to filter out managers by its 
> permission.
>
> manager_permission = Permission.objects.get(codename='manager')
> managers = User.objects.filter(project=project).filter(user_permissions=
> manager_permission)
>
> User.user_permissions is only allowed to use the permission code which 
> could be different every time I re-migrate the whole database.
>
> So I am asking if there is a better way to filter out managers by its perm 
> or other solutions ? :)
>
> Thank you in advance.
>
>
>
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
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/59fd6bb6-be5a-4bdc-9350-fd5382bf0ff9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to