-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apps/projects: add insight model and form
- Loading branch information
Showing
4 changed files
with
140 additions
and
2 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
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,60 @@ | ||
# Generated by Django 3.2.19 on 2023-07-13 12:58 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("a4projects", "0038_verbose_name_created_modified"), | ||
("a4_candy_projects", "0004_verbose_name_created_modified"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Insight", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"created", | ||
models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
editable=False, | ||
verbose_name="Created", | ||
), | ||
), | ||
( | ||
"modified", | ||
models.DateTimeField( | ||
blank=True, editable=False, null=True, verbose_name="Modified" | ||
), | ||
), | ||
("active_participants", models.PositiveIntegerField()), | ||
("comments", models.IntegerField()), | ||
("ratings", models.IntegerField()), | ||
("written_ideas", models.IntegerField()), | ||
("poll_answers", models.IntegerField()), | ||
("live_questions", models.IntegerField()), | ||
("display", models.BooleanField(default=False)), | ||
( | ||
"project", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="a4projects.project", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
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
23 changes: 23 additions & 0 deletions
23
apps/projects/templates/a4_candy_projects/includes/project_insights_form.html
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,23 @@ | ||
{% load i18n widget_tweaks %} | ||
|
||
<div class="form-group"> | ||
<label for="{{ field.id_for_label }}"> | ||
{{ field.label }}{% if field.field.required %}<span role="presentation" title="{% translate 'This field is required' %}">*</span>{% endif %} | ||
{% block after_label %} | ||
{% if field.field.required_for_publish and not field.value %} | ||
<i class="fa fa-exclamation-circle u-danger" title="{% translate 'Missing field for publication' %}" aria-label="{% translate 'Missing field for publication' %}"></i> | ||
{% endif %} | ||
{% endblock %} | ||
</label> | ||
{% if field.help_text %} | ||
<div class="form-hint"> | ||
{{ field.help_text }} | ||
</div> | ||
{% endif %} | ||
{% block field %} | ||
<div class="widget widget--{{ field|widget_type }}"> | ||
{{ field }} | ||
</div> | ||
{% endblock %} | ||
{{ field.errors }} | ||
</div> |