Skip to content

Commit

Permalink
Fix get_absolute_url for users when the instance is a Team
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed May 10, 2021
1 parent 31d0c50 commit c0304bc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docker-app/qfieldcloud/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ def __str__(self):
return self.username

def get_absolute_url(self):
return reverse_lazy("profile_overview", kwargs={"username": self.username})
if self.user_type == User.TYPE_TEAM:
team = Team.objects.get(pk=self.pk)
return reverse_lazy(
"settings_teams_edit",
kwargs={
"username": team.team_organization.username,
"teamname": team.teamname,
},
)
else:
return reverse_lazy("profile_overview", kwargs={"username": self.username})

@property
def is_user(self):
Expand Down

0 comments on commit c0304bc

Please sign in to comment.