Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-openid-auth
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-openid-auth
Commits
141eff63
Commit
141eff63
authored
Sep 01, 2014
by
Natalia Bidart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conditionally use transaction.autocommit when running migrations.
parent
56ab68fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
django_openid_auth/migrations/0002_add_perm_account_verified.py
+14
-8
example_consumer/settings.py
+5
-5
No files found.
django_openid_auth/migrations/0002_add_perm_account_verified.py
View file @
141eff63
...
@@ -2,19 +2,25 @@
...
@@ -2,19 +2,25 @@
from
south.utils
import
datetime_utils
as
datetime
from
south.utils
import
datetime_utils
as
datetime
from
south.db
import
db
from
south.db
import
db
from
south.v2
import
DataMigration
from
south.v2
import
DataMigration
from
django.db
import
models
,
transaction
from
django.db
import
connection
,
models
,
transaction
class
Migration
(
DataMigration
):
class
Migration
(
DataMigration
):
def
add_account_verified_permission
(
self
,
orm
):
ct
,
_
=
orm
[
'contenttypes.ContentType'
]
.
objects
.
get_or_create
(
model
=
'useropenid'
,
app_label
=
'django_openid_auth'
,
defaults
=
dict
(
name
=
'user open id'
))
perm
,
_
=
orm
[
'auth.permission'
]
.
objects
.
get_or_create
(
content_type
=
ct
,
codename
=
'account_verified'
,
defaults
=
dict
(
name
=
u'The OpenID account has been verified'
))
def
forwards
(
self
,
orm
):
def
forwards
(
self
,
orm
):
"Write your forwards methods here."
"Write your forwards methods here."
with
transaction
.
autocommit
():
if
connection
.
_savepoint_allowed
():
ct
,
_
=
orm
[
'contenttypes.ContentType'
]
.
objects
.
get_or_create
(
self
.
add_account_verified_permission
(
orm
)
model
=
'useropenid'
,
app_label
=
'django_openid_auth'
,
else
:
defaults
=
dict
(
name
=
'user open id'
))
with
transaction
.
autocommit
():
perm
,
_
=
orm
[
'auth.permission'
]
.
objects
.
get_or_create
(
self
.
add_account_verified_permission
(
orm
)
content_type
=
ct
,
codename
=
'account_verified'
,
defaults
=
dict
(
name
=
u'The OpenID account has been verified'
))
def
backwards
(
self
,
orm
):
def
backwards
(
self
,
orm
):
"Write your backwards methods here."
"Write your backwards methods here."
...
...
example_consumer/settings.py
View file @
141eff63
...
@@ -42,11 +42,11 @@ MANAGERS = ADMINS
...
@@ -42,11 +42,11 @@ MANAGERS = ADMINS
if
django_version
>=
"1.2"
:
if
django_version
>=
"1.2"
:
csrf_middleware
=
'django.middleware.csrf.CsrfViewMiddleware'
csrf_middleware
=
'django.middleware.csrf.CsrfViewMiddleware'
DATABASES
=
{
DATABASES
=
{
'default'
:
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
'sqlite.db'
'NAME'
:
'sqlite.db'
,
}
}
}
}
TEMPLATE_LOADERS
=
(
TEMPLATE_LOADERS
=
(
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.app_directories.Loader'
,
'django.template.loaders.app_directories.Loader'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment