本文整理汇总了Python中polls.models.Wares.deletethis方法的典型用法代码示例。如果您正苦于以下问题:Python Wares.deletethis方法的具体用法?Python Wares.deletethis怎么用?Python Wares.deletethis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polls.models.Wares
的用法示例。
在下文中一共展示了Wares.deletethis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Waresdeletehistory
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_Waresdeletehistory(self):
self.assertEqual(len(Waresdeletehistory.objects.all()) == 0, True)
Wares.insert("Carlsberg")
try:
Wares.insert("Carlsberg")
except Alreadymade:
pass
Wares.insert("Carlsberg Light")
Wares.insert("Yankeebar")
Wares.insert("Haribo Clickmix")
Wares.insert("Mokai")
Wares.insert("Heineken")
Wares.insert("Tuborg")
Wares.deletethis(1)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.setwarename(2, "Carlsberg xtreme")
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.getthis(2)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.getopeningwares()
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.getstdprice(2)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.setwareinbar(2,10)
Wares.setwareinbar(2,20)
Wares.setwareinbar(3,11)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.setwareinstockroom(3,300)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.setstandardprice(2,1)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 1, True)
Wares.deletethis(5)
self.assertEqual(len(Waresdeletehistory.objects.all()) == 2, True)
示例2: waredelete
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def waredelete(request, wares_id):
ware = Wares.getthis(wares_id)
message = []
if "slet" in request.POST:
Wares.deletethis(ware.id)
message.append("Varen er nu slettet. Oplysninger om varen ligger stadigt gemt i historikken")
return render(request, 'polls/slet_vare.html', {'message': message, 'ware': ware})
示例3: test_Waresnamehistory1
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_Waresnamehistory1(self):
self.assertEqual(len(Waresnamehistory.objects.all().filter(warename="Carlsberg")) == 0, True)
self.assertEqual(len(Waresnamehistory.objects.all()) == 0, True)
Wares.insert("Carlsberg")
try:
Wares.insert("Carlsberg")
except Alreadymade:
pass
Wares.insert("Carlsberg Light")
Wares.insert("Yankeebar")
Wares.insert("Haribo Clickmix")
Wares.insert("Mokai")
Wares.insert("Heineken")
Wares.insert("Tuborg")
self.assertEqual(len(Waresnamehistory.objects.all().filter(warename="Carlsberg")) == 1, True)
self.assertEqual(len(Waresnamehistory.objects.all()) == 7, True)
Wares.setwarename(1, "Carlsberg xtreme")
Wares.setwarename(7, "Tuborg guld")
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.getthis(1)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.getopeningwares()
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.getstdprice(1)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.setwareinbar(1,10)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.setwareinstockroom(2,300)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.setstandardprice(1,1)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
Wares.deletethis(1)
self.assertEqual(len(Waresnamehistory.objects.all()) == 9, True)
示例4: test_removeware
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_removeware(self):
Wares.insert("Carslberg")
Wares.insert("Tuborg")
Wares.insert("Heineken")
self.assertEqual(len(Wares.objects.all()) == 3, True)
Wares.deletethis(1)
self.assertEqual(len(Wares.objects.all()) == 2, True)
Wares.insert("Carslberg")
Wares.deletethis(4)
示例5: test_deleteonrelations1
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_deleteonrelations1(self):
Wares.insert("Carlsberg")
Wares.insert("Tuborg")
Waregroups.insert("Luxusoeller")
Waregroups.insert("Basisoeller")
Waresingroup.insert(1,1)
Waresingroup.insert(1,2)
Waresingroup.insert(2,1)
Waresingroup.insert(2,2)
self.assertEqual(len(Waresingroup.objects.all()) == 4, True)
Wares.deletethis(1)
self.assertEqual(len(Waresingroup.objects.all()) == 2, True)
示例6: test_Waresnamehistory2
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_Waresnamehistory2(self):
Wares.insert("Carlsberg")
try:
Wares.insert("Carlsberg")
except Alreadymade:
pass
Wares.insert("Carlsberg Light")
Wares.insert("Yankeebar")
Wares.insert("Haribo Clickmix")
Wares.insert("Mokai")
Wares.insert("Heineken")
Wares.insert("Tuborg")
self.assertEqual(len(Waresnamehistory.objects.all().filter(warename="Carlsberg")) == 1, True)
self.assertEqual(len(Waresnamehistory.objects.all().filter(wareid=1)) == 1, True)
Wares.setwarename(1, "Carlsberg xtreme")
Wares.setwarename(7, "Tuborg guld")
self.assertEqual(len(Waresnamehistory.objects.all().filter(wareid=1)) == 2, True)
Wares.deletethis(1)
self.assertEqual(len(Waresnamehistory.objects.all().filter(wareid=1)) == 2, True)
示例7: test_Waresingroupdeletehistory
# 需要导入模块: from polls.models import Wares [as 别名]
# 或者: from polls.models.Wares import deletethis [as 别名]
def test_Waresingroupdeletehistory(self):
self.assertEqual(len(WINdeletehistory.objects.all()) == 0, True)
Wares.insert("Carlsberg")
try:
Wares.insert("Carlsberg")
except Alreadymade:
pass
Wares.insert("Carlsberg Light")
Wares.insert("Yankeebar")
Wares.insert("Haribo Clickmix")
Wares.insert("Mokai")
Wares.insert("Heineken")
Wares.insert("Tuborg")
Waregroups.insert("luksusøl")
Waregroups.insert("basisøl")
Waregroups.insert("eksotiske øl")
Waregroups.insert("slik")
Waregroups.insert("snack")
Waregroups.insert("sodavand")
Waregroups.insert("drikkevand")
Waregroups.insert("sprut")
self.assertEqual(len(WINdeletehistory.objects.all()) == 0, True)
Waresingroup.insert(1,1)
Waresingroup.insert(1,2)
Waresingroup.insert(1,3)
Waresingroup.insert(1,4)
Waresingroup.insert(2,5)
Waresingroup.insert(1,6)
self.assertEqual(len(WINdeletehistory.objects.all()) == 4, True)
Waresingroup.deletethis(1,6)
self.assertEqual(len(WINdeletehistory.objects.all()) == 5, True)
Wares.deletethis(1)
self.assertEqual(len(WINdeletehistory.objects.all()) == 5, True)
Wares.deletethis(2)
# Shows that Wares.delethis() cascade effect does not register here
self.assertEqual(len(WINdeletehistory.objects.all()) == 5, True)
self.assertEqual(len(Waresingroup.objects.all()) == 0, True)