Skip to content

Commit 7a23631

Browse files
Merge pull request #6 from djsbalakrishnan/dhiraj
added bookmarks functionaliity
2 parents 28964a7 + c97bac2 commit 7a23631

32 files changed

+9974
-0
lines changed

hackrsource/MOC/MOC/__init__.py

Whitespace-only changes.

hackrsource/MOC/MOC/settings.py

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
"""
2+
Django settings for MOC project.
3+
4+
Generated by 'django-admin startproject' using Django 1.10.1.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.10/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/1.10/ref/settings/
11+
"""
12+
13+
import os
14+
15+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'wc7&t7_q+%d#03qiko=28o5fr=85)zp97+&%--7jjovijdk7xw'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'newsapp',
35+
'django.contrib.admin',
36+
'django.contrib.auth',
37+
'django.contrib.contenttypes',
38+
'django.contrib.sessions',
39+
'django.contrib.messages',
40+
'django.contrib.staticfiles',
41+
]
42+
43+
MIDDLEWARE = [
44+
'django.middleware.security.SecurityMiddleware',
45+
'django.contrib.sessions.middleware.SessionMiddleware',
46+
'django.middleware.common.CommonMiddleware',
47+
'django.middleware.csrf.CsrfViewMiddleware',
48+
'django.contrib.auth.middleware.AuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
]
52+
53+
ROOT_URLCONF = 'MOC.urls'
54+
55+
TEMPLATES = [
56+
{
57+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58+
'DIRS': [],
59+
'APP_DIRS': True,
60+
'OPTIONS': {
61+
'context_processors': [
62+
'django.template.context_processors.debug',
63+
'django.template.context_processors.request',
64+
'django.contrib.auth.context_processors.auth',
65+
'django.contrib.messages.context_processors.messages',
66+
],
67+
},
68+
},
69+
]
70+
71+
WSGI_APPLICATION = 'MOC.wsgi.application'
72+
73+
74+
# Database
75+
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
76+
77+
DATABASES = {
78+
'default': {
79+
'ENGINE': 'django.db.backends.sqlite3',
80+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81+
}
82+
}
83+
84+
85+
# Password validation
86+
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
87+
88+
AUTH_PASSWORD_VALIDATORS = [
89+
{
90+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91+
},
92+
{
93+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
94+
},
95+
{
96+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
97+
},
98+
{
99+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100+
},
101+
]
102+
103+
104+
# Internationalization
105+
# https://docs.djangoproject.com/en/1.10/topics/i18n/
106+
107+
LANGUAGE_CODE = 'en-us'
108+
109+
TIME_ZONE = 'UTC'
110+
111+
USE_I18N = True
112+
113+
USE_L10N = True
114+
115+
USE_TZ = True
116+
117+
118+
# Static files (CSS, JavaScript, Images)
119+
# https://docs.djangoproject.com/en/1.10/howto/static-files/
120+
121+
STATIC_URL = '/static/'

hackrsource/MOC/MOC/urls.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""MOC URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/1.10/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.conf.urls import url, include
14+
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15+
"""
16+
from django.conf.urls import url
17+
from django.contrib import admin
18+
from newsapp import views
19+
20+
urlpatterns = [
21+
url(r'^admin/', admin.site.urls),
22+
url(r'^$', views.home, name="home"),
23+
url(r'^bookmark$',views.bookmark, name="bookmark"),
24+
url(r'^unbookmark$',views.unbookmark, name="unbookmark"),
25+
url(r'^profile/$', views.profile, name="profile"),
26+
]

hackrsource/MOC/MOC/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for MOC project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MOC.settings")
15+
16+
application = get_wsgi_application()

hackrsource/MOC/db.sqlite3

204 KB
Binary file not shown.

hackrsource/MOC/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MOC.settings")
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError:
10+
# The above import may fail for some other reason. Ensure that the
11+
# issue is really that Django is missing to avoid masking other
12+
# exceptions on Python 2.
13+
try:
14+
import django
15+
except ImportError:
16+
raise ImportError(
17+
"Couldn't import Django. Are you sure it's installed and "
18+
"available on your PYTHONPATH environment variable? Did you "
19+
"forget to activate a virtual environment?"
20+
)
21+
raise
22+
execute_from_command_line(sys.argv)

hackrsource/MOC/newsapp/__init__.py

Whitespace-only changes.

hackrsource/MOC/newsapp/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

hackrsource/MOC/newsapp/apps.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import unicode_literals
2+
3+
from django.apps import AppConfig
4+
5+
6+
class NewsappConfig(AppConfig):
7+
name = 'newsapp'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.1 on 2017-06-06 14:14
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
]
14+
15+
operations = [
16+
migrations.CreateModel(
17+
name='tbl_MST_NewsArticle',
18+
fields=[
19+
('articleId', models.AutoField(primary_key=True, serialize=False)),
20+
('author', models.CharField(max_length=30)),
21+
('title', models.CharField(max_length=100)),
22+
('description', models.CharField(max_length=250)),
23+
('url', models.CharField(max_length=50)),
24+
('urlToImage', models.CharField(max_length=80)),
25+
('publishedAt', models.DateField()),
26+
],
27+
),
28+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.1 on 2017-06-06 14:17
3+
from __future__ import unicode_literals
4+
5+
from django.conf import settings
6+
from django.db import migrations, models
7+
import django.db.models.deletion
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
('newsapp', '0001_initial'),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='tbl_TRN_NewsBookmark',
20+
fields=[
21+
('bookmarkId', models.AutoField(primary_key=True, serialize=False)),
22+
('bookmarkedAt', models.DateField()),
23+
('articleId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='newsapp.tbl_MST_NewsArticle')),
24+
('userId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
25+
],
26+
),
27+
migrations.CreateModel(
28+
name='tbl_TRN_NewsComment',
29+
fields=[
30+
('commentId', models.AutoField(primary_key=True, serialize=False)),
31+
('comment', models.CharField(max_length=200)),
32+
('commentedAt', models.DateField()),
33+
('articleId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='newsapp.tbl_MST_NewsArticle')),
34+
('userId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
35+
],
36+
),
37+
migrations.CreateModel(
38+
name='tbl_TRN_NewsLike',
39+
fields=[
40+
('likeId', models.AutoField(primary_key=True, serialize=False)),
41+
('like', models.IntegerField()),
42+
('articleId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='newsapp.tbl_MST_NewsArticle')),
43+
('userId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
44+
],
45+
),
46+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.1 on 2017-06-07 17:01
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('newsapp', '0002_tbl_trn_newsbookmark_tbl_trn_newscomment_tbl_trn_newslike'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='tbl_mst_newsarticle',
17+
name='source',
18+
field=models.CharField(default='', max_length=30),
19+
),
20+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.10.1 on 2017-06-07 17:43
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('newsapp', '0003_tbl_mst_newsarticle_source'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='tbl_mst_newsarticle',
17+
name='author',
18+
field=models.CharField(max_length=30, null=True),
19+
),
20+
migrations.AlterField(
21+
model_name='tbl_mst_newsarticle',
22+
name='description',
23+
field=models.CharField(max_length=250, null=True),
24+
),
25+
migrations.AlterField(
26+
model_name='tbl_mst_newsarticle',
27+
name='publishedAt',
28+
field=models.DateField(null=True),
29+
),
30+
migrations.AlterField(
31+
model_name='tbl_mst_newsarticle',
32+
name='title',
33+
field=models.CharField(max_length=100, null=True),
34+
),
35+
migrations.AlterField(
36+
model_name='tbl_mst_newsarticle',
37+
name='url',
38+
field=models.CharField(max_length=50, null=True),
39+
),
40+
migrations.AlterField(
41+
model_name='tbl_mst_newsarticle',
42+
name='urlToImage',
43+
field=models.CharField(max_length=80, null=True),
44+
),
45+
]

0 commit comments

Comments
 (0)