Skip to main content

This package provides a Django model field that can store both absolute and relative URLs

Project description

Django URL or Relative URL Field

This package extends default Django URLField to support relative URLs.


  1. Install the python package django-url-or-relative-url-field from pip:

    pip install django-url-or-relative-url-field

    Alternatively, you can install download or clone this repo and call pip install -e ..

  2. Add to INSTALLED_APPS in your



Add field to the model:

from django.db import models
from url_or_relative_url_field.fields import URLOrRelativeURLField

class Redirect(models.Model):
   url = URLOrRelativeURLField()

Now your model will accept both absolute and relative URLs into the url field.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-url-or-relative-url-field-0.2.0.tar.gz (3.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page