Anonymous avatar Anonymous committed 252a3c3 Merge

merging

Comments (0)

Files changed (5)

newsmeme/models/comments.py

 
     __tablename__ = "comments"
 
+    PER_PAGE = 20
+
     query_class = CommentQuery
 
     id = db.Column(db.Integer, primary_key=True)

newsmeme/models/posts.py

     FRIENDS = 200
     PRIVATE = 300
 
+    PER_PAGE = 40
+
     query_class = PostQuery
 
     id = db.Column(db.Integer, primary_key=True)

newsmeme/static/css/base.css

 
 div.content { margin-bottom: 30px; }
 
-ul.posts h3 { margin-bottom: 0; }
-ul.posts li { margin-bottom: 1em; }
+ul.posts h3 { margin-bottom: 0; font-size: 1.2em; }
+ul.posts li { margin-bottom: 0.5em; }
 
 ul.topnav li { display:inline; padding-left: 20px;  }
 

newsmeme/views/frontend.py

 from newsmeme.decorators import keep_login_url
 from newsmeme.permissions import auth
 
-PER_PAGE = 20
-
 frontend = Module(__name__)
 
 @frontend.route("/")
     
     page_obj = Post.query.popular().hottest().\
         restricted(g.user).as_list().\
-        paginate(page, per_page=PER_PAGE)
+        paginate(page, per_page=Post.PER_PAGE)
         
     page_url = lambda page: url_for("frontend.index", page=page)
 
 def latest(page=1):
     
     page_obj = Post.query.popular().restricted(g.user).as_list().\
-        paginate(page, per_page=PER_PAGE)
+        paginate(page, per_page=Post.PER_PAGE)
 
     page_url = lambda page: url_for("frontend.latest", page=page)
 
 @keep_login_url
 def deadpool(page=1):
     page_obj = Post.query.deadpooled().restricted(g.user).as_list().\
-        paginate(page, per_page=PER_PAGE)
+        paginate(page, per_page=Post.PER_PAGE)
 
     page_url = lambda page: url_for("frontend.deadpool", page=page)
 
         return redirect(url_for("frontend.index"))
 
     page_obj = Post.query.search(keywords).restricted(g.user).\
-            as_list().paginate(page, per_page=PER_PAGE)
+            as_list().paginate(page, per_page=Post.PER_PAGE)
 
     if page_obj.total == 1:
 
     tag = Tag.query.filter_by(slug=slug).first_or_404()
 
     page_obj = tag.posts.restricted(g.user).as_list().\
-        paginate(page, per_page=PER_PAGE)
+        paginate(page, per_page=Post.PER_PAGE)
 
     page_url = lambda page: url_for('frontend.tag',
                                     slug=slug,

newsmeme/views/user.py

 from newsmeme.extensions import mail
 from newsmeme.permissions import auth
 
-PER_PAGE = 30
-
 user = Module(__name__)
 
 @user.route("/message/<int:user_id>/", methods=("GET", "POST"))
     user = User.query.filter_by(username=username).first_or_404()
 
     page_obj = Post.query.filter_by(author=user).restricted(g.user).\
-        as_list().paginate(page, PER_PAGE)
+        as_list().paginate(page, Post.PER_PAGE)
     
     page_url = lambda page: url_for('user.posts',
                                     username=username,
 
     page_obj = Comment.query.filter_by(author=user).\
         order_by(Comment.id.desc()).restricted(g.user).\
-        paginate(page, PER_PAGE)
+        paginate(page, Comment.PER_PAGE)
     
     page_url = lambda page: url_for('user.comments',
                                     username=username,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.