diff --git a/src/EventAPI/forms.py b/src/EventAPI/forms.py
index 6f478a26..2c82640d 100644
--- a/src/EventAPI/forms.py
+++ b/src/EventAPI/forms.py
@@ -19,9 +19,12 @@ class Meta:
'DisplayArticleType': _("选择活动介绍所要显示的文章来源"),
'relatedArticles': _("若文章来源选择为Blog,则此项必填"),
'WechatArticleUrl': _("若文章来源选择为WeChat,则此项必填"),
- 'WechatQRcode': _("若文章来源选择为WeChat,则必须提供文章对应的微信公众号"),
-
+ 'WechatQRcode': _("若文章来源选择为WeChat,可提供文章对应的微信公众号的二维码"),
+ 'pastEventLink': _("可以为空"),
+ 'recentEventLink': _("可以为空"),
+ 'pastEventPoster': _("可以为空"),
+ 'recentEventPoster': _("可以为空"),
}
widgets = {
'eventInfo': forms.Textarea(attrs={'rows': 3}),
@@ -42,7 +45,7 @@ def clean(self, *args, **kwargs):
display_article_type = self.cleaned_data.get('DisplayArticleType')
wechat_qr_code = self.cleaned_data.get('WechatQRcode')
- if (display_article_type == 'WeChat' and (wechat_article_url == None or wechat_qr_code == None)) or (display_article_type == 'Blog' and related_articles == None):
+ if (display_article_type == 'WeChat' and (wechat_article_url == None)) or (display_article_type == 'Blog' and related_articles == None):
errors.append(ValidationError(_(mark_safe('
文章显示设置不正确,请检查相关设置项')), code='invalid article display setting'))
event_actualSt_time = self.cleaned_data.get("eventActualStTime")
diff --git a/src/EventAPI/migrations/0020_auto_20211120_2339.py b/src/EventAPI/migrations/0020_auto_20211120_2339.py
new file mode 100644
index 00000000..19166a9f
--- /dev/null
+++ b/src/EventAPI/migrations/0020_auto_20211120_2339.py
@@ -0,0 +1,33 @@
+# Generated by Django 3.1.12 on 2021-11-20 12:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('EventAPI', '0019_auto_20190509_0759'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='event',
+ name='pastEventLink',
+ field=models.URLField(default=None, null=True, verbose_name='往期活动链接'),
+ ),
+ migrations.AddField(
+ model_name='event',
+ name='pastEventPoster',
+ field=models.ImageField(default=None, null=True, upload_to='uploads/usrImage/eventPastVisual', verbose_name='往期活动海报'),
+ ),
+ migrations.AddField(
+ model_name='event',
+ name='recentEventLink',
+ field=models.URLField(default=None, null=True, verbose_name='近期活动链接'),
+ ),
+ migrations.AddField(
+ model_name='event',
+ name='recentEventPoster',
+ field=models.ImageField(default=None, null=True, upload_to='uploads/usrImage/eventRecentVisual', verbose_name='近期活动海报'),
+ ),
+ ]
diff --git a/src/EventAPI/models.py b/src/EventAPI/models.py
index 7fcd6875..ba4887ca 100644
--- a/src/EventAPI/models.py
+++ b/src/EventAPI/models.py
@@ -109,6 +109,13 @@ class Event (models.Model):
WechatArticleUrl = models.CharField(verbose_name=_("微信公众号文章链接"), max_length=500, default=None, null=True, blank=True)
WechatQRcode = models.ImageField(verbose_name=_("微信二维码"),upload_to='uploads/usrImage/eventWechatQRcode',default=None ,null=True, blank=True)
+ # 近期、往期活动的链接和海报
+ pastEventLink = models.URLField(verbose_name=_("往期活动链接"), default=None, null=True)
+ recentEventLink = models.URLField(verbose_name=_("近期活动链接"), default=None, null=True)
+
+ pastEventPoster = models.ImageField(verbose_name=_("往期活动海报"), upload_to='uploads/usrImage/eventPastVisual', default=None, null=True)
+ recentEventPoster = models.ImageField(verbose_name=_("近期活动海报"), upload_to='uploads/usrImage/eventRecentVisual', default=None, null=True)
+
disabled = models.BooleanField(default=False)
def __str__(self):
diff --git a/src/EventAPI/serializers.py b/src/EventAPI/serializers.py
index 3a343b50..61f79b0e 100644
--- a/src/EventAPI/serializers.py
+++ b/src/EventAPI/serializers.py
@@ -3,8 +3,14 @@
class EventsSerializer(serializers.ModelSerializer):
+ def get_eventTaker(self, instance):
+ return instance.eventBy.eventTakerName if instance.eventBy else None
+
+ def get_eventType(self, instance):
+ return instance.eventTypes.typeName if instance.eventTypes else None
+
class Meta:
model = eventModels
fields = ('eventID','eventName','eventInfo','mainVisual','address','venue','isFree','price',
- 'eventBy','eventTypes')
+ 'pastEventLink', 'pastEventPoster', 'recentEventLink', 'recentEventPoster',)
\ No newline at end of file
diff --git a/src/EventAPI/templates/EventAPI/add_event.html b/src/EventAPI/templates/EventAPI/add_event.html
index 77e36213..1e0fedec 100644
--- a/src/EventAPI/templates/EventAPI/add_event.html
+++ b/src/EventAPI/templates/EventAPI/add_event.html
@@ -102,7 +102,7 @@