def retailerInventory(request, template_name='retailer.html'): if (request.user.is_superuser): return HttpResponseRedirect('/retrospecsAccounts/') maps_view = False viewableInventory = (getAccess(request.user.username)).split(',') viewableInventory.pop() #the last entry in viewableInventory is null, and we gotta get rid of it allGlasses = Glasses.objects.filter(account_id__in=viewableInventory).order_by('account_id', 'map_num') dictionary={'glasses': allGlasses, 'maps_view': maps_view} return render_to_response('retailer.html', dictionary, context_instance=RequestContext(request))
def retailerMaps(request, template_name='retailer.html'): if (request.user.is_superuser): return HttpResponseRedirect('/retrospecsAccounts/') maps_view = True #allMaps = Maps.objects.filter(company_name__startswith=request.user.username) viewableAccounts = (getAccess(request.user.username)).split(',') viewableAccounts.pop() allMaps = Maps.objects.filter(pk__in=viewableAccounts).order_by('account_num') dictionary={'maps': allMaps, 'maps_view': maps_view} return render_to_response('retailer.html', dictionary, context_instance=RequestContext(request))
def test_methods(arg): if arg == "dbfill": import testdbinfo testdbinfo.populate_db() elif arg == "acc": from LOG import accountAccess accountAccess.setAccess('vall', '6') accountAccess.setAccess('vall', '10') accountAccess.setAccess('vall', '20') elif arg == "getacc": from LOG import accountAccess array = accountAccess.getAccess('vall') work = array.split(',') print work elif arg == "delacc": from LOG import accountAccess accountAccess.removeAcess('vall', '20') elif arg == "addGlasses": from INV import addGlasses from LOG import insertRegions from MAP import addMapAcc insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv") addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False) addGlasses.addGlasses(Maps.objects.get(account_num = 2),2,45,'g','Francis','Clr',42,21,'CC','NA') addGlasses.addGlasses(Maps.objects.get(account_num = 1),1,45,'g','Francis','Clr',42,21,'CC','NA') addGlasses.addGlasses(Maps.objects.get(account_num = 1),2,44,'ng','Francis','Clr',42,22,'CC','NA') elif arg == "deleteGlasses": from INV import deleteGlasses deleteGlasses.deleteGlasses(1,1) elif arg == "addItemToMap": from INV import addItemToMap from LOG import insertRegions from MAP import addMapAcc insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv") addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False) addItemToMap.addItemToMap(-1,"SampleGlassesInv.csv") elif arg == "deleteItemFromMap": from INV import deleteItemFromMap from LOG import insertRegions from MAP import addMapAcc insertRegions.insertIntoDb("../teamwait/LOG/regionData.csv") addMapAcc.insertIntoDb("../teamwait/MAP/MapAccounts.csv", False) deleteItemFromMap.deleteItemFromMap(1,"sample.csv") # elif arg == "addMap" #addMap test code here elif arg == "modifyItemStatus": from INV import modifyItemStatus modifyItemStatus.modifyItemStatus(1, 1, "reorder") elif arg == "exportToCSV": from INV import exportToCSV import os exportToCSV.exportToCSV('val') elif arg == "InitializeToUnsold": from INV import changeStatus changeStatus.initializeToUnsold(1) elif arg == "changeStatus": from INV import changeStatus changeStatus.changeStatus(1,1,23,"sold") elif arg == "addDateOfSale": from INV import addDateOfSale addDateOfSale.addDateOfSale(1,1,23,'2003-12-12') elif arg == "retailerAddRegNum": from INV import retailerRegNum retailerRegNum.rAddRegNum(2, 1, 1234) retailerRegNum.rAddRegNum(1, 1, 1234) print 'There should be an error above about duplicate reg numbers' elif arg == "retailerEditRegNum": from INV import retailerRegNum retailerRegNum.rAddRegNum(1, 1, 9876) retailerRegNum.rEditRegNum(1,1,9876,80085) retailerRegNum.rEditRegNum(1,1,1111111,80085) print 'There should be an error in the console above this about incorrect reg number'