Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343808
0005_remove_duplicated_authorized_origins.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
853 B
Subscribers
None
0005_remove_duplicated_authorized_origins.py
View Options
# Copyright (C) 2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from
__future__
import
unicode_literals
from
django.db
import
migrations
from
swh.web.common.models
import
SaveAuthorizedOrigin
def
_remove_duplicated_urls_in_authorized_list
(
apps
,
schema_editor
):
sao
=
SaveAuthorizedOrigin
.
objects
for
url
in
sao
.
values_list
(
"url"
,
flat
=
True
)
.
distinct
():
sao
.
filter
(
pk__in
=
sao
.
filter
(
url
=
url
)
.
values_list
(
"id"
,
flat
=
True
)[
1
:])
.
delete
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"swh_web_common"
,
"0004_auto_20190204_1324"
),
]
operations
=
[
migrations
.
RunPython
(
_remove_duplicated_urls_in_authorized_list
)]
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Fri, Jul 4, 1:52 PM (3 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240716
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment