#coding:utf-8
from django.db import models
from datetime import datetime
from django.contrib.auth.models import User
#发布形式
class PublishType(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#产权单位
class Unit(models.Model):
name = models.CharField(max_length = 200)
def __unicode__(self):
return self.name
#路段
class Road(models.Model):
name = models.CharField(max_length = 200)
def __unicode__(self):
return self.name
#方向
class Direction(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#当前广告牌状态
class BillboardState(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#广告牌
class Billboard(models.Model):
address = models.CharField(max_length = 200,verbose_name=u"地址")
direction_type = models.ForeignKey(Direction,verbose_name=u"上下行")
publish_type = models.ForeignKey(PublishType,verbose_name=u"发布方式")
pile_number = models.CharField(max_length = 50,verbose_name=u"桩号")
position = models.CharField(max_length = 50,verbose_name=u"位置")
approval_code = models.CharField(max_length = 50,verbose_name=u"路政审批号")
image = models.ImageField(verbose_name = u"照片",upload_to="upload/image",blank=True)
state = models.ForeignKey(BillboardState,verbose_name=u"状态")
insert_date = models.DateTimeField()
insert_operator = models.ForeignKey(User)
update_date = models.DateTimeField()
update_operator = models.ForeignKey(User,related_name = 'op_user')
def __unicode__(self):
return self.pile_number
#合同状态
class ContractState(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#付费方式
class PayType(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#合同
class Contract(models.Model):
code = models.CharField(max_length = 20,verbose_name=u'合同号')
state = models.ForeignKey(ContractState,verbose_name=u'状态')
pay_type = models.ForeignKey(PayType,verbose_name=u'付款方式')
total_fee = models.FloatField(verbose_name=u'总费用',default = 0)
payed_fee = models.FloatField(verbose_name=u'已付费用',default = 0)
billboard = models.ForeignKey(Billboard,verbose_name=u'广告牌')
active_date = models.DateTimeField(verbose_name=u'起始时间')
inactive_date = models.DateTimeField(verbose_name=u'截止时间')
insert_date = models.DateTimeField()
insert_operator = models.ForeignKey(User)
notes = models.CharField(max_length = 200,verbose_name=u'备注',blank=True)
#付费状态
class PayState(models.Model):
name = models.CharField(max_length = 20)
def __unicode__(self):
return self.name
#账单
class Bill(models.Model):
contract = models.ForeignKey(Contract)
total_fee = models.FloatField(verbose_name = u'总费用')
payed_fee = models.FloatField(verbose_name = u'已付费用',default = 0)
pay_date = models.DateTimeField(verbose_name=u'付费时间')
payed_date = models.DateTimeField()
pay_state = models.ForeignKey(PayState,verbose_name = u'状态')
insert_date = models.DateTimeField()
insert_operator = models.ForeignKey(User)
notes = models.CharField(max_length = 200,verbose_name=u'备注',blank=True)
#付费日志
class BillLog(models.Model):
bill = models.ForeignKey(Bill)
fee = models.FloatField(verbose_name=u'费用')
insert_date = models.DateTimeField()
insert_operator = models.ForeignKey(User)
notes = models.CharField(max_length = 200,verbose_name='备注',blank=True)
from django import forms
from billboard import models as bm
class BillboardForm(forms.ModelForm):
class Meta:
model = bm.Billboard
fields = ('address','direction_type','publish_type','pile_number',
'position','approval_code','image','state')
class ContractForm(forms.ModelForm):
billboard = forms.ModelChoiceField(queryset=bm.Billboard.objects.all(),widget=forms.HiddenInput)
class Meta:
model = bm.Contract
fields = ('code','state','pay_type','billboard','active_date','inactive_date','notes')
class BillForm(forms.ModelForm):
contract = forms.ModelChoiceField(queryset=bm.Contract.objects.all(),widget=forms.HiddenInput)
class Meta:
model = bm.Bill
fields = ('contract','total_fee','pay_date','notes')
class BillLogForm(forms.ModelForm):
bill = forms.ModelChoiceField(queryset=bm.Bill.objects.all(),widget=forms.HiddenInput)
class Meta:
model = bm.BillLog
fields = ('bill','fee','notes')
分享到:
相关推荐
标题 "AviFile1_AviFile1111111111_" 暗示我们关注的是一个与AVI文件处理相关的组件或库,可能是用于读取、编辑或创建AVI视频文件的工具。描述中提到的 "AviFiles是用于AVi合成图片图片合成为视频文件进行一些相关...
【标题】:“11项目.zip1111111111”可能是指一个包含多个学习或工作阶段的项目压缩文件,其中“11”可能是项目编号或者版本标识。 【描述】:“11项目.zip1111111111”的描述为空,无法提供具体项目的详细信息。...
PFD9.py1111111111
PFD4.py1111111111
pd24.py1111111111
"甘特图模板1111111111"可能是为了方便用户快速创建和定制符合自己需求的甘特图而设计的一款模板。 甘特图的基本元素包括任务条、时间轴和进度线。任务条表示项目中的各个任务,其长度对应任务所需的时间;时间轴...
手机 识别歌曲 三班系统 或破解证书 1111111111111111111111111111
这个"恒温温控程序1111111111.rar"文件很可能包含了一个完整的PLC(可编程逻辑控制器)编程项目,用于控制与温控相关的设备。PLC是一种专为工业环境设计的数字运算操作电子系统,它通过数字或模拟输入/输出来控制...
在【描述】中提到的"宿舍管理系统.rar1111111111",我们可以推测这是一个压缩包文件,可能包含了系统的源代码、文档、数据库配置、运行环境等资源。通常,这种类型的文件是为了方便用户下载、安装和部署。由于未提供...
数据集资源1111111111
pd30.py1111111111
我的vim1111111111
面向对象进阶1111111111
泰乐自研脚手架1111111111
k8s日志1111111111
PFD11.py1111111111
PFD8.py1111111111
PFD7.py1111111111
pd21.py1111111111
Cpp1.cpp1111111111