diff --git a/alembic/versions/4255158a6913_create_private_column_in_project_table.py b/alembic/versions/4255158a6913_create_private_column_in_project_table.py new file mode 100644 index 0000000..2e8211e --- /dev/null +++ b/alembic/versions/4255158a6913_create_private_column_in_project_table.py @@ -0,0 +1,30 @@ +"""Create private column in project table + +Revision ID: 4255158a6913 +Revises: 317a285e04a8 +Create Date: 2016-06-06 14:33:47.039207 + +""" + +# revision identifiers, used by Alembic. +revision = '4255158a6913' +down_revision = '317a285e04a8' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ''' Add a pivate column in the project table + ''' + op.add_column( + 'projects', + sa.Column('private', sa.Boolean, nullable=False, default=False) + ) + + + +def downgrade(): + ''' Remove the private column + ''' + op.drop_column('projects', 'private') diff --git a/pagure/forms.py b/pagure/forms.py index 25a0f30..2f27c05 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -136,8 +136,6 @@ class ProjectFormSimplified(PagureForm): ) - - class ProjectForm(ProjectFormSimplified): ''' Form to create or edit project. ''' name = wtforms.TextField( diff --git a/pagure/ui/app.py b/pagure/ui/app.py index c58c5fc..8dad4f6 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -110,17 +110,20 @@ def index_auth(): username=flask.g.fas_user.username, exclude_groups=APP.config.get('EXCLUDE_GROUP_INDEX'), fork=False, - count=True, private=private) + count=True, + private=private) forks = pagure.lib.search_projects( SESSION, username=flask.g.fas_user.username, - fork=True, private=private) + fork=True, + private=private) forks_length = pagure.lib.search_projects( SESSION, username=flask.g.fas_user.username, fork=True, - count=True, private=private) + count=True, + private=private) watch_list = pagure.lib.user_watch_list( SESSION, @@ -205,13 +208,15 @@ def view_users(username=None): SESSION, username=user.user, fork=False, - count=True, private=private) + count=True, + private=private) forks_length = pagure.lib.search_projects( SESSION, username=user.user, fork=True, - count=True, private=private) + count=True, + private=private) user.repos_length = repos_length user.forks_length = forks_length @@ -262,6 +267,7 @@ def view_projects(pattern=None, namespace=None): SESSION, pattern=pattern, namespace=namespace, fork=forks, start=start, limit=limit, private=private) + if len(projects) == 1: flask.flash('Only one result found, redirecting you to it') return flask.redirect(flask.url_for(