First commit
This commit is contained in:
parent
96cbca7644
commit
d24b176039
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
__pycache__/*
|
||||
db.sqlite3
|
||||
*.pyc
|
||||
*.egg-info
|
||||
dist
|
||||
script
|
@ -1,2 +1,7 @@
|
||||
# Djangoldp Notifications
|
||||
# Synopsis
|
||||
This module is an add-on for Django REST Framework, based on Django LDP add-on. It serves django models for a notifications component, respecting the Linked Data Platform convention.
|
||||
It aims at enabling people with little development skills to serve their own data, to be used with a LDP application.
|
||||
|
||||
# Models
|
||||
## Notification
|
||||
A object representing a notification
|
1
djangoldp_notifications/__init__.py
Normal file
1
djangoldp_notifications/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
name = "djangoldp_notifications"
|
4
djangoldp_notifications/admin.py
Normal file
4
djangoldp_notifications/admin.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.contrib import admin
|
||||
from .models import Notification
|
||||
|
||||
admin.site.register(Notification)
|
4
djangoldp_notifications/apps.py
Normal file
4
djangoldp_notifications/apps.py
Normal file
@ -0,0 +1,4 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
class DjangoldpNotificationsConfig(AppConfig):
|
||||
name = 'djangoldp_notifications'
|
36
djangoldp_notifications/migrations/0001_initial.py
Normal file
36
djangoldp_notifications/migrations/0001_initial.py
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11 on 2019-01-08 08:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
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='Notification',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('object', models.URLField()),
|
||||
('type', models.CharField(max_length=255)),
|
||||
('summary', models.TextField()),
|
||||
('date', models.DateTimeField(auto_now_add=True)),
|
||||
('read', models.BooleanField()),
|
||||
('author_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='author', to=settings.AUTH_USER_MODEL)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['date'],
|
||||
'permissions': (('view_notification', 'Read'), ('control_notification', 'Control')),
|
||||
},
|
||||
),
|
||||
]
|
0
djangoldp_notifications/migrations/__init__.py
Normal file
0
djangoldp_notifications/migrations/__init__.py
Normal file
22
djangoldp_notifications/models.py
Normal file
22
djangoldp_notifications/models.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
class Notification(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='user')
|
||||
author_user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='author')
|
||||
object = models.URLField()
|
||||
type = models.CharField(max_length=255)
|
||||
summary = models.TextField()
|
||||
date = models.DateTimeField(auto_now_add=True)
|
||||
read = models.BooleanField()
|
||||
class Meta:
|
||||
permissions = (
|
||||
('view_notification', 'Read'),
|
||||
('control_notification', 'Control'),
|
||||
)
|
||||
auto_author = 'author_user'
|
||||
ordering = ['date']
|
||||
|
||||
def __str__(self):
|
||||
return '{}'.format(self.type)
|
9
djangoldp_notifications/urls.py
Normal file
9
djangoldp_notifications/urls.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""djangoldp_notifications URL Configuration"""
|
||||
from django.conf.urls import url
|
||||
from .models import Notification
|
||||
from djangoldp.views import LDPViewSet
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^notifications/', LDPViewSet.urls(model=Notification)),
|
||||
]
|
15
setup.py
Normal file
15
setup.py
Normal file
@ -0,0 +1,15 @@
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# allow setup.py to be run from any path
|
||||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
|
||||
|
||||
setup(name='djangoldp_notifications',
|
||||
version='0.0.1',
|
||||
description='djangoldp package for notifications data models',
|
||||
url='https://git.happy-dev.fr/startinblox/djangoldp-packages/djangoldp-notifications',
|
||||
author="Startin'blox",
|
||||
author_email='matthieu@happy-dev.fr',
|
||||
license='MIT',
|
||||
packages=find_packages(),
|
||||
zip_safe=False)
|
Loading…
Reference in New Issue
Block a user