semvec/pypi-packages huggingface dataset:
django-marketing-urls 1.0.1
An app to generate marketing urls for Django projects.
Requires Python: >=3.6

# Django Marketing Urls

## Description
An app to generate marketing urls for Django projects. It allows you to create marketing urls with a unique token that can be used to track the source of the traffic.


## Installation
   
    pip install django-marketing-urls

### in settings.py

    INSTALLED_APPS = [
        ...
        'marketing_urls',
        ...
    ]

### in urls.py

    urlpatterns = [
        ...
        path('marketing/', include('marketing_urls.urls')),
        ...
    ]
    
## Usage
    
### Create a marketing url

    from marketing_urls.models import MarketingUrl
    
    MarketingUrl.objects.create(original_url='https://example.com')
   

### Get the marketing url
    
        m_url = MarketingUrl.objects.get(original_url='https://example.com')
        print(m_url.marketing_url)
        
        # if you want to add extra information to the url
        from urltoken.encoder import UrlTokenEncoder
        
        token_encoder = UrlTokenEncoder('secretkey') # secretkey could be set in OS environment variable from 'URL_TOKEN_SECRET', or just leave it is None
        url_token = token_encoder.encode('my_extra_info_here')
        url_with_extra_info = m_url.marketing_url + '?t=' + url_token
        print(url_with_extra_info)


## Issues
https://github.com/laonan/django-marketing-url/issues
markdown-mdantic 2.1.1
Python-Markdown extension for rendering pydantic BaseModel as table

# Mdantic

This is an extension to [Python-Markdown](https://python-markdown.github.io/). It adds a new syntax so that you can reference a [pydantic](https://pydantic-docs.helpmanual.io/) `BaseModel` and translate its fields to a markdown table. (Get the name?) I originally make this to generate http api parameter tables with [mkdocs](https://www.mkdocs.org/), but you can use it for other stuffs if suitable.

The code itself is a direct modification to [markdown-include](https://github.com/cmacmackin/markdown-include) since they do similar things.

Notice: This project is still WIP and need more examples to adapt to most of the possible BaseModel models.

## Installation

Just use pip:

```
pip install markdown-mdantic
```

## Usage

### Config options
`init_code` will execute **any** python code in the environment when its `__init__` is called.
In this way you can do something like adding system path, django setup etc,
before run.

**Note**: Please note that the `init_code` thing is a huge security issue if
you run that with untrusted input. Use it with caution!

`columns` is a comma-separated list of table columns to use in each table.
The default is to use all columns `["key", "type", "required", "description", "default"]`.


### mkdocs

example:

```yaml
markdown_extensions:
    mdantic:
        init_code: |
            import os
            import django
            os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.default")
            django.setup()
        columns: [key, type, required, default]
```

Some time ago the extension name used here should be `markdown_mdantic`, but
after some point it seems there will only be one file after installation in
python's site-packages directory (mdantic.py) so now we should use the name
`mdantic`.

### reference the model

Each reference must be in one line, starts with `$pydantic: ` (notice the
single space after the colon), following the model import path which looks
like `a.b.c.D` where `D` is the model class itself (which is subclass of `BaseModel`).

```markdown
**params**:

$pydantic: src.test.TestGetSchema

```

### customize output

The resulting table is rendered using [tabulate](https://pypi.org/project/tabulate/), in `github` style. The `columns` config option can be used to
restrict the columns to show. Styling cannot be changed at the moment. PR is welcomed.