Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blog pages added #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Namrata7199
Copy link

No description provided.

@rohitvarkey
Copy link
Contributor

Hi @Namrata7199,

Please don't add files from Student_Council_Website/bin to PR's. They're just virtual env files that will automatically get created on the users machines. You can add that path to your .gitignore which will help from accidentally adding these files from now on. 😄

@abhijithanilkumar
Copy link
Member

Hi @Namrata7199 ,
Try not to do git add . before you push your code. Pick those files you changes. Also, add your virtualenv, migratons folders to .gitignore so that you don't accidentally commit them.

@Namrata7199 Namrata7199 reopened this Feb 23, 2018
@Namrata7199
Copy link
Author

I reset the last commit and added the files again

@abhijithanilkumar
Copy link
Member

Hi @Namrata7199 ,
You still have the migration files in your commit. Remove those as well! 😄


@python_2_unicode_compatible
class Articles(models.Model):
page=models.IntegerField(default=0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to have a CHOICE_TYPE rather than integer page numbers?

@Namrata7199
Copy link
Author

OK... I'll try changing

Copy link
Contributor

@rohitvarkey rohitvarkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nits on coding style.

@@ -123,18 +123,19 @@ class Author(models.Model):
blurb = MarkdownField()

def __str__(self):
return self.name
return self.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Follow 4 space indents to match the rest of the file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


def __str__(self):
return self.title
TYPE_OF_BLOG=[(1,'travel'),(2,'fineprint'),(3,'literarypage'),(4,'techpost')]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Try and put spaces between operators and space out these long lists when possible! Something like the following looks nicer and is easier to add on to in the future.

TYPE_OF_BLOG = [
    (1, 'travel'),
    (2, 'fineprint'),
    (3, 'literarypage'),
    (4, 'techpost')
]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

def __str__(self):
return self.title
TYPE_OF_BLOG=[(1,'travel'),(2,'fineprint'),(3,'literarypage'),(4,'techpost')]
page=models.IntegerField(default=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: page = mo...

page=models.IntegerField(default=0)
title = models.CharField(max_length=200)
author = models.ForeignKey(Author)
article_pic = models.ImageField(upload_to='article_pics/%Y-%m-%d/',null=True,blank=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: , null = True, blank = True

spaces and maybe break this into multiple lines?

@@ -10,8 +10,11 @@
url(r'^announce/(?P<id>[0-9]+)/$', views.announcement, name='eachAnnouncement'),
url(r'^contacts/',views.ContactNumbers.as_view(),name='contacts'),
url(r'^nitk_life/', views.NitkLifePage.as_view(), name='nitk_life'),
url(r'^blog/$', views.blogPage, name='blogs'),
url(r'^blog/(?P<num>[0-9]+)/$', views.blogPage, name='eachBlog'),
# url(r'^(P<pagename>["travel"])/$', views.blogPage, name='travel'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these comments needed?

articles = Articles.objects.all().order_by('-published')
return render(request,'blog.html',{'article':articles})

def blogPage(request,pagename="blog"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spacing - request, p

return render(request,'blog.html',{'article':articles})

def blogPage(request,pagename="blog"):
blogtype = pagename
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the default page showing all blogs.


def blogPage(request,pagename="blog"):
blogtype = pagename
if pagename=="travel":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing nits

articles = Articles.objects.all().order_by('-published')
return render(request,'blog.html',{'article':articles , 'blogtype' : blogtype})

def blogIndex(request,num):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing nits


def blogIndex(request,num):
article=Articles.objects.get(id=num)
return render(request,'article.html',{'article':article})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add another line below this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants