Skip to content

Commit

Permalink
Created a django project for JUET notice board 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
richeshgupta committed Mar 23, 2019
0 parents commit 5547668
Show file tree
Hide file tree
Showing 50 changed files with 806 additions and 0 deletions.
Binary file added notice/db.sqlite3
Binary file not shown.
15 changes: 15 additions & 0 deletions notice/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notice.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
Empty file added notice/notice/__init__.py
Empty file.
Binary file added notice/notice/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added notice/notice/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added notice/notice/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added notice/notice/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
122 changes: 122 additions & 0 deletions notice/notice/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"""
Django settings for notice project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'qlce-n9r(u*^5=d=r$3eewm(_6q(6^m40cn093p2_^l=(ncf7@'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'notice.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'notice.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = 'notice'
28 changes: 28 additions & 0 deletions notice/notice/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""notice URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.contrib.auth import views as auth_views
from users.views import post,index,menu,not_logged_in
urlpatterns = [
path('admin/', admin.site.urls),
path('',menu,name='menu'),
path('login/',auth_views.LoginView.as_view(template_name='users/login.html'),name='login'),
path('logout/',auth_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
path('notice/',post,name='notice'),
path('home/',index,name='home'),
path('not_logged_in/',not_logged_in,name='not_logged_in')
]
16 changes: 16 additions & 0 deletions notice/notice/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for notice project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'notice.settings')

application = get_wsgi_application()
Empty file added notice/users/__init__.py
Empty file.
Binary file added notice/users/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added notice/users/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file added notice/users/__pycache__/forms.cpython-36.pyc
Binary file not shown.
Binary file added notice/users/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file added notice/users/__pycache__/views.cpython-36.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions notice/users/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import NoticeBoard
# Register your models here.
admin.site.register(NoticeBoard)
5 changes: 5 additions & 0 deletions notice/users/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class UsersConfig(AppConfig):
name = 'users'
9 changes: 9 additions & 0 deletions notice/users/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django import forms
from django.contrib.auth.models import User
from .models import NoticeBoard

class Notice_board_class(forms.ModelForm):
class Meta:
model = NoticeBoard
fields= ['title','notice','date',]

27 changes: 27 additions & 0 deletions notice/users/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 2.1 on 2019-03-22 14:42

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='NoticeBoard',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100)),
('notice', models.CharField(default='', max_length=1000)),
('url', models.URLField(default='')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
18 changes: 18 additions & 0 deletions notice/users/migrations/0002_auto_20190322_1453.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1 on 2019-03-22 14:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='noticeboard',
name='url',
field=models.URLField(blank=True, default=''),
),
]
18 changes: 18 additions & 0 deletions notice/users/migrations/0003_auto_20190322_1501.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1 on 2019-03-22 15:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0002_auto_20190322_1453'),
]

operations = [
migrations.AlterField(
model_name='noticeboard',
name='url',
field=models.URLField(blank=True, default='', null=True),
),
]
18 changes: 18 additions & 0 deletions notice/users/migrations/0004_auto_20190322_1503.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1 on 2019-03-22 15:03

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0003_auto_20190322_1501'),
]

operations = [
migrations.AlterField(
model_name='noticeboard',
name='url',
field=models.URLField(blank=True, null=True),
),
]
18 changes: 18 additions & 0 deletions notice/users/migrations/0005_auto_20190322_1506.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1 on 2019-03-22 15:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0004_auto_20190322_1503'),
]

operations = [
migrations.AlterField(
model_name='noticeboard',
name='url',
field=models.URLField(default=''),
),
]
17 changes: 17 additions & 0 deletions notice/users/migrations/0006_remove_noticeboard_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.1 on 2019-03-22 15:32

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('users', '0005_auto_20190322_1506'),
]

operations = [
migrations.RemoveField(
model_name='noticeboard',
name='url',
),
]
17 changes: 17 additions & 0 deletions notice/users/migrations/0007_remove_noticeboard_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.1 on 2019-03-22 15:33

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('users', '0006_remove_noticeboard_url'),
]

operations = [
migrations.RemoveField(
model_name='noticeboard',
name='user',
),
]
19 changes: 19 additions & 0 deletions notice/users/migrations/0008_noticeboard_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.1 on 2019-03-22 19:40

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('users', '0007_remove_noticeboard_user'),
]

operations = [
migrations.AddField(
model_name='noticeboard',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions notice/users/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.db import models
from django.contrib.auth.models import User
from django.shortcuts import render
from django.utils import timezone
# Create your models here.
class NoticeBoard(models.Model):
title = models.CharField(max_length=100)
notice = models.TextField(max_length=1000,default='')
date = models.DateTimeField(default = timezone.now)
Binary file added notice/users/static/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions notice/users/templates/users/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends 'nav.html' %}
11 changes: 11 additions & 0 deletions notice/users/templates/users/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends 'users/nav.html' %}
{% block content %}
{% for datas in data %}
<h1>{{ datas.title }}</h1>
<h4>{{ datas.date }}</h4>
<br />
<p>{{ datas.notice }}</p>
<br /><hr /><br />

{% endfor %}
{% endblock content %}
Loading

0 comments on commit 5547668

Please sign in to comment.