forked from Kamva-Academy/Kamva-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- deleting dadbestan-name - renaming profile-pic
- Loading branch information
1 parent
dd47874
commit c1e4d1f
Showing
2 changed files
with
23 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from apps.widgets.models.other_widgets.button import ButtonWidget | ||
from apps.fsm.models.content_widgets import Placeholder | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Delete all ButtonWidgets with a specific destination_page_url.' | ||
help = 'Delete all Placeholder with a specific destination_page_url.' | ||
|
||
def handle(self, *args, **kwargs): | ||
url_to_delete = "https://ashbaria.sepid.org/program/ashbaria/" | ||
deleted_count, _ = ButtonWidget.objects.filter(destination_page_url=url_to_delete).delete() | ||
self.stdout.write(self.style.SUCCESS(f'Successfully deleted {deleted_count} ButtonWidgets with destination_page_url="{url_to_delete}"')) | ||
name = "dadbestan-name" | ||
deleted_count, _ = Placeholder.objects.filter(_object__name=name).delete() | ||
self.stdout.write(self.style.SUCCESS( | ||
f'Successfully deleted {deleted_count} Placeholder with destination_page_url="{name}"')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from apps.fsm.models.content_widgets import Placeholder | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Delete all Placeholder with a specific destination_page_url.' | ||
|
||
def handle(self, *args, **kwargs): | ||
name = "profile-pic" | ||
placeholders = Placeholder.objects.filter(_object__name=name) | ||
for placeholder in placeholders: | ||
placeholder._object.name = "ashbaria-my-profile" | ||
placeholder._object.save() | ||
self.stdout.write(self.style.SUCCESS( | ||
f'Successfully deleted Placeholder with destination_page_url="{name}"')) |