-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/votepeloclima' into feature/dashboard-others-in…
…formations
- Loading branch information
Showing
57 changed files
with
1,630 additions
and
270 deletions.
There are no files selected for viewing
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,9 @@ | ||
from django.contrib import admin | ||
from adminsortable2.admin import SortableAdminMixin | ||
|
||
from .models import Partner | ||
|
||
|
||
@admin.register(Partner) | ||
class PartnerAdmin(SortableAdminMixin, admin.ModelAdmin): | ||
list_display = ("name", "link") |
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class PartnersConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "contrib.partners" |
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 @@ | ||
# Generated by Django 4.2 on 2024-08-30 23:17 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import filer.fields.file | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('filer', '0017_image__transparent'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Partner', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100, verbose_name='Nome da Parceria')), | ||
('link', models.URLField(blank=True, null=True, verbose_name='Link da Parceria')), | ||
('logo', filer.fields.file.FilerFileField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='filer.file', verbose_name='Imagem')), | ||
], | ||
options={ | ||
'verbose_name': 'Parceiro', | ||
}, | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
app/contrib/partners/migrations/0002_alter_partner_options_partner_position.py
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,22 @@ | ||
# Generated by Django 4.2 on 2024-09-02 21:46 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('partners', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='partner', | ||
options={'ordering': ['position'], 'verbose_name': 'Parceiro'}, | ||
), | ||
migrations.AddField( | ||
model_name='partner', | ||
name='position', | ||
field=models.PositiveIntegerField(default=0), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
app/contrib/partners/migrations/0003_alter_partner_position.py
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,18 @@ | ||
# Generated by Django 4.2 on 2024-09-02 21:56 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('partners', '0002_alter_partner_options_partner_position'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='partner', | ||
name='position', | ||
field=models.PositiveIntegerField(default=0, verbose_name='Posição'), | ||
), | ||
] |
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,24 @@ | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from filer.fields.file import FilerFileField | ||
|
||
|
||
class Partner(models.Model): | ||
name = models.CharField(max_length=100, verbose_name="Nome da Parceria") | ||
logo = FilerFileField(verbose_name=_("Imagem"), on_delete=models.SET_NULL, null=True, blank=True) | ||
link = models.URLField(blank=True, null=True, verbose_name="Link da Parceria") | ||
|
||
position = models.PositiveIntegerField( | ||
default=0, | ||
blank=False, | ||
null=False, | ||
verbose_name="Posição" | ||
) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
class Meta: | ||
verbose_name = "Parceiro" | ||
ordering = ["position"] |
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,5 @@ | ||
{% for partner in partners %} | ||
<a href="{{ partner.link }}" target="_blank" rel="noopener noreferrer"> | ||
<img src="{{ partner.logo.url }}" alt="{{ partner.name }}"> | ||
</a> | ||
{% endfor %} |
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 import template | ||
from ..models import Partner | ||
|
||
register = template.Library() | ||
|
||
@register.inclusion_tag("partners/partners_list.html") | ||
def show_partners(): | ||
partners = Partner.objects.all() | ||
return {'partners': partners} |
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
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
Empty file.
Oops, something went wrong.