def getDailyDetailObj(request): ''' 返回一个当日dailydetail对象,没有就创建一个返回 :param request: :return: ''' loginUser = request.user.username loginUserObj = None try: loginUserObj = User.objects.get(username=loginUser) except Exception as e: print(e) today = getFormedDateStr() dobj = DailyDetail.objects.filter(create_day=today).filter( idjinfo=loginUserObj.idjinfo) # print('777777777'*11) # print(dobj) # print(dobj[0]) # print('777777777' * 11) if not dobj: DailyDetail.objects.create(idjinfo=loginUserObj.idjinfo).save() return DailyDetail.objects.filter(create_day=today).filter( idjinfo=loginUserObj.idjinfo)[0] else: return dobj[0]
class ThumbLog(models.Model): # user = models.ForeignKey('User', null=True, blank=True, verbose_name='用户') idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) thumbId = models.TextField(max_length=500, verbose_name='评论id') def __str__(self): return '{}:{}\n{}'.format(self.idjinfo, self.create_day, self.thumbId)
class HelpInfo(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) create_time = models.CharField(max_length=50, verbose_name='创建时间', default=datetime.datetime.now().strftime("%H:%M:%S")) reply = models.TextField(max_length=500, verbose_name='回复内容') title = models.CharField(max_length=50, verbose_name='标题') def __str__(self): return '{}:{}\n{}'.format(self.idjinfo, self.create_day, self.title)
class ExamDetail(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) subjectId = models.CharField(max_length=50, verbose_name='题目id') title = models.CharField(max_length=500, verbose_name='题目名称') detail = models.TextField(max_length=500, verbose_name='详细') def __str__(self): return '{}:{}\n{}'.format(self.idjinfo, self.create_day, self.title)
class ExamInfo(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) create_time = models.CharField(max_length=50, verbose_name='创建时间', default=datetime.datetime.now().strftime("%H:%M:%S")) question = models.TextField(max_length=500, verbose_name='问题') answer = models.CharField(max_length=50, verbose_name='答案') answerText = models.CharField(max_length=50, verbose_name='文本答案') def __str__(self): return '{}:{}\n{}'.format(self.idjinfo, self.create_day, self.question)
class DailyDetail(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_date = models.DateTimeField(auto_now_add=True) create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) thumbDetail = models.TextField(max_length=500, verbose_name='信息评论详细', default='') viewDetail = models.TextField(max_length=500, verbose_name='党员视角发布详细', default='') hlepDetail = models.TextField(max_length=500, verbose_name='互助广场回答详细', default='') examDetail = models.TextField(max_length=500, verbose_name='在线知识竞答详细', default='') study1Detail = models.TextField(max_length=500, verbose_name='在线阅读学习资料与学习资料写体会详细', default='') # study2Detail = models.TextField(max_length=500, verbose_name='学习资料写体会详细', default='') def __str__(self): return '(详细){}:{}'.format(self.idjinfo, self.create_day)
class DailyResult(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_date = models.DateTimeField(auto_now_add=True) create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) thumb = models.CharField(max_length=50, verbose_name='信息评论') view = models.CharField(max_length=50, verbose_name='党员视角发布') hlep = models.CharField(max_length=50, verbose_name='互助广场回答') exam = models.CharField(max_length=50, verbose_name='在线知识竞答') study1 = models.CharField(max_length=50, verbose_name='在线阅读学习资料') study2 = models.CharField(max_length=50, verbose_name='学习资料写体会') conLogin = models.CharField(max_length=50, verbose_name='连续登录') mobileLogin = models.CharField(max_length=50, verbose_name='手机端登录') def __str__(self): return '{}:{}'.format(self.idjinfo, self.create_day)
class ErrLog(models.Model): idjinfo = models.ForeignKey('DjInfo', null=True, blank=True, verbose_name='党建用户') create_day = models.CharField(max_length=50, verbose_name='创建日期', default=getFormedDateStr()) content = models.TextField(max_length=1000, verbose_name='内容') def __str__(self): return '{}:{}\n{}'.format(self.idjinfo, self.create_day, self.content)