semvec/pypi-packages huggingface dataset:
djsuperadmin 0.11.3
Edit contents directly on your page with Django
License: MIT
Requires Python: >=3.0.*
Keywords: cms,django,api cms

# DjSuperAdmin [![PyPI](https://img.shields.io/pypi/v/djsuperadmin?style=flat-square)](https://pypi.org/project/djsuperadmin/) ![Codecov](https://img.shields.io/codecov/c/github/lotrekagency/djsuperadmin?style=flat-square) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lotrekagency/djsuperadmin/Test,%20Coverage%20and%20Release?style=flat-square) [![GitHub](https://img.shields.io/github/license/lotrekagency/camomilla?style=flat-square)](./LICENSE)

✍🏻 Edit contents directly on your page with Django


## Here how it works!

<img src="https://github.com/lotrekagency/djsuperadmin/raw/master/demo.gif" alt="DjSuperAdmin demo" style="width: 100%;">

## Installation

```sh
pip install djsuperadmin
```

## Setup

Add `djsuperadmin` to your `INSTALLED_APPS` in `settings.py`

```py
INSTALLED_APPS = [
    # ...
    'djsuperadmin'
]
```

And import all the required js files in the footer

```html
{% load djsuperadmintag %}

{% djsuperadminjs %}
```

## Usage

Define your `custom Content` model using `DjSuperAdminMixin` and provide an endpoint to GET/PATCH your content

```py
from django.db import models
from djsuperadmin.mixins import DjSuperAdminMixin


class GenericContent(models.Model, DjSuperAdminMixin):

    identifier = models.CharField(max_length=200, unique=True)
    content = models.TextField()

    @property
    def superadmin_get_url(self):
        return f'/api/content/{self.pk}'

    @property
    def superadmin_patch_url(self):
        return f'/api/content/{self.pk}'
```

Then in your template

```html
{% load djsuperadmintag %}

...

<body>
    <p>
        {% superadmin_content your_object 'your_object_attribute' %}
    </p>
</body>
```
singleton-simple 1.1.1
Create singletons types in a simple way!
License: MIT
Requires Python: >=3.7,<4.0
Keywords: singleton,type

- [Singleton Type](#singleton-simple)
- [Install](#install)
- [Overview](#overview)
    * [Example](#example)
- [Licensing](#licensing)


# Singleton Type

Allows for creation of formal custom special sentinel types,
or singletons for other uses cases.

Ensures there can only ever be one instance.


# Install

```bash
# via pip
pip install singleton-simple

# via poetry
poetry add singleton-simple
```

# Overview

Allows for creation of formal custom special sentinel types,
similar to how `None` and `NoneType` are like.

Used to in other libraries such as `null-type`, and `default-type`.

Can also be used to create true singleton for other purposes than being sentinels.

## Example

Here is an example of using Singleton to easily make a safe sentinel object:

```python
from singleton_simple import Singleton
import os

class DefaultType(Singleton):
    pass

# You can import this into other places and know there can only ever by one
# instance of DefaultType (and so can safely use the `is` operator with it):
Default = DefaultType()

# Ensures there can only ever by one 'instance' of the Singleton subclass:
assert Default is DefaultType()

...

# Example use Default Sentinel:

def my_method(some_param = Default):
    # Can tell the difference between `None` and `Default` via sentinel object,
    # So we can resolve the `Default` value however we wish that makes sense:
    if some_param is Default:
        some_param = os.environ.get("SOME_PARAM", None)
    # Do something with `some_param`, now that any `Default` value has been resolved.
    ...
```


# Licensing

MIT