From e9a62fe04f23adef2aaa320112fdda52aa2909a9 Mon Sep 17 00:00:00 2001 From: shubhamgupta2956 Date: Sat, 11 Jan 2020 00:22:08 +0530 Subject: [PATCH] added color field for projects background in backend --- apps/projects/admin.py | 2 +- apps/projects/migrations/0002_project_color.py | 18 ++++++++++++++++++ apps/projects/models.py | 1 + apps/projects/serializers.py | 2 +- frontend/src/components/Project.vue | 2 +- frontend/src/components/Update.vue | 2 +- frontend/src/views/Event.vue | 4 ++-- 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 apps/projects/migrations/0002_project_color.py diff --git a/apps/projects/admin.py b/apps/projects/admin.py index 7d9f76d..6091bc1 100644 --- a/apps/projects/admin.py +++ b/apps/projects/admin.py @@ -5,6 +5,6 @@ @admin.register(Project) class ProjectAdmin(admin.ModelAdmin): - list_display = ('title', 'permalink', 'url', 'is_visible',) + list_display = ('title', 'permalink', 'url', 'color', 'is_visible',) list_filter = ('is_visible',) search_fields = ('title',) diff --git a/apps/projects/migrations/0002_project_color.py b/apps/projects/migrations/0002_project_color.py new file mode 100644 index 0000000..76e5d23 --- /dev/null +++ b/apps/projects/migrations/0002_project_color.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.4 on 2020-01-10 18:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='project', + name='color', + field=models.CharField(blank=True, max_length=15), + ), + ] diff --git a/apps/projects/models.py b/apps/projects/models.py index 9386711..6428f5b 100644 --- a/apps/projects/models.py +++ b/apps/projects/models.py @@ -9,6 +9,7 @@ class Project(models.Model): description = models.CharField(max_length=500) url = models.URLField(max_length=200) image = models.ImageField(upload_to='projects') + color = models.CharField(max_length=15, blank=True) is_visible = models.BooleanField(default=False) class Meta: diff --git a/apps/projects/serializers.py b/apps/projects/serializers.py index fbad9a9..b546ae1 100644 --- a/apps/projects/serializers.py +++ b/apps/projects/serializers.py @@ -7,4 +7,4 @@ class ProjectSerializer(serializers.ModelSerializer): class Meta: model = Project - fields = ('permalink', 'title', 'description', 'url', 'image') + fields = ('permalink', 'title', 'description', 'url', 'image', 'color') diff --git a/frontend/src/components/Project.vue b/frontend/src/components/Project.vue index 3819fc1..94192b6 100644 --- a/frontend/src/components/Project.vue +++ b/frontend/src/components/Project.vue @@ -7,7 +7,7 @@ class="project-wrapper sm:w-5/6 flex flex-col-reverse sm:flex-row justify-center sm:items-center" >
-

+

{{ title }}

{{ desc }}

diff --git a/frontend/src/components/Update.vue b/frontend/src/components/Update.vue index 176000b..4582e6d 100644 --- a/frontend/src/components/Update.vue +++ b/frontend/src/components/Update.vue @@ -1,6 +1,6 @@