Skip to main content

Django helpers.

Project description

Install

$ pip install django-garpix-helpers

Using

ActiveManager

Get only active objects.

In your model:

from garpix_helpers import ActiveModel

class MyModel(ActiveModel):
    ...

Querieng:

MyModel.active_objects.filter(…)

or

MyModel.objects.filter(is_active=True)

Querieng:

MyModel.active_objects.filter(...)

Abstract Models

  • ActiveModel
  • CreatedUpdatedModel
  • ImageModel
  • ImageRequiredModel
  • TitleModel
  • TitleRequiredModel

See sources for explanation.

get_file_path

Slugified file names:

/uploads/YEAR/MONTH/SLUGIFIED_FILENAME.EXTENSION

In your model:

from garpix_helpers import get_file_path

class MyModel(models.Model):
    ...
    image = models.ImageField(upload_to=get_file_path)

License

MIT

Project details


Download files

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

Files for django-garpix-helpers, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size django-garpix-helpers-0.1.3.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page