|
@@ -2424,9 +2424,11 @@ class Sell_New(ListView):
|
|
|
money = request.POST.get("money")
|
|
money = request.POST.get("money")
|
|
|
time = request.POST.get("time")
|
|
time = request.POST.get("time")
|
|
|
s_id = request.POST.get("id")
|
|
s_id = request.POST.get("id")
|
|
|
|
|
+ username = request.user.username
|
|
|
|
|
+
|
|
|
if s_id:
|
|
if s_id:
|
|
|
try:
|
|
try:
|
|
|
- farm_obj = FarmList.objects.get(name=farm)
|
|
|
|
|
|
|
+ farm_obj = FarmList.objects.get(name=farm,user=username)
|
|
|
sell_obj = Sell_Manage.objects.get(id=s_id)
|
|
sell_obj = Sell_Manage.objects.get(id=s_id)
|
|
|
sell_obj.farm = farm_obj
|
|
sell_obj.farm = farm_obj
|
|
|
sell_obj.name = name
|
|
sell_obj.name = name
|
|
@@ -2440,7 +2442,7 @@ class Sell_New(ListView):
|
|
|
data = "0"
|
|
data = "0"
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
|
- farm_obj = FarmList.objects.get(name=farm)
|
|
|
|
|
|
|
+ farm_obj = FarmList.objects.get(name=farm,user=username)
|
|
|
Sell_Manage.objects.create(farm=farm_obj,name=name,num=num,money=money,upl_time=time)
|
|
Sell_Manage.objects.create(farm=farm_obj,name=name,num=num,money=money,upl_time=time)
|
|
|
data = "1"
|
|
data = "1"
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
@@ -2479,6 +2481,7 @@ class CropCount(ListView):
|
|
|
def get(self,request):
|
|
def get(self,request):
|
|
|
return render(request, 'backstageNet/production/cropcount.html', context={})
|
|
return render(request, 'backstageNet/production/cropcount.html', context={})
|
|
|
def post(self,request):
|
|
def post(self,request):
|
|
|
|
|
+ username = request.user.username
|
|
|
crop_count = request.POST.get('crop_count')
|
|
crop_count = request.POST.get('crop_count')
|
|
|
area = request.POST.get('area')
|
|
area = request.POST.get('area')
|
|
|
crop_id = request.POST.get('id')
|
|
crop_id = request.POST.get('id')
|
|
@@ -2490,7 +2493,7 @@ class CropCount(ListView):
|
|
|
#修改
|
|
#修改
|
|
|
if crop_id:
|
|
if crop_id:
|
|
|
try:
|
|
try:
|
|
|
- crops =GardenArea.objects.get(name=area)
|
|
|
|
|
|
|
+ crops =GardenArea.objects.get(name=area,user=username)
|
|
|
crop = Areacrop.objects.filter(id=crop_id).update(
|
|
crop = Areacrop.objects.filter(id=crop_id).update(
|
|
|
cropname=cropname,
|
|
cropname=cropname,
|
|
|
area=crops,
|
|
area=crops,
|
|
@@ -2504,7 +2507,7 @@ class CropCount(ListView):
|
|
|
else:
|
|
else:
|
|
|
#新增
|
|
#新增
|
|
|
try:
|
|
try:
|
|
|
- crops =GardenArea.objects.get(name=area)
|
|
|
|
|
|
|
+ crops =GardenArea.objects.get(name=area,user=username)
|
|
|
Areacrop.objects.create(
|
|
Areacrop.objects.create(
|
|
|
cropname=cropname,
|
|
cropname=cropname,
|
|
|
area=crops,
|
|
area=crops,
|
|
@@ -3108,7 +3111,7 @@ class Person_Area_Pub(ListView):
|
|
|
location = request.POST.get('location')
|
|
location = request.POST.get('location')
|
|
|
addr = request.POST.get('addr')
|
|
addr = request.POST.get('addr')
|
|
|
guide_img = request.POST.get('guide_img')
|
|
guide_img = request.POST.get('guide_img')
|
|
|
- if GardenArea.objects.filter(user=user).exists():
|
|
|
|
|
|
|
+ if GardenArea.objects.filter(user=user,name=name).exists():
|
|
|
try:
|
|
try:
|
|
|
gar_obj = GardenArea.objects.get(user=user)
|
|
gar_obj = GardenArea.objects.get(user=user)
|
|
|
gar_obj.name = name
|
|
gar_obj.name = name
|