-
Notifications
You must be signed in to change notification settings - Fork 9
Hacker-news #5
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
base: master
Are you sure you want to change the base?
Hacker-news #5
Changes from 1 commit
125bce7
c143006
34977c3
6e47f51
74cea4f
599a615
4f89553
27a1fdd
ccbcd9e
1ac5b6d
1991091
ff7d686
52de0fc
2793e89
b501917
427a6e9
1b67b5e
1130383
962b631
2913309
1550e22
d319f4b
fde798d
958bf8a
0f33115
98b57b7
aaec6f1
a1004c1
7d06059
ce4dd7a
0940232
9108790
0da22c2
7d8a8f9
be06eae
01d6ee7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,3 +146,6 @@ staticfiles/* | |
| oksp/settings/conf.py | ||
|
|
||
| docupload/docs/* | ||
|
|
||
| #PyCharm local config | ||
| .idea/* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from django.contrib import admin | ||
|
|
||
| # Register your models here. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class HackerNewsConfig(AppConfig): | ||
| name = 'hacker_news' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by Django 1.9.5 on 2016-05-05 12:16 | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='News', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('title', models.CharField(max_length=300)), | ||
| ], | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from django.db import models | ||
|
|
||
| class News(models.Model): | ||
| ''' | ||
| News: Model class which holds all the shared links | ||
| ''' | ||
|
|
||
| title = models.CharField(max_length=300) | ||
| link = models.URLField | ||
| comments = models.IntegerField | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is comment model? Are we not supporting comments as of now?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And also include absolute url for the news. |
||
| upvotes = models.IntegerField | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from django.test import TestCase | ||
|
|
||
| # Create your tests here. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from django.conf.urls import url | ||
|
|
||
| from hacker_news.views import NewsListView | ||
|
|
||
| urlpatterns = [ | ||
| url(r'^$', NewsListView.as_view(), name='news_list'), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from django.shortcuts import render | ||
| from django.views.generic import ListView | ||
|
|
||
| from hacker_news.models import News | ||
|
|
||
|
|
||
| class NewsListView(ListView): | ||
| queryset = News.objects.order_by("-date")[:10] | ||
| template_name = 'hacker-news/news.html' | ||
| context_object_name = 'news' |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o.O ? Be careful what you push!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep this line? Intentionally delete kiya hai