understanding QuerySet of Django Permissions
Am new to Django, have been working on linking some permissions to groups and then adding users to those groups. Have managed some of that so far, but am stuck on understanding exactly what is going on with the permissions. Here is my attempt so far:
(Django-1.11.4-env) $ python manage.py shell
Python 3.6.7 (default, Oct 25 2018, 13:09:20)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import Permission
>>> p = Permission.objects.all()
then
>>> p.values
<bound method QuerySet.values of <QuerySet [<Permission: MyApp | user | Can add user>, <Permission: MyApp | user | Can write stuff.>, <Permission: MyApp | user | Can change user>, <Permission: MyApp | user | Can delete user>, <Permission: admin | log entry | Can add log entry>, <Permission: admin | log entry | Can change log entry>, <Permission: admin | log entry | Can delete log entry>, <Permission: auth | group | Can add group>, <Permission: auth | group | Can change group>, <Permission: auth | group | Can delete group>, <Permission: auth | permission | Can add permission>, <Permission: auth | permission | Can change permission>, <Permission: auth | permission | Can delete permission>, <Permission: contenttypes | content type | Can add content type>, <Permission: contenttypes | content type | Can change content type>, <Permission: contenttypes | content type | Can delete content type>, <Permission: sessions | session | Can add session>, <Permission: sessions | session | Can change session>, <Permission: sessions | session | Can delete session>]>>
then
>>> p.values()
<QuerySet [{'id': 16, 'name': 'Can add user', 'content_type_id': 6, 'codename': 'add_user'}, {'id': 19, 'name': 'Can write stuff.', 'content_type_id': 6, 'codename': 'can_write'}, {'id': 17, 'name': 'Can change user', 'content_type_id': 6, 'codename': 'change_user'}, {'id': 18, 'name': 'Can delete user', 'content_type_id': 6, 'codename': 'delete_user'}, {'id': 1, 'name': 'Can add log entry', 'content_type_id': 1, 'codename': 'add_logentry'}, {'id': 2, 'name': 'Can change log entry', 'content_type_id': 1, 'codename': 'change_logentry'}, {'id': 3, 'name': 'Can delete log entry', 'content_type_id': 1, 'codename': 'delete_logentry'}, {'id': 7, 'name': 'Can add group', 'content_type_id': 3, 'codename': 'add_group'}, {'id': 8, 'name': 'Can change group', 'content_type_id': 3, 'codename': 'change_group'}, {'id': 9, 'name': 'Can delete group', 'content_type_id': 3, 'codename': 'delete_group'}, {'id': 4, 'name': 'Can add permission', 'content_type_id': 2, 'codename': 'add_permission'}, {'id': 5, 'name': 'Can change permission', 'content_type_id': 2, 'codename': 'change_permission'}, {'id': 6, 'name': 'Can delete permission', 'content_type_id': 2, 'codename': 'delete_permission'}, {'id': 10, 'name': 'Can add content type', 'content_type_id': 4, 'codename': 'add_contenttype'}, {'id': 11, 'name': 'Can change content type', 'content_type_id': 4, 'codename': 'change_contenttype'}, {'id': 12, 'name': 'Can delete content type', 'content_type_id': 4, 'codename': 'delete_contenttype'}, {'id': 13, 'name': 'Can add session', 'content_type_id': 5, 'codename': 'add_session'}, {'id': 14, 'name': 'Can change session', 'content_type_id': 5, 'codename': 'change_session'}, {'id': 15, 'name': 'Can delete session', 'content_type_id': 5, 'codename': 'delete_session'}]>
Of all the permissions here, most of them were part of Django but the one with name 'Can write stuff.'
I added previously.
So the output of p.values() is relatively intuitive, each permission has a set of keys and values linked to it.
Am really stuck though on understanding the output of p.values
<Permission: MyApp | user | Can add user>
<Permission: admin | log entry | Can add log entry>
<Permission: contenttypes | content type | Can add content type>
<Permission: sessions | session | Can change session>
<Permission: auth | permission | Can add permission>
Only the third part of each of these elements of the QuerySet after the pipe is found in the dictionaries from p.values() under 'name', eg 'Can add user'
What is the meaning of the first and second part of each of these?
python django django-1.11 django-permissions
add a comment |
Am new to Django, have been working on linking some permissions to groups and then adding users to those groups. Have managed some of that so far, but am stuck on understanding exactly what is going on with the permissions. Here is my attempt so far:
(Django-1.11.4-env) $ python manage.py shell
Python 3.6.7 (default, Oct 25 2018, 13:09:20)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import Permission
>>> p = Permission.objects.all()
then
>>> p.values
<bound method QuerySet.values of <QuerySet [<Permission: MyApp | user | Can add user>, <Permission: MyApp | user | Can write stuff.>, <Permission: MyApp | user | Can change user>, <Permission: MyApp | user | Can delete user>, <Permission: admin | log entry | Can add log entry>, <Permission: admin | log entry | Can change log entry>, <Permission: admin | log entry | Can delete log entry>, <Permission: auth | group | Can add group>, <Permission: auth | group | Can change group>, <Permission: auth | group | Can delete group>, <Permission: auth | permission | Can add permission>, <Permission: auth | permission | Can change permission>, <Permission: auth | permission | Can delete permission>, <Permission: contenttypes | content type | Can add content type>, <Permission: contenttypes | content type | Can change content type>, <Permission: contenttypes | content type | Can delete content type>, <Permission: sessions | session | Can add session>, <Permission: sessions | session | Can change session>, <Permission: sessions | session | Can delete session>]>>
then
>>> p.values()
<QuerySet [{'id': 16, 'name': 'Can add user', 'content_type_id': 6, 'codename': 'add_user'}, {'id': 19, 'name': 'Can write stuff.', 'content_type_id': 6, 'codename': 'can_write'}, {'id': 17, 'name': 'Can change user', 'content_type_id': 6, 'codename': 'change_user'}, {'id': 18, 'name': 'Can delete user', 'content_type_id': 6, 'codename': 'delete_user'}, {'id': 1, 'name': 'Can add log entry', 'content_type_id': 1, 'codename': 'add_logentry'}, {'id': 2, 'name': 'Can change log entry', 'content_type_id': 1, 'codename': 'change_logentry'}, {'id': 3, 'name': 'Can delete log entry', 'content_type_id': 1, 'codename': 'delete_logentry'}, {'id': 7, 'name': 'Can add group', 'content_type_id': 3, 'codename': 'add_group'}, {'id': 8, 'name': 'Can change group', 'content_type_id': 3, 'codename': 'change_group'}, {'id': 9, 'name': 'Can delete group', 'content_type_id': 3, 'codename': 'delete_group'}, {'id': 4, 'name': 'Can add permission', 'content_type_id': 2, 'codename': 'add_permission'}, {'id': 5, 'name': 'Can change permission', 'content_type_id': 2, 'codename': 'change_permission'}, {'id': 6, 'name': 'Can delete permission', 'content_type_id': 2, 'codename': 'delete_permission'}, {'id': 10, 'name': 'Can add content type', 'content_type_id': 4, 'codename': 'add_contenttype'}, {'id': 11, 'name': 'Can change content type', 'content_type_id': 4, 'codename': 'change_contenttype'}, {'id': 12, 'name': 'Can delete content type', 'content_type_id': 4, 'codename': 'delete_contenttype'}, {'id': 13, 'name': 'Can add session', 'content_type_id': 5, 'codename': 'add_session'}, {'id': 14, 'name': 'Can change session', 'content_type_id': 5, 'codename': 'change_session'}, {'id': 15, 'name': 'Can delete session', 'content_type_id': 5, 'codename': 'delete_session'}]>
Of all the permissions here, most of them were part of Django but the one with name 'Can write stuff.'
I added previously.
So the output of p.values() is relatively intuitive, each permission has a set of keys and values linked to it.
Am really stuck though on understanding the output of p.values
<Permission: MyApp | user | Can add user>
<Permission: admin | log entry | Can add log entry>
<Permission: contenttypes | content type | Can add content type>
<Permission: sessions | session | Can change session>
<Permission: auth | permission | Can add permission>
Only the third part of each of these elements of the QuerySet after the pipe is found in the dictionaries from p.values() under 'name', eg 'Can add user'
What is the meaning of the first and second part of each of these?
python django django-1.11 django-permissions
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the commanddjango-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.
– cardamom
Nov 21 '18 at 16:17
They're not built-in, you actually specified them yourself with the settingINSTALLED_APPS
in your settings.py file.
– dirkgroten
Nov 21 '18 at 16:38
And the spaces is just because that's theverbose_name
of the model that is printed here.
– dirkgroten
Nov 21 '18 at 16:43
Thanks, can see that in thereINSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there fromdjango-admin startproject myproject
anddjango-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.
– cardamom
Nov 21 '18 at 17:01
add a comment |
Am new to Django, have been working on linking some permissions to groups and then adding users to those groups. Have managed some of that so far, but am stuck on understanding exactly what is going on with the permissions. Here is my attempt so far:
(Django-1.11.4-env) $ python manage.py shell
Python 3.6.7 (default, Oct 25 2018, 13:09:20)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import Permission
>>> p = Permission.objects.all()
then
>>> p.values
<bound method QuerySet.values of <QuerySet [<Permission: MyApp | user | Can add user>, <Permission: MyApp | user | Can write stuff.>, <Permission: MyApp | user | Can change user>, <Permission: MyApp | user | Can delete user>, <Permission: admin | log entry | Can add log entry>, <Permission: admin | log entry | Can change log entry>, <Permission: admin | log entry | Can delete log entry>, <Permission: auth | group | Can add group>, <Permission: auth | group | Can change group>, <Permission: auth | group | Can delete group>, <Permission: auth | permission | Can add permission>, <Permission: auth | permission | Can change permission>, <Permission: auth | permission | Can delete permission>, <Permission: contenttypes | content type | Can add content type>, <Permission: contenttypes | content type | Can change content type>, <Permission: contenttypes | content type | Can delete content type>, <Permission: sessions | session | Can add session>, <Permission: sessions | session | Can change session>, <Permission: sessions | session | Can delete session>]>>
then
>>> p.values()
<QuerySet [{'id': 16, 'name': 'Can add user', 'content_type_id': 6, 'codename': 'add_user'}, {'id': 19, 'name': 'Can write stuff.', 'content_type_id': 6, 'codename': 'can_write'}, {'id': 17, 'name': 'Can change user', 'content_type_id': 6, 'codename': 'change_user'}, {'id': 18, 'name': 'Can delete user', 'content_type_id': 6, 'codename': 'delete_user'}, {'id': 1, 'name': 'Can add log entry', 'content_type_id': 1, 'codename': 'add_logentry'}, {'id': 2, 'name': 'Can change log entry', 'content_type_id': 1, 'codename': 'change_logentry'}, {'id': 3, 'name': 'Can delete log entry', 'content_type_id': 1, 'codename': 'delete_logentry'}, {'id': 7, 'name': 'Can add group', 'content_type_id': 3, 'codename': 'add_group'}, {'id': 8, 'name': 'Can change group', 'content_type_id': 3, 'codename': 'change_group'}, {'id': 9, 'name': 'Can delete group', 'content_type_id': 3, 'codename': 'delete_group'}, {'id': 4, 'name': 'Can add permission', 'content_type_id': 2, 'codename': 'add_permission'}, {'id': 5, 'name': 'Can change permission', 'content_type_id': 2, 'codename': 'change_permission'}, {'id': 6, 'name': 'Can delete permission', 'content_type_id': 2, 'codename': 'delete_permission'}, {'id': 10, 'name': 'Can add content type', 'content_type_id': 4, 'codename': 'add_contenttype'}, {'id': 11, 'name': 'Can change content type', 'content_type_id': 4, 'codename': 'change_contenttype'}, {'id': 12, 'name': 'Can delete content type', 'content_type_id': 4, 'codename': 'delete_contenttype'}, {'id': 13, 'name': 'Can add session', 'content_type_id': 5, 'codename': 'add_session'}, {'id': 14, 'name': 'Can change session', 'content_type_id': 5, 'codename': 'change_session'}, {'id': 15, 'name': 'Can delete session', 'content_type_id': 5, 'codename': 'delete_session'}]>
Of all the permissions here, most of them were part of Django but the one with name 'Can write stuff.'
I added previously.
So the output of p.values() is relatively intuitive, each permission has a set of keys and values linked to it.
Am really stuck though on understanding the output of p.values
<Permission: MyApp | user | Can add user>
<Permission: admin | log entry | Can add log entry>
<Permission: contenttypes | content type | Can add content type>
<Permission: sessions | session | Can change session>
<Permission: auth | permission | Can add permission>
Only the third part of each of these elements of the QuerySet after the pipe is found in the dictionaries from p.values() under 'name', eg 'Can add user'
What is the meaning of the first and second part of each of these?
python django django-1.11 django-permissions
Am new to Django, have been working on linking some permissions to groups and then adding users to those groups. Have managed some of that so far, but am stuck on understanding exactly what is going on with the permissions. Here is my attempt so far:
(Django-1.11.4-env) $ python manage.py shell
Python 3.6.7 (default, Oct 25 2018, 13:09:20)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import Permission
>>> p = Permission.objects.all()
then
>>> p.values
<bound method QuerySet.values of <QuerySet [<Permission: MyApp | user | Can add user>, <Permission: MyApp | user | Can write stuff.>, <Permission: MyApp | user | Can change user>, <Permission: MyApp | user | Can delete user>, <Permission: admin | log entry | Can add log entry>, <Permission: admin | log entry | Can change log entry>, <Permission: admin | log entry | Can delete log entry>, <Permission: auth | group | Can add group>, <Permission: auth | group | Can change group>, <Permission: auth | group | Can delete group>, <Permission: auth | permission | Can add permission>, <Permission: auth | permission | Can change permission>, <Permission: auth | permission | Can delete permission>, <Permission: contenttypes | content type | Can add content type>, <Permission: contenttypes | content type | Can change content type>, <Permission: contenttypes | content type | Can delete content type>, <Permission: sessions | session | Can add session>, <Permission: sessions | session | Can change session>, <Permission: sessions | session | Can delete session>]>>
then
>>> p.values()
<QuerySet [{'id': 16, 'name': 'Can add user', 'content_type_id': 6, 'codename': 'add_user'}, {'id': 19, 'name': 'Can write stuff.', 'content_type_id': 6, 'codename': 'can_write'}, {'id': 17, 'name': 'Can change user', 'content_type_id': 6, 'codename': 'change_user'}, {'id': 18, 'name': 'Can delete user', 'content_type_id': 6, 'codename': 'delete_user'}, {'id': 1, 'name': 'Can add log entry', 'content_type_id': 1, 'codename': 'add_logentry'}, {'id': 2, 'name': 'Can change log entry', 'content_type_id': 1, 'codename': 'change_logentry'}, {'id': 3, 'name': 'Can delete log entry', 'content_type_id': 1, 'codename': 'delete_logentry'}, {'id': 7, 'name': 'Can add group', 'content_type_id': 3, 'codename': 'add_group'}, {'id': 8, 'name': 'Can change group', 'content_type_id': 3, 'codename': 'change_group'}, {'id': 9, 'name': 'Can delete group', 'content_type_id': 3, 'codename': 'delete_group'}, {'id': 4, 'name': 'Can add permission', 'content_type_id': 2, 'codename': 'add_permission'}, {'id': 5, 'name': 'Can change permission', 'content_type_id': 2, 'codename': 'change_permission'}, {'id': 6, 'name': 'Can delete permission', 'content_type_id': 2, 'codename': 'delete_permission'}, {'id': 10, 'name': 'Can add content type', 'content_type_id': 4, 'codename': 'add_contenttype'}, {'id': 11, 'name': 'Can change content type', 'content_type_id': 4, 'codename': 'change_contenttype'}, {'id': 12, 'name': 'Can delete content type', 'content_type_id': 4, 'codename': 'delete_contenttype'}, {'id': 13, 'name': 'Can add session', 'content_type_id': 5, 'codename': 'add_session'}, {'id': 14, 'name': 'Can change session', 'content_type_id': 5, 'codename': 'change_session'}, {'id': 15, 'name': 'Can delete session', 'content_type_id': 5, 'codename': 'delete_session'}]>
Of all the permissions here, most of them were part of Django but the one with name 'Can write stuff.'
I added previously.
So the output of p.values() is relatively intuitive, each permission has a set of keys and values linked to it.
Am really stuck though on understanding the output of p.values
<Permission: MyApp | user | Can add user>
<Permission: admin | log entry | Can add log entry>
<Permission: contenttypes | content type | Can add content type>
<Permission: sessions | session | Can change session>
<Permission: auth | permission | Can add permission>
Only the third part of each of these elements of the QuerySet after the pipe is found in the dictionaries from p.values() under 'name', eg 'Can add user'
What is the meaning of the first and second part of each of these?
python django django-1.11 django-permissions
python django django-1.11 django-permissions
asked Nov 21 '18 at 15:57
cardamomcardamom
1,84111338
1,84111338
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the commanddjango-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.
– cardamom
Nov 21 '18 at 16:17
They're not built-in, you actually specified them yourself with the settingINSTALLED_APPS
in your settings.py file.
– dirkgroten
Nov 21 '18 at 16:38
And the spaces is just because that's theverbose_name
of the model that is printed here.
– dirkgroten
Nov 21 '18 at 16:43
Thanks, can see that in thereINSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there fromdjango-admin startproject myproject
anddjango-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.
– cardamom
Nov 21 '18 at 17:01
add a comment |
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the commanddjango-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.
– cardamom
Nov 21 '18 at 16:17
They're not built-in, you actually specified them yourself with the settingINSTALLED_APPS
in your settings.py file.
– dirkgroten
Nov 21 '18 at 16:38
And the spaces is just because that's theverbose_name
of the model that is printed here.
– dirkgroten
Nov 21 '18 at 16:43
Thanks, can see that in thereINSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there fromdjango-admin startproject myproject
anddjango-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.
– cardamom
Nov 21 '18 at 17:01
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the command
django-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.– cardamom
Nov 21 '18 at 16:17
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the command
django-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.– cardamom
Nov 21 '18 at 16:17
They're not built-in, you actually specified them yourself with the setting
INSTALLED_APPS
in your settings.py file.– dirkgroten
Nov 21 '18 at 16:38
They're not built-in, you actually specified them yourself with the setting
INSTALLED_APPS
in your settings.py file.– dirkgroten
Nov 21 '18 at 16:38
And the spaces is just because that's the
verbose_name
of the model that is printed here.– dirkgroten
Nov 21 '18 at 16:43
And the spaces is just because that's the
verbose_name
of the model that is printed here.– dirkgroten
Nov 21 '18 at 16:43
Thanks, can see that in there
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there from django-admin startproject myproject
and django-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.– cardamom
Nov 21 '18 at 17:01
Thanks, can see that in there
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there from django-admin startproject myproject
and django-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.– cardamom
Nov 21 '18 at 17:01
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415912%2funderstanding-queryset-of-django-permissions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415912%2funderstanding-queryset-of-django-permissions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm not sure why it is not obvious to you that those are the app and the model name, but if you really couldn't work it out you could always look at the code.
– Daniel Roseman
Nov 21 '18 at 16:06
Thanks, that would mean some model names have a space in them, eg "log entry". I thought the only 'app' Django had was the one you made when you gave it the command
django-admin startapp MyApp
but now am learning, just like the models, a number of 'apps' are probably already built in.– cardamom
Nov 21 '18 at 16:17
They're not built-in, you actually specified them yourself with the setting
INSTALLED_APPS
in your settings.py file.– dirkgroten
Nov 21 '18 at 16:38
And the spaces is just because that's the
verbose_name
of the model that is printed here.– dirkgroten
Nov 21 '18 at 16:43
Thanks, can see that in there
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'MyApp' ]
They somehow got in there fromdjango-admin startproject myproject
anddjango-admin startapp MyApp
I think I added 'MyApp' manually. Thanks, is getting clearer what is going on.– cardamom
Nov 21 '18 at 17:01