mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Tests actually work again
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
import pytest
|
|
||||||
from django.core.management import call_command
|
|
||||||
from django.template.defaultfilters import striptags
|
|
||||||
from django.urls.exceptions import NoReverseMatch
|
|
||||||
|
|
||||||
from RIGS.models import Event
|
|
||||||
from assets.models import Asset
|
|
||||||
from django.db import connection
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("command", ['generateSampleAssetsData', 'generateSampleRIGSData', 'generateSampleUserData',
|
|
||||||
'deleteSampleData'])
|
|
||||||
def test_production_exception(command):
|
|
||||||
from django.core.management.base import CommandError
|
|
||||||
with pytest.raises(CommandError, match=".*production"):
|
|
||||||
call_command(command)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
|
||||||
def test_sample_data(settings):
|
|
||||||
settings.DEBUG = True
|
|
||||||
call_command('generateSampleData')
|
|
||||||
assert Asset.objects.all().count() > 50
|
|
||||||
assert Event.objects.all().count() > 100
|
|
||||||
call_command('deleteSampleData')
|
|
||||||
assert Asset.objects.all().count() == 0
|
|
||||||
assert Event.objects.all().count() == 0
|
|
||||||
@@ -11,6 +11,16 @@ from PyRIGS import urls
|
|||||||
from RIGS.models import Event
|
from RIGS.models import Event
|
||||||
from assets.models import Asset
|
from assets.models import Asset
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
import pytest
|
||||||
|
from django.core.management import call_command
|
||||||
|
from django.template.defaultfilters import striptags
|
||||||
|
from django.urls.exceptions import NoReverseMatch
|
||||||
|
|
||||||
|
from RIGS.models import Event
|
||||||
|
from assets.models import Asset
|
||||||
|
from django.db import connection
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
|
|
||||||
def find_urls_recursive(patterns):
|
def find_urls_recursive(patterns):
|
||||||
@@ -38,95 +48,99 @@ def get_request_url(url):
|
|||||||
print("Couldn't test url " + pattern)
|
print("Couldn't test url " + pattern)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='module', autouse=True)
|
@pytest.mark.parametrize("command", ['generateSampleAssetsData', 'generateSampleRIGSData', 'generateSampleUserData',
|
||||||
def sample_data(django_db_blocker):
|
'deleteSampleData'])
|
||||||
with django_db_blocker.unblock():
|
def test_production_exception(command):
|
||||||
from django.conf import settings
|
from django.core.management.base import CommandError
|
||||||
settings.DEBUG = True
|
with pytest.raises(CommandError, match=".*production"):
|
||||||
|
call_command(command)
|
||||||
|
|
||||||
|
|
||||||
|
class TestSampleDataGenerator(TestCase):
|
||||||
|
@override_settings(DEBUG=True)
|
||||||
|
def test_sample_data(self):
|
||||||
call_command('generateSampleData')
|
call_command('generateSampleData')
|
||||||
assert Asset.objects.all().count() > 50
|
assert Asset.objects.all().count() > 50
|
||||||
assert Event.objects.all().count() > 100
|
assert Event.objects.all().count() > 100
|
||||||
settings.DEBUG = False
|
call_command('deleteSampleData')
|
||||||
|
assert Asset.objects.all().count() == 0
|
||||||
|
assert Event.objects.all().count() == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
class TestSampleDataGenerator(TestCase):
|
||||||
def test_unauthenticated(client): # Nothing should be available to the unauthenticated
|
@override_settings(DEBUG=True)
|
||||||
for url in find_urls_recursive(urls.urlpatterns):
|
def setUp(self):
|
||||||
request_url = get_request_url(url)
|
call_command('generateSampleData')
|
||||||
if request_url and 'user' not in request_url: # User module is full of edge cases
|
|
||||||
response = client.get(request_url, follow=True, HTTP_HOST='example.com')
|
def test_unauthenticated(self): # Nothing should be available to the unauthenticated
|
||||||
assertContains(response, 'Login')
|
for url in find_urls_recursive(urls.urlpatterns):
|
||||||
if 'application/json+oembed' in response.content.decode():
|
request_url = get_request_url(url)
|
||||||
assertTemplateUsed(response, 'login_redirect.html')
|
if request_url and 'user' not in request_url: # User module is full of edge cases
|
||||||
else:
|
response = self.client.get(request_url, follow=True, HTTP_HOST='example.com')
|
||||||
if "embed" in str(url):
|
assertContains(response, 'Login')
|
||||||
expected_url = "{0}?next={1}".format(reverse('login_embed'), request_url)
|
if 'application/json+oembed' in response.content.decode():
|
||||||
|
assertTemplateUsed(response, 'login_redirect.html')
|
||||||
else:
|
else:
|
||||||
expected_url = "{0}?next={1}".format(reverse('login'), request_url)
|
if "embed" in str(url):
|
||||||
assertRedirects(response, expected_url)
|
expected_url = "{0}?next={1}".format(reverse('login_embed'), request_url)
|
||||||
|
else:
|
||||||
|
expected_url = "{0}?next={1}".format(reverse('login'), request_url)
|
||||||
|
assertRedirects(response, expected_url)
|
||||||
|
|
||||||
|
def test_page_titles(self):
|
||||||
|
assert self.client.login(username='superuser', password='superuser')
|
||||||
|
for url in filter((lambda u: "embed" not in u.name), find_urls_recursive(urls.urlpatterns)):
|
||||||
|
request_url = get_request_url(url)
|
||||||
|
response = self.client.get(request_url)
|
||||||
|
if hasattr(response, "context_data") and "page_title" in response.context_data:
|
||||||
|
expected_title = striptags(response.context_data["page_title"])
|
||||||
|
assertInHTML('<title>{} | Rig Information Gathering System'.format(expected_title),
|
||||||
|
response.content.decode())
|
||||||
|
print("{} | {}".format(request_url, expected_title)) # If test fails, tell me where!
|
||||||
|
self.client.logout()
|
||||||
|
|
||||||
@pytest.mark.django_db
|
def test_basic_access(self):
|
||||||
def test_page_titles(admin_client):
|
assert self.client.login(username="basic", password="basic")
|
||||||
for url in filter((lambda u: "embed" not in u.name), find_urls_recursive(urls.urlpatterns)):
|
|
||||||
request_url = get_request_url(url)
|
|
||||||
response = admin_client.get(request_url)
|
|
||||||
if hasattr(response, "context_data") and "page_title" in response.context_data:
|
|
||||||
expected_title = striptags(response.context_data["page_title"])
|
|
||||||
# try:
|
|
||||||
assertInHTML('<title>{} | Rig Information Gathering System'.format(expected_title),
|
|
||||||
response.content.decode())
|
|
||||||
print("{} | {}".format(request_url, expected_title)) # If test fails, tell me where!
|
|
||||||
# except:
|
|
||||||
# print(response.content.decode(), file=open('output.html', 'w'))
|
|
||||||
|
|
||||||
|
url = reverse('asset_list')
|
||||||
|
response = self.client.get(url)
|
||||||
|
# Check edit and duplicate buttons NOT shown in list
|
||||||
|
assertNotContains(response, 'Edit')
|
||||||
|
assertNotContains(response,
|
||||||
|
'Duplicate') # If this line is randomly failing, check the debug toolbar HTML hasn't crept in
|
||||||
|
|
||||||
@pytest.mark.django_db
|
url = reverse('asset_detail', kwargs={'pk': Asset.objects.first().asset_id})
|
||||||
def test_basic_access(client):
|
response = self.client.get(url)
|
||||||
client.logout()
|
assertNotContains(response, 'Purchase Details')
|
||||||
assert client.login(username="basic", password="basic")
|
assertNotContains(response, 'View Revision History')
|
||||||
|
|
||||||
url = reverse('asset_list')
|
urlz = {'asset_history', 'asset_update', 'asset_duplicate'}
|
||||||
response = client.get(url)
|
for url_name in urlz:
|
||||||
# Check edit and duplicate buttons NOT shown in list
|
request_url = reverse(url_name, kwargs={'pk': Asset.objects.first().asset_id})
|
||||||
assertNotContains(response, 'Edit')
|
response = self.client.get(request_url, follow=True)
|
||||||
assertNotContains(response,
|
assert response.status_code == 403
|
||||||
'Duplicate') # If this line is randomly failing, check the debug toolbar HTML hasn't crept in
|
|
||||||
|
|
||||||
url = reverse('asset_detail', kwargs={'pk': Asset.objects.first().pk})
|
request_url = reverse('supplier_create')
|
||||||
response = client.get(url)
|
response = self.client.get(request_url, follow=True)
|
||||||
assertNotContains(response, 'Purchase Details')
|
|
||||||
assertNotContains(response, 'View Revision History')
|
|
||||||
|
|
||||||
urlz = {'asset_history', 'asset_update', 'asset_duplicate'}
|
|
||||||
for url_name in urlz:
|
|
||||||
request_url = reverse(url_name, kwargs={'pk': Asset.objects.first().pk})
|
|
||||||
response = client.get(request_url, follow=True)
|
|
||||||
assert response.status_code == 403
|
assert response.status_code == 403
|
||||||
|
|
||||||
request_url = reverse('supplier_create')
|
request_url = reverse('supplier_update', kwargs={'pk': 1})
|
||||||
response = client.get(request_url, follow=True)
|
response = self.client.get(request_url, follow=True)
|
||||||
assert response.status_code == 403
|
assert response.status_code == 403
|
||||||
|
self.client.logout()
|
||||||
request_url = reverse('supplier_update', kwargs={'pk': 1})
|
|
||||||
response = client.get(request_url, follow=True)
|
|
||||||
assert response.status_code == 403
|
|
||||||
client.logout()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
def test_keyholder_access(self):
|
||||||
def test_keyholder_access(client):
|
assert self.client.login(username="keyholder", password="keyholder")
|
||||||
client.logout()
|
|
||||||
assert client.login(username="keyholder", password="keyholder")
|
|
||||||
|
|
||||||
url = reverse('asset_list')
|
url = reverse('asset_list')
|
||||||
response = client.get(url)
|
response = self.client.get(url)
|
||||||
# Check edit and duplicate buttons shown in list
|
# Check edit and duplicate buttons shown in list
|
||||||
assertContains(response, 'Edit')
|
assertContains(response, 'Edit')
|
||||||
assertContains(response, 'Duplicate')
|
assertContains(response, 'Duplicate')
|
||||||
|
|
||||||
url = reverse('asset_detail', kwargs={'pk': Asset.objects.first().pk})
|
url = reverse('asset_detail', kwargs={'pk': Asset.objects.first().asset_id})
|
||||||
response = client.get(url)
|
response = self.client.get(url)
|
||||||
assertContains(response, 'Purchase Details')
|
assertContains(response, 'Purchase Details')
|
||||||
assertContains(response, 'View Revision History')
|
assertContains(response, 'View Revision History')
|
||||||
client.logout()
|
self.client.logout()
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
models.VatRate.objects.create(start_at='2014-03-05', rate=0.20, comment='test1')
|
models.VatRate.objects.create(start_at='2014-03-05', rate=0.20, comment='test1')
|
||||||
|
|
||||||
self.setup_people()
|
self.setup_people()
|
||||||
self.setup_organisations()
|
self.setup_organisations()
|
||||||
self.setup_venues()
|
self.setup_venues()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from reversion import revisions as reversion
|
|||||||
|
|
||||||
from RIGS import models as rigsmodels
|
from RIGS import models as rigsmodels
|
||||||
from assets import models
|
from assets import models
|
||||||
|
from assets.models import get_available_asset_id
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@@ -34,6 +35,11 @@ class Command(BaseCommand):
|
|||||||
self.create_connectors()
|
self.create_connectors()
|
||||||
self.create_cables()
|
self.create_cables()
|
||||||
|
|
||||||
|
def create_categories(self):
|
||||||
|
choices = ['Case', 'Video', 'General', 'Sound', 'Lighting', 'Rigging']
|
||||||
|
for cat in choices:
|
||||||
|
self.categories.append(models.AssetCategory.objects.create(name=cat))
|
||||||
|
|
||||||
def create_statuses(self):
|
def create_statuses(self):
|
||||||
choices = [('In Service', True, 'success'), ('Lost', False, 'warning'), ('Binned', False, 'danger'), ('Sold', False, 'danger'), ('Broken', False, 'warning')]
|
choices = [('In Service', True, 'success'), ('Lost', False, 'warning'), ('Binned', False, 'danger'), ('Sold', False, 'danger'), ('Broken', False, 'warning')]
|
||||||
for stat in choices:
|
for stat in choices:
|
||||||
@@ -42,24 +48,18 @@ class Command(BaseCommand):
|
|||||||
def create_suppliers(self):
|
def create_suppliers(self):
|
||||||
choices = ["Acme, inc.", "Widget Corp", "123 Warehousing", "Demo Company", "Smith and Co.", "Foo Bars", "ABC Telecom", "Fake Brothers", "QWERTY Logistics", "Demo, inc.", "Sample Company", "Sample, inc", "Acme Corp", "Allied Biscuit", "Ankh-Sto Associates", "Extensive Enterprise", "Galaxy Corp", "Globo-Chem", "Mr. Sparkle", "Globex Corporation", "LexCorp", "LuthorCorp", "North Central Positronics", "Omni Consimer Products", "Praxis Corporation", "Sombra Corporation", "Sto Plains Holdings", "Tessier-Ashpool", "Wayne Enterprises", "Wentworth Industries", "ZiffCorp", "Bluth Company", "Strickland Propane", "Thatherton Fuels", "Three Waters", "Water and Power", "Western Gas & Electric", "Mammoth Pictures", "Mooby Corp", "Gringotts", "Thrift Bank", "Flowers By Irene", "The Legitimate Businessmens Club", "Osato Chemicals", "Transworld Consortium", "Universal Export", "United Fried Chicken", "Virtucon", "Kumatsu Motors", "Keedsler Motors", "Powell Motors", "Industrial Automation", "Sirius Cybernetics Corporation", "U.S. Robotics and Mechanical Men", "Colonial Movers", "Corellian Engineering Corporation", "Incom Corporation", "General Products", "Leeding Engines Ltd.", "Blammo", # noqa
|
choices = ["Acme, inc.", "Widget Corp", "123 Warehousing", "Demo Company", "Smith and Co.", "Foo Bars", "ABC Telecom", "Fake Brothers", "QWERTY Logistics", "Demo, inc.", "Sample Company", "Sample, inc", "Acme Corp", "Allied Biscuit", "Ankh-Sto Associates", "Extensive Enterprise", "Galaxy Corp", "Globo-Chem", "Mr. Sparkle", "Globex Corporation", "LexCorp", "LuthorCorp", "North Central Positronics", "Omni Consimer Products", "Praxis Corporation", "Sombra Corporation", "Sto Plains Holdings", "Tessier-Ashpool", "Wayne Enterprises", "Wentworth Industries", "ZiffCorp", "Bluth Company", "Strickland Propane", "Thatherton Fuels", "Three Waters", "Water and Power", "Western Gas & Electric", "Mammoth Pictures", "Mooby Corp", "Gringotts", "Thrift Bank", "Flowers By Irene", "The Legitimate Businessmens Club", "Osato Chemicals", "Transworld Consortium", "Universal Export", "United Fried Chicken", "Virtucon", "Kumatsu Motors", "Keedsler Motors", "Powell Motors", "Industrial Automation", "Sirius Cybernetics Corporation", "U.S. Robotics and Mechanical Men", "Colonial Movers", "Corellian Engineering Corporation", "Incom Corporation", "General Products", "Leeding Engines Ltd.", "Blammo", # noqa
|
||||||
"Input, Inc.", "Mainway Toys", "Videlectrix", "Zevo Toys", "Ajax", "Axis Chemical Co.", "Barrytron", "Carrys Candles", "Cogswell Cogs", "Spacely Sprockets", "General Forge and Foundry", "Duff Brewing Company", "Dunder Mifflin", "General Services Corporation", "Monarch Playing Card Co.", "Krustyco", "Initech", "Roboto Industries", "Primatech", "Sonky Rubber Goods", "St. Anky Beer", "Stay Puft Corporation", "Vandelay Industries", "Wernham Hogg", "Gadgetron", "Burleigh and Stronginthearm", "BLAND Corporation", "Nordyne Defense Dynamics", "Petrox Oil Company", "Roxxon", "McMahon and Tate", "Sixty Second Avenue", "Charles Townsend Agency", "Spade and Archer", "Megadodo Publications", "Rouster and Sideways", "C.H. Lavatory and Sons", "Globo Gym American Corp", "The New Firm", "SpringShield", "Compuglobalhypermeganet", "Data Systems", "Gizmonic Institute", "Initrode", "Taggart Transcontinental", "Atlantic Northern", "Niagular", "Plow King", "Big Kahuna Burger", "Big T Burgers and Fries", "Chez Quis", "Chotchkies", "The Frying Dutchman", "Klimpys", "The Krusty Krab", "Monks Diner", "Milliways", "Minuteman Cafe", "Taco Grande", "Tip Top Cafe", "Moes Tavern", "Central Perk", "Chasers"] # noqa
|
"Input, Inc.", "Mainway Toys", "Videlectrix", "Zevo Toys", "Ajax", "Axis Chemical Co.", "Barrytron", "Carrys Candles", "Cogswell Cogs", "Spacely Sprockets", "General Forge and Foundry", "Duff Brewing Company", "Dunder Mifflin", "General Services Corporation", "Monarch Playing Card Co.", "Krustyco", "Initech", "Roboto Industries", "Primatech", "Sonky Rubber Goods", "St. Anky Beer", "Stay Puft Corporation", "Vandelay Industries", "Wernham Hogg", "Gadgetron", "Burleigh and Stronginthearm", "BLAND Corporation", "Nordyne Defense Dynamics", "Petrox Oil Company", "Roxxon", "McMahon and Tate", "Sixty Second Avenue", "Charles Townsend Agency", "Spade and Archer", "Megadodo Publications", "Rouster and Sideways", "C.H. Lavatory and Sons", "Globo Gym American Corp", "The New Firm", "SpringShield", "Compuglobalhypermeganet", "Data Systems", "Gizmonic Institute", "Initrode", "Taggart Transcontinental", "Atlantic Northern", "Niagular", "Plow King", "Big Kahuna Burger", "Big T Burgers and Fries", "Chez Quis", "Chotchkies", "The Frying Dutchman", "Klimpys", "The Krusty Krab", "Monks Diner", "Milliways", "Minuteman Cafe", "Taco Grande", "Tip Top Cafe", "Moes Tavern", "Central Perk", "Chasers"] # noqa
|
||||||
pk = 1
|
|
||||||
for supplier in choices:
|
for supplier in choices:
|
||||||
self.suppliers.append(models.Supplier.objects.create(name=supplier))
|
self.suppliers.append(models.Supplier.objects.create(name=supplier))
|
||||||
pk += 1
|
|
||||||
|
|
||||||
def create_categories(self):
|
|
||||||
choices = ['Case', 'Video', 'General', 'Sound', 'Lighting', 'Rigging']
|
|
||||||
for cat in choices:
|
|
||||||
self.categories.append(models.AssetCategory.objects.create(name=cat))
|
|
||||||
|
|
||||||
def create_assets(self):
|
def create_assets(self):
|
||||||
asset_description = ['Large cable', 'Shiny thing', 'New lights', 'Really expensive microphone', 'Box of fuse flaps', 'Expensive tool we didn\'t agree to buy', 'Cable drums', 'Boring amount of tape', 'Video stuff no one knows how to use', 'More amplifiers', 'Heatshrink']
|
asset_description = ['Large cable', 'Shiny thing', 'New lights', 'Really expensive microphone', 'Box of fuse flaps', 'Expensive tool we didn\'t agree to buy', 'Cable drums', 'Boring amount of tape', 'Video stuff no one knows how to use', 'More amplifiers', 'Heatshrink']
|
||||||
|
|
||||||
with reversion.create_revision():
|
for i in range(100):
|
||||||
for i in range(100):
|
with reversion.create_revision():
|
||||||
reversion.set_user(random.choice(rigsmodels.Profile.objects.all()))
|
reversion.set_user(random.choice(rigsmodels.Profile.objects.all()))
|
||||||
|
asset_id = str(get_available_asset_id())
|
||||||
asset = models.Asset(
|
asset = models.Asset(
|
||||||
asset_id='{}'.format(get_available_asset_id()),
|
asset_id=asset_id,
|
||||||
description=random.choice(asset_description),
|
description=random.choice(asset_description),
|
||||||
category=random.choice(self.categories),
|
category=random.choice(self.categories),
|
||||||
status=random.choice(self.statuses),
|
status=random.choice(self.statuses),
|
||||||
@@ -70,7 +70,8 @@ class Command(BaseCommand):
|
|||||||
asset.parent = models.Asset.objects.order_by('?').first()
|
asset.parent = models.Asset.objects.order_by('?').first()
|
||||||
|
|
||||||
if i % 3 == 0:
|
if i % 3 == 0:
|
||||||
asset.purchased_from = random.choice(suppliers)
|
asset.purchased_from = random.choice(self.suppliers)
|
||||||
|
|
||||||
asset.clean()
|
asset.clean()
|
||||||
asset.save()
|
asset.save()
|
||||||
|
|
||||||
@@ -96,12 +97,15 @@ class Command(BaseCommand):
|
|||||||
circuits = [1, 2, 3, 6]
|
circuits = [1, 2, 3, 6]
|
||||||
types = []
|
types = []
|
||||||
|
|
||||||
for i in range(len(connectors)):
|
for i in range(len(self.connectors)):
|
||||||
types.append(models.CableType.objects.create(plug=random.choice(self.connectors), socket=random.choice(self.connectors), circuits=random.choice(circuits), cores=random.choice(cores)))
|
types.append(models.CableType.objects.create(plug=random.choice(self.connectors), socket=random.choice(self.connectors), circuits=random.choice(circuits), cores=random.choice(cores)))
|
||||||
|
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
|
prefix = random.choice(asset_prefixes)
|
||||||
|
asset_id = str(get_available_asset_id(wanted_prefix=prefix))
|
||||||
|
asset_id = prefix + asset_id
|
||||||
asset = models.Asset(
|
asset = models.Asset(
|
||||||
asset_id='{}'.format(get_available_asset_id()),
|
asset_id=asset_id,
|
||||||
description=random.choice(asset_description),
|
description=random.choice(asset_description),
|
||||||
category=random.choice(self.categories),
|
category=random.choice(self.categories),
|
||||||
status=random.choice(self.statuses),
|
status=random.choice(self.statuses),
|
||||||
@@ -113,15 +117,11 @@ class Command(BaseCommand):
|
|||||||
length=random.choice(lengths),
|
length=random.choice(lengths),
|
||||||
)
|
)
|
||||||
|
|
||||||
if i % 5 == 0:
|
|
||||||
prefix = random.choice(asset_prefixes)
|
|
||||||
asset.asset_id = prefix + str(get_available_asset_id(wanted_prefix=prefix))
|
|
||||||
|
|
||||||
if i % 4 == 0:
|
if i % 4 == 0:
|
||||||
asset.parent = models.Asset.objects.order_by('?').first()
|
asset.parent = models.Asset.objects.order_by('?').first()
|
||||||
|
|
||||||
if i % 3 == 0:
|
if i % 3 == 0:
|
||||||
asset.purchased_from = random.choice(suppliers)
|
asset.purchased_from = random.choice(self.suppliers)
|
||||||
|
|
||||||
asset.clean()
|
asset.clean()
|
||||||
asset.save()
|
asset.save()
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ def pytest_configure():
|
|||||||
settings.PASSWORD_HASHERS = (
|
settings.PASSWORD_HASHERS = (
|
||||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||||
)
|
)
|
||||||
settings.STATICFILES_DIRS.append('static/') # FIXME
|
settings.WHITENOISE_USE_FINDERS = True
|
||||||
|
settings.WHITENOISE_AUTOREFRESH = True
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ class Command(BaseCommand):
|
|||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
self.setup_groups()
|
self.setup_groups()
|
||||||
self.setup_useful_profiles()
|
self.setup_useful_profiles()
|
||||||
|
self.setup_generic_profiles()
|
||||||
# self.setup_generic_profiles()
|
|
||||||
# models.Profile.objects.bulk_create(self.profiles)
|
|
||||||
|
|
||||||
def setup_groups(self):
|
def setup_groups(self):
|
||||||
self.keyholder_group = Group.objects.create(name='Keyholders')
|
self.keyholder_group = Group.objects.create(name='Keyholders')
|
||||||
|
|||||||
Reference in New Issue
Block a user