ton " href="/repo/fork/3"> Fork 0

拍爱

models.py 5.9KB

    # -*- coding: utf-8 -*- import datetime import os import time from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from pai2.basemodels import CreateUpdateMixin, PlatformMixin, VersionMixin def upload_path(instance, old_filename): extension = os.path.splitext(old_filename)[1].lower() today = datetime.datetime.today() return 'file/{year}{month}/{timestamp}{extension}'.format( year=today.year, month=today.month, timestamp=int(time.time()), extension=extension ) class LatestAppInfo(CreateUpdateMixin): PAIAI_USER = 0 PAIAI_LENSMAN = 1 PAIAI_TOURGUIDE = 2 SRC = ( (PAIAI_USER, u'拍爱用户端'), (PAIAI_LENSMAN, u'拍爱摄影师端'), (PAIAI_TOURGUIDE, u'拍爱导游端'), ) latest_adr_version_code = models.IntegerField(_(u'latest_adr_version_code'), default=0, help_text=u'最新安卓版本号') latest_adr_version_name = models.CharField(_(u'latest_adr_version_name'), max_length=255, blank=True, null=True, help_text=u'最新安卓版本名') latest_adr_app = models.FileField(_(u'latest_adr_app'), upload_to=upload_path, blank=True, null=True, help_text=u'最新版安卓 APP') latest_adr_url = models.URLField(_(u'latest_adr_url'), max_length=255, blank=True, null=True, help_text=u'最新版 APP 链接') latest_ios_version_code = models.IntegerField(_(u'latest_ios_version_code'), default=0, help_text=u'最新 iOS 版本号') latest_ios_version_name = models.CharField(_(u'latest_ios_version_name'), max_length=255, blank=True, null=True, help_text=u'最新 iOS 版本名') latest_ios_url = models.URLField(_(u'latest_ios_url'), max_length=255, blank=True, null=True, help_text=u'最新版 iOS 链接') src = models.IntegerField(_(u'src'), choices=SRC, default=PAIAI_USER, help_text=u'最新版来源', db_index=True) class Meta: verbose_name = _('latestappinfo') verbose_name_plural = _('latestappinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def final_latest_adr_url(self): return self.latest_adr_url or u'{}{}'.format(settings.DOMAIN, self.latest_adr_app and self.latest_adr_app.url) @property def data(self): return { 'latest_adr_version_code': self.latest_adr_version_code, 'latest_adr_version_name': self.latest_adr_version_name, 'latest_adr_url': self.final_latest_adr_url, 'latest_ios_version_code': self.latest_ios_version_code, 'latest_ios_version_name': self.latest_ios_version_name, 'latest_ios_url': self.latest_ios_url, } class APPSettingsInfo(CreateUpdateMixin, PlatformMixin): channel = models.CharField(_(u'channel'), max_length=255, blank=True, null=True, help_text=u'渠道') version = models.CharField(_(u'version'), max_length=255, blank=True, null=True, help_text=u'版本') online = models.BooleanField(_(u'online'), default=True, help_text=u'是否上线') class Meta: verbose_name = _('appsettingsinfo') verbose_name_plural = _('appsettingsinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def data(self): return { 'online': self.online, } class SplashInfo(CreateUpdateMixin): PAIAI_USER = 0 PAIAI_LENSMAN = 1 PAIAI_TOURGUIDE = 2 SRC = ( (PAIAI_USER, u'拍爱用户端'), (PAIAI_LENSMAN, u'拍爱摄影师端'), (PAIAI_TOURGUIDE, u'拍爱导游端'), ) splash_image = models.ImageField(_(u'splash_image'), upload_to=upload_path, blank=True, null=True, help_text=u'启动页面图片') spalash_image_airtime = models.DateTimeField(_(u'spalash_image_airtime'), blank=True, null=True, help_text=u'启动页面图片开始日期') spalash_image_deadline = models.DateTimeField(_(u'spalash_image_deadline'), blank=True, null=True, help_text=u'启动页面图片截止日期') src = models.IntegerField(_(u'src'), choices=SRC, default=PAIAI_USER, help_text=u'启动页面来源', db_index=True) class Meta: verbose_name = _('splashinfo') verbose_name_plural = _('splashinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def splash_image_url(self): return self.splash_image and (settings.DOMAIN + self.splash_image.url) @property def data(self): return { 'splash_image_url': self.splash_image_url, 'spalash_image_airtime': self.spalash_image_airtime, 'spalash_image_deadline': self.spalash_image_deadline, } class FeedbackInfo(CreateUpdateMixin): PAIAI_USER = 0 PAIAI_LENSMAN = 1 PAIAI_TOURGUIDE = 2 SRC = ( (PAIAI_USER, u'拍爱用户端'), (PAIAI_LENSMAN, u'拍爱摄影师端'), (PAIAI_TOURGUIDE, u'拍爱导游端'), ) user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识') feedback = models.TextField(_(u'feedback'), blank=True, null=True, help_text=u'用户反馈') src = models.IntegerField(_(u'src'), choices=SRC, default=PAIAI_USER, help_text=u'用户反馈来源', db_index=True) class Meta: verbose_name = _('feedbackinfo') verbose_name_plural = _('feedbackinfo') def __unicode__(self): return u'{0.pk}'.format(self) class GuestEntranceControlInfo(CreateUpdateMixin, PlatformMixin, VersionMixin): class Meta: verbose_name = _('guestentrancecontrolinfo') verbose_name_plural = _('guestentrancecontrolinfo') def __unicode__(self): return u'{0.pk}'.format(self) @property def data(self): return { 'platform': self.platform, 'min_adr': self.min_adr, 'min_ios': self.min_ios, 'max_adr': self.max_adr, 'max_ios': self.max_ios, }
Kodo/kodo - Gogs: Go Git Service

3 Commits (bc27d41f09954d3337225a38dac893433908fc98)

Author SHA1 Message Date
  Brightcells 2f29afecbd modify version in operation 10 years ago
  Brightcells af2b3f483f change download.html to be generated from download.tmpl.html 10 years ago
  Brightcells 4defb80fdc gogs first init 10 years ago
Internal Server Error - Gogs: Go Git Service

500


Application Version: 0.7.19.1121 Beta

Sign In - Gogs: Go Git Service

Sign In