Skip to content

Commit

Permalink
revert back to previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanmehmood committed Mar 5, 2015
1 parent 15e1bd3 commit b4cdac7
Show file tree
Hide file tree
Showing 1,887 changed files with 237 additions and 275,824 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.pyc
venv
*~
.DS_Store
ignore
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Flask Boilerplate app with user managment system

###Introduction
Flask is a microframework for web development written in Python. It's very easy and powerful. We have created a simple Flask-Boilerplate app that many of you might need to get started with your first project. The app has a capability of registering users. Each user can publish a post and comment.
Flask is microframework for web development written in Python. It's very easy and powerfull. We have created a simple Flask-Boilerplate app that many of you might need to get started with your first project. The app has a capability of registering users. Each user can publish a post and comment.

###Packages included
####Flask-Security
Expand Down Expand Up @@ -93,8 +93,8 @@ Open up your web browser and navigate to **localhost:5000** and you'll probably

###What's Next?

- Adding Bootstrap to your flask app (Done)
- Adding Bootstrap to your flask app
- Adding update/delete function on posts
- Deploy your flask app on heroku platform
- Deploy using apache
- Adding unit tests by using Python Nose package
- adding Unit tests by using Python Nose package
Binary file removed main_app/__init__.pyc
Binary file not shown.
20 changes: 8 additions & 12 deletions main_app/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,27 @@ def security_mail_processor():
# app controllers
@app.route('/')
def index():
return render_template('index.html',
user = current_user)
return render_template('index.html')

@app.route('/user-profile')
@login_required
def home():
"""
For adding roles to user, following functions can be use
"""
#my_var = {'name': 'admin', 'description': 'I am admin'}
#role = user_datastore.find_or_create_role("admin")
#user_datastore.add_role_to_user(current_user, role)
#if len(current_user.roles) == 0:
# print "You are no access to Data files!" + str(role)
my_var = {'name': 'admin', 'description': 'I am admin'}
role = user_datastore.find_or_create_role("admin")
user_datastore.add_role_to_user(current_user, role)
if len(current_user.roles) == 0:
print "You are no access to Data files!" + str(role)
return render_template('user_profile.html')

@app.route('/add_post', methods = ['GET', 'POST'])
@login_required
def add_post():
user_id = User.objects.get_or_404(first_name="Hassan")
form = PostsForm()
if form.validate_on_submit():
post = Posts(title=form.author.data, post=form.post.data, author_id=str(current_user.id))
post.save()
print "I am now save! this is your post!"
return render_template('add_post.html',
user = current_user,
form = form)
Expand All @@ -78,8 +76,6 @@ def show_post(post_id):
if form.validate_on_submit():
comment = Comments(author=form.author.data, comment=form.comment.data, post_id=post_id)
comment.save()
form.author.data = ""
form.comment.data = ""
return render_template("post.html",
user = current_user,
post = post,
Expand Down
Binary file removed main_app/controllers.pyc
Binary file not shown.
Binary file removed main_app/core.pyc
Binary file not shown.
Binary file removed main_app/forms.pyc
Binary file not shown.
Binary file removed main_app/models.pyc
Binary file not shown.
Binary file removed main_app/settings.pyc
Binary file not shown.
File renamed without changes.
Loading

0 comments on commit b4cdac7

Please sign in to comment.