Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions geonode/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class Meta:
resource_name = "profiles"
allowed_methods = ["get"]
ordering = ["username", "date_joined"]
excludes = ["is_staff", "password", "is_superuser", "is_active", "last_login"]
excludes = ["is_staff", "password", "is_superuser", "is_active", "last_login", "extra_data"]

filtering = {
"username": ALL,
Expand Down Expand Up @@ -615,7 +615,7 @@ class Meta:
resource_name = "owners"
allowed_methods = ["get"]
ordering = ["username", "date_joined"]
excludes = ["is_staff", "password", "is_superuser", "is_active", "last_login"]
excludes = ["is_staff", "password", "is_superuser", "is_active", "last_login", "extra_data"]

filtering = {
"username": ALL,
Expand Down
1 change: 1 addition & 0 deletions geonode/people/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ class Meta:
"is_active",
"date_joined",
"language",
"extra_data",
)
6 changes: 4 additions & 2 deletions geonode/people/migrations/0032_set_contributors_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def forwards_func(apps, schema_editor):
if perm:
cont_group.permissions.add(perm)
# Exclude admins and anonymous user
users_to_update = get_user_model().objects.filter(pk__gt=0)
Profile = apps.get_model("people", "Profile")
users_to_update = Profile.objects.filter(pk__gt=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sijandh35 if the intention is to exclude the anonymous group, i would prefer to have it excluded explicity rather than doint a pk__gt something like:

Profile.objects.exclude(username="AnonymousUser"))

i think migth be worth to fix the migration even it comes from old changes

for user in users_to_update:
registeredmembers_group.user_set.add(user)
for user in users_to_update.exclude(is_staff=True, is_superuser=True):
Expand All @@ -32,7 +33,8 @@ def reverse_func(apps, schema_editor):
# remove contributors group from users
try:
cont_group = Group.objects.get(name='contributors')
users_to_update = get_user_model().objects.filter(
Profile = apps.get_model("people", "Profile")
users_to_update = Profile.objects.filter(
pk__gt=0, is_staff=False, is_superuser=False
)
for user in users_to_update:
Expand Down
20 changes: 20 additions & 0 deletions geonode/people/migrations/0039_profile_extra_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.2.10 on 2026-02-05 10:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("people", "0038_migrate_sha1_passwords"),
]

operations = [
migrations.AddField(
model_name="profile",
name="extra_data",
field=models.JSONField(
blank=True, default=dict, help_text="additional profile-related attributes", verbose_name="Extra Data"
),
),
]
6 changes: 6 additions & 0 deletions geonode/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ class Profile(AbstractUser):
choices=TIMEZONES,
blank=True,
)
extra_data = models.JSONField(
_("Extra Data"),
blank=True,
default=dict,
help_text=_("additional profile-related attributes"),
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
Loading