diff --git a/db/moona_data.db b/db/moona_data.db index 05fa4bc..c1743f2 100644 Binary files a/db/moona_data.db and b/db/moona_data.db differ diff --git a/forms/register.py b/forms/register.py index e0be1fa..c41780c 100644 --- a/forms/register.py +++ b/forms/register.py @@ -11,7 +11,7 @@ class RegisterForm(FlaskForm): login = StringField('Логин', validators=[DataRequired()]) age = IntegerField('Возраст', validators=[DataRequired()]) about = TextAreaField('Расскажите о себе', default='') - photo = FileField('Фото', validators=[FileAllowed(['jpg', 'png'])]) + photo = FileField('Фото', validators=[FileAllowed(['jpg', 'png'], 'Images only!')]) password = PasswordField('Пароль', validators=[DataRequired()]) password2 = PasswordField('Повторите пароль', validators=[DataRequired()]) submit = SubmitField('Регистрация') diff --git a/main.py b/main.py index de50bca..0c9d88a 100644 --- a/main.py +++ b/main.py @@ -275,14 +275,12 @@ def add_question(): @app.route('/post/', methods=['GET', 'POST']) def post_edit(id): global photo + global help_arg post_ed = AddPost() ph_f = False if post_ed.del_photo.data: - session = db_session.create_session() - post_exc = session.query(DiaryPost).filter(DiaryPost.id == id, - DiaryPost.author == current_user.id).first() - post_exc.photo = None - session.commit() + help_arg = photo + photo = None if request.method == "GET": session = db_session.create_session() post_exc = session.query(DiaryPost).filter(DiaryPost.id == id, @@ -312,6 +310,9 @@ def post_edit(id): post_exc.pos_emot = post_ed.pos_emot.data post_exc.nig_emot = post_ed.nig_emot.data post_exc.link = post_ed.link.data + if help_arg: + os.remove(help_arg[3:]) + help_arg = False if post_ed.photo.data: post_exc.photo = save_photo(post_ed.photo.data, current_user.login, post=True, id_post=post_exc.id) else: diff --git a/static/app_image/post_photo/Duvakin_post_2.png b/static/app_image/post_photo/Duvakin_post_2.png index ab5bf79..70817ef 100644 Binary files a/static/app_image/post_photo/Duvakin_post_2.png and b/static/app_image/post_photo/Duvakin_post_2.png differ diff --git a/static/css/register.css b/static/css/register.css index 33ba945..821ec6d 100644 --- a/static/css/register.css +++ b/static/css/register.css @@ -1,15 +1,13 @@ .divlog { - margin-left: auto; + margin-left: 10%; margin-right: auto; width: 80%; - height: 50% + height: 50%; + margin-top: 35px; } .title { text-align: center; } -#buttons { -margin-left: -4%; -} input[type=text], input[type=email], input[type=password], input[type=file], input[type=number]{ padding:10px; border:10; @@ -31,3 +29,18 @@ textarea { .box { margin-left: 20px; } +.zag_auth { +margin-left: 20%; +} +#but_log1, #but_log2, #but_log3 { +width: 24%; +} +#but_log2 { +background-color: #16b8f5; +} +#but_log2, #but_log3 { +margin-left: 3%; +} +#divlog { +margin-left: 20%; +} \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index f6d22a0..7b4243d 100644 --- a/templates/login.html +++ b/templates/login.html @@ -2,27 +2,27 @@ {% extends "base.html" %} {% block content %} -
-

Авторизация

+
+

Авторизация

{{ form.hidden_tag() }}
{{ form.email(class="form-control", type="email") }} - {% for error in form.email.errors %} - - {% endfor %} + {% for error in form.email.errors %} + + {% endfor %}
- + {{ form.password(class="form-control", type="password") }} - {% for error in form.password.errors %} - - {% endfor %} + {% for error in form.password.errors %} + + {% endfor %}
{{ form.remember_me(class="form-check-input")}} {{ form.remember_me.label }}
@@ -32,10 +32,11 @@
{% endfor %}
-
-
    {{ form.submit(type="submit", class="btn btn-primary", style="background-color:#38aaff") }}
- +
{{ form.submit(type="submit", class="btn btn-primary", id="but_log1") }} + Регистрация + Забыли + пароль
{% if message != '' %}