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

Fixed delete comment method #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ flask run
```
Test account:
* email: `[email protected]`
* password: `helloflask`
* password: `17_313_rocks`

## License

Expand Down
1 change: 1 addition & 0 deletions albumy/blueprints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def delete_comment(comment_id):
and not current_user.can('MODERATE'):
abort(403)
db.session.delete(comment)
db.session.commit()
flash('Comment deleted.', 'info')
return redirect(url_for('.show_photo', photo_id=comment.photo_id))

Expand Down
3 changes: 2 additions & 1 deletion albumy/forms/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

class EditProfileForm(FlaskForm):
name = StringField('Name', validators=[DataRequired(), Length(1, 30)])
nickname = StringField('Nickname', validators=[DataRequired(), Length(1, 30)])
username = StringField('Username', validators=[DataRequired(), Length(1, 20),
Regexp('^[a-zA-Z0-9]*$',
message='The username should contain only a-z, A-Z and 0-9.')])
website = StringField('Website', validators=[Optional(), Length(0, 255)])
location = StringField('City', validators=[Optional(), Length(0, 50)])
bio = TextAreaField('Bio', validators=[Optional(), Length(0, 120)])
bio = TextAreaField('Story of my Life', validators=[Optional(), Length(0, 120)])
submit = SubmitField()

def validate_username(self, field):
Expand Down
2 changes: 1 addition & 1 deletion albumy/templates/admin/manage_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>Users
<th>Avatars</th>
<th>Name/username</th>
<th>Role</th>
<th>Bio</th>
<th>Story of my life</th>
<th>City</th>
<th>Date</th>
<th>Photos</th>
Expand Down