Skip to content

Commit d4b763c

Browse files
committed
Cleaning the not-quite-yet-useful package templating + models update
1 parent cc2e6a4 commit d4b763c

32 files changed

+66
-1237
lines changed

.coveragerc

-11
This file was deleted.

.editorconfig

-23
This file was deleted.

.github/ISSUE_TEMPLATE.md

-16
This file was deleted.

.travis.yml

-23
This file was deleted.

AUTHORS.rst

-5
This file was deleted.

CONTRIBUTING.rst

-112
This file was deleted.

HISTORY.rst

-9
This file was deleted.

MANIFEST.in

-6
This file was deleted.

Makefile

-59
This file was deleted.

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Django Panpub
2+
3+
Django publishing system, multi-inputs towards streamlined outputs.
4+
5+
6+
## Features roadmap
7+
8+
* Content model and Author model, claim system
9+
* Text model: pandoc-fed input, .md or .rst output
10+
* Picture model: Pillow-fed input, .png output
11+
* Tag/Post relation and use for url/search
12+
* panpub init/first_boot view: first settings (static or dynamic output, upload limitations, etc.), pandoc check/download

README.rst

-25
This file was deleted.

django_panpub/models.py

+53-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,71 @@
11
# -*- coding: utf-8 -*-
22

33
from django.db import models
4+
from django.contrib.auth.models import User
5+
from django.db.models.signals import post_save
6+
from django.dispatch import receiver
47

58
from model_utils.models import TimeStampedModel
69

710

8-
class Post(TimeStampedModel):
11+
class Crafter(models.Model):
12+
user = models.OneToOneField(User, on_delete=models.CASACADE)
13+
14+
15+
class Content(TimeStampedModel):
16+
name = models.CharField(max_length=100)
17+
claims = models.ManyToManyField(
18+
Crafter,
19+
through='Claim',
20+
through_fields=('content', 'crafter'),
21+
)
22+
23+
24+
class Text(Content):
925
pass
10-
1126

12-
class Text(TimeStampedModel):
27+
28+
class Picture(Content):
1329
pass
14-
1530

16-
class Picture(TimeStampedModel):
31+
32+
class Audio(Content):
1733
pass
18-
1934

20-
class Audio(TimeStampedModel):
35+
36+
class OutsideLink(models.Model):
2137
pass
22-
2338

24-
class Tag(TimeStampedModel):
39+
40+
class Claim(models.Model):
41+
CREATOR = 'CR'
42+
CURATOR = 'CU'
43+
MEDIATOR = 'ME'
44+
CLAIMS = (
45+
(CREATOR, 'Creator'),
46+
(CURATOR, 'Curator'),
47+
(MEDIATOR, 'Mediator'),
48+
)
49+
content = models.ForeignKey(Content, on_delete=models.CASCADE)
50+
crafter = models.ForeignKey(Crafter, on_delete=models.CASCADE)
51+
claim_type = models.CharField(
52+
max_length=2,
53+
choices=CLAIMS,
54+
default=CREATOR
55+
)
56+
57+
58+
class Tag(models.Model):
2559
pass
26-
2760

2861

62+
@receiver(post_save, sender=User)
63+
def create_crafter(sender, instance, created, **kwargs):
64+
if created:
65+
Crafter.objects.create(user=instance)
66+
67+
68+
@receiver(post_save, sender=User)
69+
def update_crafter(sender, instance, **kwargs):
70+
instance.crafter.save()
71+

0 commit comments

Comments
 (0)