diff options
Diffstat (limited to 'servo')
-rwxr-xr-x | servo/management/commands/cron.py | 7 | ||||
-rw-r--r-- | servo/views/admin.py | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/servo/management/commands/cron.py b/servo/management/commands/cron.py index e2831e9..519cbb4 100755 --- a/servo/management/commands/cron.py +++ b/servo/management/commands/cron.py @@ -92,9 +92,8 @@ class Command(BaseCommand): now = timezone.now() limit = now - timedelta(days=1) - locations = Location.objects.filter(site_id=settings.SITE_ID) - for l in locations: + for l in Location.objects.filter(enabled=True): table = CsvTable() table.addheader(['Order', 'Assigned To', 'Status', 'Days red']) @@ -126,9 +125,7 @@ class Command(BaseCommand): except KeyError: raise ValueError('Default sender address not defined') - locations = Location.objects.filter(site_id=settings.SITE_ID) - - for l in locations: + for l in Location.objects.filter(enabled=True): out_of_stock = Inventory.objects.filter( location=l, amount_stocked__lt=F('amount_minimum') diff --git a/servo/views/admin.py b/servo/views/admin.py index 91f73a9..7d7757e 100644 --- a/servo/views/admin.py +++ b/servo/views/admin.py @@ -505,13 +505,12 @@ def create_user_token(request, user_id): @staff_member_required def edit_user(request, pk=None): if pk is None: - user = User(site_id=app_settings.SITE_ID) - user.location = request.user.location + user = User(location=request.user.location) user.locale = request.user.locale user.region = request.user.region user.timezone = request.user.timezone else: - user = User.objects.get(pk=pk) + user = get_object_or_404(User, pk=pk) form = UserForm(instance=user) |