mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Update management commands to assist with development
This commit is contained in:
parent
75b320749d
commit
3c06baa684
2 changed files with 15 additions and 1 deletions
15
apps/profile/management/commands/remove_last_user.py
Normal file
15
apps/profile/management/commands/remove_last_user.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
# this command helps with development. It removes the last created user
|
||||
# in case there was a problem with creating a user and profile manually.
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from apps.profile.models import Profile
|
||||
class Command(BaseCommand):
|
||||
|
||||
def handle(self, *args, **options):
|
||||
user = User.objects.last()
|
||||
profile = Profile.objects.get(user=user)
|
||||
profile.delete()
|
||||
user.delete()
|
||||
print("User and profile for user {0} deleted".format(user))
|
|
@ -20,4 +20,3 @@ class Command(BaseCommand):
|
|||
print("User {0} created".format(username))
|
||||
|
||||
_create(settings.HOMEPAGE_USERNAME)
|
||||
_create('popular')
|
||||
|
|
Loading…
Add table
Reference in a new issue