Skip to content
Snippets Groups Projects
Commit d24b1760 authored by Matthieu Fesselier's avatar Matthieu Fesselier
Browse files

First commit

parent 96cbca76
No related branches found
No related tags found
No related merge requests found
__pycache__/*
db.sqlite3
*.pyc
*.egg-info
dist
script
\ No newline at end of file
# 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
\ No newline at end of file
name = "djangoldp_notifications"
\ No newline at end of file
from django.contrib import admin
from .models import Notification
admin.site.register(Notification)
from django.apps import AppConfig
class DjangoldpNotificationsConfig(AppConfig):
name = 'djangoldp_notifications'
# -*- 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')),
},
),
]
\ No newline at end of file
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)
"""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)),
]
setup.py 0 → 100644
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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment