Bläddra i källkod

add yt_video condition into manage_table

weichen 4 år sedan
förälder
incheckning
709ad13692
2 ändrade filer med 7 tillägg och 0 borttagningar
  1. 5 0
      backstage/templates/tables/manage_table.html
  2. 2 0
      backstage/utils/routes.py

+ 5 - 0
backstage/templates/tables/manage_table.html

@@ -26,6 +26,11 @@
                   <input id="image" name="image-{{ loop.index }}" type="file" value="{{ data['src'] }}">
                   <input id="image" name="image-{{ loop.index }}" type="file" value="{{ data['src'] }}">
                   <input name="{{ key }}-{{ loop.index }}" type="hidden" value="{{ data }}">
                   <input name="{{ key }}-{{ loop.index }}" type="hidden" value="{{ data }}">
                 </td>
                 </td>
+              {% elif key == "yt_video" %}
+                <td>影片</td>
+                <td>
+                  <input name="{{ key }}-{{ loop.index }}" class="form-control form-control-lg" value="{{ data['videoid'] }}">
+                </td>
               {% else %}
               {% else %}
               <td>文字</td>
               <td>文字</td>
               <td>
               <td>

+ 2 - 0
backstage/utils/routes.py

@@ -46,6 +46,8 @@ def update_manage_table(forms, req_args, files, img_type):
         element_type = key.split('-')[0]
         element_type = key.split('-')[0]
         if element_type == 'img':
         if element_type == 'img':
             value = eval(value)
             value = eval(value)
+        elif element_type == 'yt_video':
+            value = {'videoid': str(value)}
         else:
         else:
             value = str(value)
             value = str(value)
         update_data[element_type].append(value)
         update_data[element_type].append(value)