Skip to content

Commit

Permalink
[fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
boke0 committed Mar 4, 2021
1 parent 877df53 commit 89c5114
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
7 changes: 4 additions & 3 deletions mitama/app/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,12 @@ def validate(self):
@property
def data(self):
if self._data is not None:
if self._bin is not None:
return self._bin
else:
if self._bin is None:
self._bin = self._data.file.read()
if self._bin is not None or len(self._bin) > 0:
return self._bin
else:
return None
elif self.initial is not None:
return self.initial
else:
Expand Down
16 changes: 4 additions & 12 deletions mitama/portal/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,12 @@ def update(self, req):
user.screen_name = form["screen_name"]
user.name = form["name"]
user.icon = resize_icon(form["icon"]) if form["icon"] is not None else user.icon
roles_ = []
for role in form["roles"]:
user.roles.append(Role.retrieve(screen_name=role))
roles_.append(Role.retrieve(screen_name=role))
user.roles = roles_
user.update()
return Response.render(
template,
{
"message": "変更を保存しました",
"user": user,
"screen_name": user.screen_name,
"name": user.name,
"icon": user.icon,
"roles": roles
},
)
return Response.redirect(self.app.convert_url("/users/" + user.screen_name + "/settings"))
except Exception as err:
error = str(err)
return Response.render(
Expand Down
4 changes: 2 additions & 2 deletions mitama/portal/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class InviteForm(Form):


class UserUpdateForm(Form):
icon = FileField(label="プロフィール画像", initial=load_noimage_user())
icon = FileField(label="プロフィール画像")
name = Field(label="名前", required=True)
screen_name = Field(label="ログイン名")
roles = Field(label="役割", listed=True)
Expand All @@ -49,7 +49,7 @@ class GroupCreateForm(Form):


class GroupUpdateForm(Form):
icon = FileField(label="プロフィール画像", initial=load_noimage_group())
icon = FileField(label="プロフィール画像")
name = Field(label="名前", required=True)
screen_name = Field(label="ドメイン名", required=True)
parent = Field(label="親グループ")
Expand Down

0 comments on commit 89c5114

Please sign in to comment.