Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an avatar license field #66

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pretalx/api/serializers/speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, *args, **kwargs):

class Meta:
model = User
fields = ("code", "name", "biography", "avatar")
fields = ("code", "name", "biography", "avatar", "avatar_license")


class SubmitterOrgaSerializer(SubmitterSerializer):
Expand All @@ -34,6 +34,7 @@ class SpeakerSerializer(ModelSerializer):
code = CharField(source="user.code")
name = CharField(source="user.name")
avatar = SerializerMethodField()
avatar_license = SerializerMethodField()
submissions = SerializerMethodField()
answers = SerializerMethodField()

Expand Down Expand Up @@ -74,7 +75,7 @@ def get_answers(self, obj):

class Meta:
model = SpeakerProfile
fields = ("code", "name", "biography", "submissions", "avatar", "answers")
fields = ("code", "name", "biography", "submissions", "avatar", "avatar_license", "answers")


class SpeakerOrgaSerializer(SpeakerSerializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h2>{{ title }}</h2>
{% if form.avatar or form.get_gravatar %}
{% include "common/avatar.html" with user=user form=form %}
{% endif %}
{% if form.avatar_license %}{% bootstrap_field form.avatar_license layout='event' %}{% endif %}

{% bootstrap_field form.name layout='event' %}
{% if form.biography %}{% bootstrap_field form.biography layout='event' %}{% endif %}
Expand Down
1 change: 1 addition & 0 deletions src/pretalx/orga/forms/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, *args, obj, **kwargs):
"notes",
"biography",
"avatar",
"avatar_license",
"additional_speaker",
"availabilities",
"do_not_record",
Expand Down
18 changes: 12 additions & 6 deletions src/pretalx/orga/templates/orga/cfp/text.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,24 @@
{% translate "Speaker Profile" %}
</span></div>
<div class="table-responsive-md"><table class="table offset-md-3 table-sm table-hover table-flip" id="cfp-option-table">
<tr>
<th>{% translate "Biography" %}</th>
<td class="hide-label">{% bootstrap_field sform.cfp_ask_biography layout='event-inline' %}</td>
<td>{% bootstrap_field sform.cfp_biography_min_length use_label=False layout='inline' %}</td>
<td>{% bootstrap_field sform.cfp_biography_max_length use_label=False layout='inline' %}</td>
</tr>
<tr>
<th>{% translate "Profile picture" %}</th>
<td class="hide-label">{% bootstrap_field sform.cfp_ask_avatar layout='event-inline' %}</td>
<td></td>
<td></td>
</tr>
<tr>
<th>{% translate "Profile picture license" %}</th>
<td class="hide-label">{% bootstrap_field sform.cfp_ask_avatar_license layout='event-inline' %}</td>
<td></td>
<td></td>
</tr>
<tr>
<th>{% translate "Biography" %}</th>
<td class="hide-label">{% bootstrap_field sform.cfp_ask_biography layout='event-inline' %}</td>
<td>{% bootstrap_field sform.cfp_biography_min_length use_label=False layout='inline' %}</td>
<td>{% bootstrap_field sform.cfp_biography_max_length use_label=False layout='inline' %}</td>
</tr>
</table></div>
</fieldset>
{% include "orga/includes/submit_row.html" %}
Expand Down
1 change: 1 addition & 0 deletions src/pretalx/orga/templates/orga/speaker/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ <h5>
{% if form.avatar %}
{% include "common/avatar.html" with user=form.instance.user form=form %}
{% endif %}
{% if form.avatar_license %}{% bootstrap_field form.avatar_license layout='event' %}{% endif %}
{% bootstrap_field form.name layout='event' %}
{% bootstrap_field form.email layout='event' %}
<div class="d-flex mb-4">
Expand Down
2 changes: 1 addition & 1 deletion src/pretalx/person/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class SpeakerProfileForm(
RequestRequire,
forms.ModelForm,
):
USER_FIELDS = ["name", "email", "avatar", "get_gravatar"]
USER_FIELDS = ["name", "email", "avatar", "avatar_license", "get_gravatar"]
FIRST_TIME_EXCLUDE = ["email"]

def __init__(self, *args, name=None, **kwargs):
Expand Down
18 changes: 18 additions & 0 deletions src/pretalx/person/migrations/0028_user_avatar_license.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.10 on 2024-03-05 12:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("person", "0027_created_updated_everywhere"),
]

operations = [
migrations.AddField(
model_name="user",
name="avatar_license",
field=models.CharField(max_length=32, null=True),
),
]
6 changes: 6 additions & 0 deletions src/pretalx/person/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ class User(PermissionsMixin, GenerateCode, FileCleanupMixin, AbstractBaseUser):
"If you have registered with an email address that has a gravatar account, we can retrieve your profile picture from there."
),
)
avatar_license = models.CharField(
null=True,
blank=True,
max_length=32,
verbose_name=_("Profile Picture License")
)
pw_reset_token = models.CharField(
null=True, max_length=160, verbose_name="Password reset token"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def update_custom_domain(apps, schema_editor):
"availabilities",
"biography",
"avatar",
"avatar_license",
"notes",
"do_not_record",
"image",
Expand Down
1 change: 1 addition & 0 deletions src/pretalx/submission/models/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def default_fields():
"max_length": None,
},
"avatar": {"visibility": "optional"},
"avatar_license": {"visibility": "optional"},
"availabilities": {"visibility": "optional"},
"notes": {"visibility": "optional"},
"do_not_record": {"visibility": "optional"},
Expand Down