PKbDIB-plugs_post/views.pyfrom rest_framework import viewsets from rest_framework import permissions from plugs_post import models from plugs_post import serializers class PostViewSet(viewsets.ReadOnlyModelViewSet): """ Post Viewset """ queryset = models.Post.objects.all() serializer_class = serializers.PostSerializer permission_classes = [permissions.AllowAny] lookup_field = 'slug' class PostSectionViewSet(viewsets.ReadOnlyModelViewSet): """ Post Section Viewset """ queryset = models.PostSection.objects.all() serializer_class = serializers.PostSectionSerializer permission_classes = [permissions.AllowAny] lookup_field = 'slug' PK:XIbԖplugs_post/serializers.pyfrom rest_framework import serializers from plugs_post.models import Post, PostSection class PostSerializer(serializers.ModelSerializer): """ Post Serializer """ class Meta: """ Metaclass definition """ model = Post fields = ('id', 'name', 'text', 'section', 'slug', 'created', 'updated') read_only_fields = ('slug', ) class PostSectionSerializer(serializers.ModelSerializer): """ Post Section Serializer """ class Meta: """ Metaclass definition """ model = PostSection fields = ('id', 'name', 'description', 'slug', 'created', 'updated') PKCIIxxplugs_post/models.pyfrom django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ from plugs_core import mixins class Post(mixins.Timestampable, mixins.Slugable, models.Model): """ Post model """ name = models.CharField(max_length=100) text = models.TextField() section = models.ForeignKey('PostSection', null=True, blank=True) author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True) def __str__(self): """ Python3 string representation """ return self.name @property def slug_source(self): return self.name # pylint: disable=R0903 class Meta: """ Providing verbose names is recommended if we want to use i18n in admin site """ verbose_name = _("post") verbose_name_plural = _("posts") class PostSection(mixins.Timestampable, mixins.Slugable, models.Model): """ Post Section model """ name = models.CharField(max_length=100) description = models.CharField( max_length=255, help_text='Short description of the type of contents to be published in this section.', null=True, blank=True) def __str__(self): """ Python3 string representation """ return self.name @property def slug_source(self): return self.name # pylint: disable=R0903 class Meta: """ Providing verbose names is recommended if we want to use i18n in admin site """ verbose_name = _("post section") verbose_name_plural = _("post sections") PK%BIsrrplugs_post/apps.py# -*- coding: utf-8 from django.apps import AppConfig class PlugsPostConfig(AppConfig): name = 'plugs_post' PK.J`plugs_post/__init__.py__version__ = '0.1.1' PKhFIz plugs_post/admin.pyfrom django.contrib import admin from plugs_post import models class PostAdmin(admin.ModelAdmin): """ Post Model Admin """ list_display = ('name', 'author', 'created', 'updated') list_filter = ('author', ) search_fields = ('name', ) readonly_fields = ('slug', 'created', 'updated') class PostSectionAdmin(admin.ModelAdmin): """ Post Section Model Admin """ list_display = ('name', 'slug', 'created', 'updated') search_fields = ('name', ) readonly_fields = ('slug', 'created', 'updated') admin.site.register(models.Post, PostAdmin) admin.site.register(models.PostSection, PostSectionAdmin) PK%BI$plugs_post/static/css/plugs_post.cssPK%BI"plugs_post/static/js/plugs_post.jsPK:XI!plugs_post/migrations/__init__.pyPK:XI~%plugs_post/migrations/0001_initial.py# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-12-29 08:56 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='Post', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('slug', models.SlugField(max_length=75, unique=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('name', models.CharField(max_length=100)), ('text', models.TextField()), ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name': 'post', 'verbose_name_plural': 'posts', }, ), migrations.CreateModel( name='PostSection', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('slug', models.SlugField(max_length=75, unique=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('name', models.CharField(max_length=100)), ('description', models.CharField(blank=True, help_text='Short description of the type of contents to be published in this section.', max_length=255, null=True)), ], options={ 'verbose_name': 'post section', 'verbose_name_plural': 'post sections', }, ), migrations.AddField( model_name='post', name='section', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='plugs_post.PostSection'), ), ] PK%BI)plugs_post/templates/plugs_post/base.html {% comment %} As the developer of this package, don't place anything here if you can help it since this allows developers to have interoperability between your template structure and their own. Example: Developer melding the 2SoD pattern to fit inside with another pattern:: {% extends "base.html" %} {% load static %} {% block extra_js %} {% block javascript %} {% endblock javascript %} {% endblock extra_js %} {% endcomment %} PK;.J>rwYY*plugs_post-0.1.1.dist-info/DESCRIPTION.rst============================= Plugs Post ============================= .. image:: https://badge.fury.io/py/plugs-post.png :target: https://badge.fury.io/py/plugs-post .. image:: https://travis-ci.org/yo-solo/plugs-post.png?branch=master :target: https://travis-ci.org/yo-solo/plugs-post .. image:: https://codecov.io/github/yo-solo/plugs-post/coverage.svg?branch=master :target: https://codecov.io/github/yo-solo/plugs-post?branch=master Quick start ----------- 1. Install using Pip .. code-block:: bash $ pip install plugs_post 2. Add it to INSTALLED_APPS .. code-block:: python INSTALLED_APPS = ( # other apps 'plugs_post' ) 3. Run migrate .. code-block:: bash $ python manage.py migrate plugs_post 4. Register the Viewsets .. code-block:: python from plugs_post.views import PostViewSet, PostSectionViewSet ROUTER = routers.DefaultRouter() ROUTER.register(r'posts', PostViewSet) ROUTER.register(r'post_sections', PostSectionViewSet) urlpatterns = [ url(r'^', include(ROUTER.urls)) ] History ------- 0.1.0 (2016-12-29) ++++++++++++++++++ * First release on PyPI. PK;.J`N(plugs_post-0.1.1.dist-info/metadata.json{"classifiers": ["Development Status :: 3 - Alpha", "Framework :: Django", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5"], "extensions": {"python.details": {"contacts": [{"email": "ricardolobo@soloweb.pt", "name": "Ricardo Lobo", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/ricardolobo/plugs-post"}}}, "extras": [], "generator": "bdist_wheel (0.26.0)", "keywords": ["plugs-post"], "license": "MIT", "metadata_version": "2.0", "name": "plugs-post", "run_requires": [{"requires": ["django-model-utils (>=2.0)", "plugs-core (>=0.1.6)"]}], "summary": "Your project description goes here", "version": "0.1.1"}PK;.J2ܚy (plugs_post-0.1.1.dist-info/top_level.txtplugs_post PK;.Jndnn plugs_post-0.1.1.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any PK;.J`'#plugs_post-0.1.1.dist-info/METADATAMetadata-Version: 2.0 Name: plugs-post Version: 0.1.1 Summary: Your project description goes here Home-page: https://github.com/ricardolobo/plugs-post Author: Ricardo Lobo Author-email: ricardolobo@soloweb.pt License: MIT Keywords: plugs-post Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Framework :: Django Classifier: Framework :: Django :: 1.9 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Natural Language :: English Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Requires-Dist: django-model-utils (>=2.0) Requires-Dist: plugs-core (>=0.1.6) ============================= Plugs Post ============================= .. image:: https://badge.fury.io/py/plugs-post.png :target: https://badge.fury.io/py/plugs-post .. image:: https://travis-ci.org/yo-solo/plugs-post.png?branch=master :target: https://travis-ci.org/yo-solo/plugs-post .. image:: https://codecov.io/github/yo-solo/plugs-post/coverage.svg?branch=master :target: https://codecov.io/github/yo-solo/plugs-post?branch=master Quick start ----------- 1. Install using Pip .. code-block:: bash $ pip install plugs_post 2. Add it to INSTALLED_APPS .. code-block:: python INSTALLED_APPS = ( # other apps 'plugs_post' ) 3. Run migrate .. code-block:: bash $ python manage.py migrate plugs_post 4. Register the Viewsets .. code-block:: python from plugs_post.views import PostViewSet, PostSectionViewSet ROUTER = routers.DefaultRouter() ROUTER.register(r'posts', PostViewSet) ROUTER.register(r'post_sections', PostSectionViewSet) urlpatterns = [ url(r'^', include(ROUTER.urls)) ] History ------- 0.1.0 (2016-12-29) ++++++++++++++++++ * First release on PyPI. PK;.J}Ҟ!plugs_post-0.1.1.dist-info/RECORDplugs_post/__init__.py,sha256=ls1camlIoMxEZz9gSkZ1OJo-MXqHWwKPtdPbZJmwp7E,22 plugs_post/admin.py,sha256=Fyhz3pyI4q6-pKj_JBVHKOBhC5h4G2PF4Bz_uZWpUyQ,648 plugs_post/apps.py,sha256=N0ptzpqnkNq0olv4krDL3xWz8JYZqgg7p7o2gZLhl8k,114 plugs_post/models.py,sha256=aYR2jiDL8NH4Iba65AgbqZZZt9femHvJRWoxRr_oumg,1656 plugs_post/serializers.py,sha256=0No9ADH9ULDpivmm1qwod_0Vxq0zw44mpLPg89bdL3Y,662 plugs_post/views.py,sha256=xoJgLEzrKz0py2CVTmd3piEqn2OOL7F8ZdYRaq1ig4c,670 plugs_post/migrations/0001_initial.py,sha256=mwE5oAnP1hrKt6mJXcR37L0M2oqQeE4ZhVia2_Vwsag,2250 plugs_post/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 plugs_post/static/css/plugs_post.css,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 plugs_post/static/js/plugs_post.js,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 plugs_post/templates/plugs_post/base.html,sha256=zzaUPjEgvwxg-Gn2rZ6gIMWphucmEGvAU_skUXJIcDA,661 plugs_post-0.1.1.dist-info/DESCRIPTION.rst,sha256=1lkxQYmVuypsmyTG8J5Z1_0qvpSg0tEmcMs8ATJQ6aQ,1369 plugs_post-0.1.1.dist-info/METADATA,sha256=LKrc8IlCJ107yEMI-md8SHGs0-kOrF8vvGlqNMH9gEQ,2205 plugs_post-0.1.1.dist-info/RECORD,, plugs_post-0.1.1.dist-info/WHEEL,sha256=GrqQvamwgBV4nLoJe0vhYRSWzWsx7xjlt74FT0SWYfE,110 plugs_post-0.1.1.dist-info/metadata.json,sha256=Vxg73HpRMghhJIDvC3BYQeODckURi-f52Nk3w4Cchlw,971 plugs_post-0.1.1.dist-info/top_level.txt,sha256=oPRTIznogDi9rume-jfnAkCMEZKk44zPuOc6nFBWxXk,11 PKbDIB-plugs_post/views.pyPK:XIbԖplugs_post/serializers.pyPKCIIxxplugs_post/models.pyPK%BIsrrF plugs_post/apps.pyPK.J` plugs_post/__init__.pyPKhFIz 2 plugs_post/admin.pyPK%BI$plugs_post/static/css/plugs_post.cssPK%BI"-plugs_post/static/js/plugs_post.jsPK:XI!mplugs_post/migrations/__init__.pyPK:XI~%plugs_post/migrations/0001_initial.pyPK%BI)plugs_post/templates/plugs_post/base.htmlPK;.J>rwYY*plugs_post-0.1.1.dist-info/DESCRIPTION.rstPK;.J`N(6"plugs_post-0.1.1.dist-info/metadata.jsonPK;.J2ܚy (G&plugs_post-0.1.1.dist-info/top_level.txtPK;.Jndnn &plugs_post-0.1.1.dist-info/WHEELPK;.J`'#D'plugs_post-0.1.1.dist-info/METADATAPK;.J}Ҟ!"0plugs_post-0.1.1.dist-info/RECORDPK5