Skip to main content

Banner

Reaktion's banner plugin for Django

Setup

Project requirements.txt

  • The following need to be installed in the environment & be in the requirements.txt:
    • pytz
    • djangorestframework
    • pillow
    • icecream

Project Settings

  • Add "banner" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
          ...
   
        'banner',
   
      ]
  • Add the following context processors to your OPTIONS in TEMPLATE settings and add a banner endpoint variable:
'OPTIONS': {
        'context_processors': [
            ...
            'banner.processors.banner_endpoint',
            'banner.processors.banner_sidebar_right',
            'banner.processors.banner_sidebar_left',
            'banner.processors.banner_content',
            'banner.processors.banner_bottom',
            'banner.processors.banner_top'
        ]
    }

BANNERS_ENDPOINT = os.environ['BANNERS_ENDPOINT']
  1. Include the banner URL conf in your project urls.py like this::
    path('banner/', include('banner.urls')),
    path('api/', include('banner.api_urls', namespace='banner-api')),

Project css/scss

  • Define the css styles in styles.scss
.sticky-top-alt {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.label-over-ad {
  position: absolute;
  top: 0;
  left: 0;
  font-weight: 700;
  font-size: 10px;
  padding: 3px 10px 3px 10px;
  background: #135776;
  border-radius: 0 1px 1px 0;
  opacity: 0.80;
  color: white;
  border-bottom: 0;
  font-family: "Raleway";
}

.panorama-ad-div {
  width: 100vw;
  height:auto;
  max-height: 240px;
  object-fit: cover;
  background: #135776;
  &:hover {
    cursor: pointer;
  }
}

.panorama-ad-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  aspect-ratio: 0;
}

.leaderboard-ad-div {
  width: 100vw;
  height:auto;
  max-height: 90px;
  object-fit: contain;
  &:hover {
    cursor: pointer;
  }
}

.leaderboard-ad-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 90px;
  object-fit: contain;
  aspect-ratio: 0;
}

.skyscraper-ad-left-div {
  max-width: 160px;
  &:hover {
    cursor: pointer;
  }
}

.skyscraper-ad-left-image {
  max-width: 160px;
  aspect-ratio: auto!important;
}

.skyscraper-ad-right-div{
  max-width: 160px;
}

.skyscraper-ad-right-image{
  max-width: 160px;
  aspect-ratio: auto!important;
  &:hover {
    cursor: pointer;
  }
}

Run python manage.py migrate to create the banner models.

  • For a docker environment run the following two commands:
   docker exec <container name> python cms/manage.py migrate
   docker exec <container name> pip install -r requirements.txt 

Metadata

Release files for django-reaktion-banner 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-reaktion-banner 0.0.8
File Size Uploaded Provenance Actions
django_reaktion_banner-0.0.8.tar.gz 18.3 kB Without provenance Details for django_reaktion_banner-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-reaktion-banner 0.0.8
File Interpreter ABI Platform Actions
django_reaktion_banner-0.0.8-py3-none-any.whl Python 3 none any Details for django_reaktion_banner-0.0.8-py3-none-any.whl

Total release size: 49.5 kB

Release files / django_reaktion_banner-0.0.8.tar.gz

Download URL django_reaktion_banner-0.0.8.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7aa9da121b7ded6a996a830f746d6ff8c8be6ca4f1279c95d60aebfc0b0935dc
BLAKE2b-256 checksum
How to use checksums
1a61eb18c8437fd663e3f17ce7578f6af36e43eea98927b9102d066690b1de44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

Release files / django_reaktion_banner-0.0.8-py3-none-any.whl

Download URL django_reaktion_banner-0.0.8-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0283d6c4792adda006c3750bf2cf019875a28aee5727aa41d504d8005c36ce7c
BLAKE2b-256 checksum
How to use checksums
5e645f6f3283ed6f4149022ace3323348b5879900130b606ec96dea7996a3eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

Security for django-reaktion-banner 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page