Commit 3b80e080 authored by Nicolas Joyard's avatar Nicolas Joyard

Ajout IP user dans les actions

parent 9c514e84
......@@ -25,6 +25,7 @@ class Action(db.Model):
date = db.Column(db.DateTime)
nick = db.Column(db.Unicode)
email = db.Column(db.Unicode)
ip = db.Column(db.Unicode)
attachment = db.Column(db.Unicode)
etape_id = db.Column(db.Integer, db.ForeignKey('etapes.id'))
......
......@@ -2,7 +2,7 @@
from datetime import datetime
from flask import abort, flash, redirect, render_template, session, url_for
from flask import redirect, render_template, request, session, url_for
from sqlalchemy.orm import joinedload, contains_eager
from .util import not_found, redirect_back, require_user
......@@ -77,6 +77,7 @@ def setup_routes(app):
date=datetime.utcnow(),
nick=session['user']['nick'],
email=session['user']['email'],
ip=request.remote_addr,
parlementaire=parl,
etape=parl.etape
)
......@@ -141,6 +142,7 @@ def setup_routes(app):
date=datetime.utcnow(),
nick=session['user']['nick'],
email=session['user']['email'],
ip=request.remote_addr,
parlementaire=parl,
etape=parl.etape
)
......
"""Ajout IP aux actions
Revision ID: 0550bb4083f7
Revises: 363c7cedd3bd
Create Date: 2017-05-07 15:44:54.302010
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0550bb4083f7'
down_revision = '363c7cedd3bd'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('actions', sa.Column('ip', sa.Unicode(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('actions', 'ip')
# ### end Alembic commands ###
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment