-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: subscribers and biography models
- Loading branch information
1 parent
265bf9a
commit 7dd911e
Showing
10 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
load-plugins=pylint_django |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
from django.contrib import admin | ||
from .models.subscribers import Subscribers | ||
from .models.biography import Biography | ||
from .models.carrousel import Carrousel | ||
|
||
# Register your models here. | ||
admin.site.register(Subscribers) | ||
admin.site.register(Biography) | ||
admin.site.register(Carrousel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Generated by Django 3.0.7 on 2020-06-04 02:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('frontend', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Biography', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('button_label', models.CharField(max_length=120, verbose_name="Button's label")), | ||
('button_url', models.CharField(max_length=120, verbose_name="Button's link")), | ||
('title', models.CharField(max_length=120, verbose_name='Title')), | ||
('description', models.TextField(max_length=3000, verbose_name='Description')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('subtitle', models.CharField(max_length=120, verbose_name='Subtitle')), | ||
('body', models.CharField(max_length=30000, verbose_name='Body')), | ||
], | ||
options={ | ||
'verbose_name': 'Biography', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Carrousel', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('button_label', models.CharField(max_length=120, verbose_name="Button's label")), | ||
('button_url', models.CharField(max_length=120, verbose_name="Button's link")), | ||
('title', models.CharField(max_length=120, verbose_name='Title')), | ||
('description', models.TextField(max_length=3000, verbose_name='Description')), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('position', models.CharField(choices=[('TOP_CENTER', 'At the top center'), ('TOP_LEFT', 'At the top left'), ('TOP_RIGHT', 'At the top right'), ('BOTTOM_CENTER', 'At the bottom center'), ('BOTTOM_LEFT', 'At the bottom left'), ('BOTTOM_RIGHT', 'At the bottom right'), ('CENTER', 'Centered'), ('CENTER_LEFT', 'Centered left'), ('CENTER_RIGHT', 'Centered right')], default='CENTER', max_length=13, verbose_name='Text position')), | ||
('image', models.ImageField(blank=True, null=True, upload_to='img', verbose_name='Image')), | ||
], | ||
options={ | ||
'verbose_name': 'Carrousel item', | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django.db import models | ||
|
||
|
||
class ButtonBlock(models.Model): | ||
button_label = models.CharField( | ||
max_length=120, verbose_name="Button's label") | ||
button_url = models.CharField(max_length=120, verbose_name="Button's link") | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
|
||
class TextBlockBase(models.Model): | ||
title = models.CharField(max_length=120, verbose_name='Title') | ||
description = models.TextField(max_length=3000, verbose_name='Description') | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
|
||
def __str__(self): | ||
return self.title | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
|
||
class TextBlock(TextBlockBase): | ||
class Meta: | ||
abstract = True | ||
|
||
|
||
class EnhancedTextBlock(TextBlockBase, ButtonBlock): | ||
subtitle = models.CharField(max_length=120, verbose_name='Subtitle') | ||
body = models.CharField(max_length=30000, verbose_name='Body') | ||
|
||
class Meta: | ||
abstract = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.db import models | ||
from .base import EnhancedTextBlock | ||
|
||
class Biography(EnhancedTextBlock): | ||
def __str__(self): | ||
return self.title | ||
|
||
class Meta: | ||
verbose_name = 'Biography' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from django.db import models | ||
from .base import TextBlock, ButtonBlock | ||
|
||
class Carrousel(TextBlock, ButtonBlock): | ||
class Position(models.TextChoices): | ||
TOP_CENTER = 'TOP_CENTER', 'At the top center' | ||
TOP_LEFT = 'TOP_LEFT', 'At the top left' | ||
TOP_RIGHT = 'TOP_RIGHT', 'At the top right' | ||
BOTTOM_CENTER = 'BOTTOM_CENTER', 'At the bottom center' | ||
BOTTOM_LEFT = 'BOTTOM_LEFT', 'At the bottom left' | ||
BOTTOM_RIGHT = 'BOTTOM_RIGHT', 'At the bottom right' | ||
CENTER = 'CENTER', 'Centered' | ||
CENTER_LEFT = 'CENTER_LEFT', 'Centered left' | ||
CENTER_RIGHT = 'CENTER_RIGHT', 'Centered right' | ||
|
||
position = models.CharField( | ||
max_length=13, | ||
choices=Position.choices, | ||
default=Position.CENTER, | ||
verbose_name='Text position' | ||
) | ||
image = models.ImageField( | ||
upload_to='img', null=True, blank=True, verbose_name='Image') | ||
|
||
def __str__(self): | ||
return self.title | ||
|
||
class Meta: | ||
verbose_name = 'Carrousel item' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from django.db import models | ||
|
||
|
||
class Subscribers(models.Model): | ||
name = models.CharField(max_length=100) | ||
email = models.EmailField() | ||
wpp = models.CharField(max_length=300) | ||
neighborhood = models.CharField(max_length=300) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
created_at = models.DateTimeField(auto_now_add=True) |