semvec/pypi-packages huggingface dataset:
r-django-partial-date 1.3.1.1
Django custom model field for partial dates with the form YYYY, YYYY-MM, YYYY-MM-DD
License: MIT
Keywords: fields

======================
r-django-partial-date
======================

Django custom model field for partial dates with the form YYYY, YYYY-MM, YYYY-MM-DD

* Works with DRF
* Supports comparison operations
* Django 3.0 support.

Usage
================

Install the package

.. code:: python

    pip install r-django-partial-date

* partial_date.PartialDateField

A django model field for storing partial dates. Accepts None, a partial_date.PartialDate object, or a formatted string such as YYYY, YYYY-MM, YYYY-MM-DD. In the database it saves the date in a column of type DateTimeField and uses the seconds to save the level of precision.

* class partial_date.PartialDate

Object to represent the partial dates.

Example
===============================

models.py

.. code:: python

    from django.db import models
    from partial_date import PartialDateField

    class TestModel(models.Model):
        some_partial_date = PartialDateField()

.. code:: python

    >>> from partial_date import PartialDate
    >>> from core.models import TestModel
    >>> obj = TestModel(some_partial_date="1995")
    >>> obj.save()
    >>> obj.some_partial_date
    '1995'
    >>> obj.some_partial_date = PartialDate("1995-09")
    >>> obj.save()
    >>> obj.some_partial_date
    1995-09
    >>>

.. code:: python

    >>> from partial_date import PartialDate
    >>> import datetime
    >>> partial_date = PartialDate(datetime.date(2012, 9, 21), precision=PartialDate.DAY)
    >>> partial_date
    2012-09-21
    >>> partial_date.precisionYear()
    False
    >>> partial_date.precisionMonth()
    False
    >>> partial_date.precisionDay()
    True
    >>> partial_date.precision == PartialDate.YEAR
    False
    >>> partial_date.precision == PartialDate.MONTH
    False
    >>> partial_date.precision == PartialDate.DAY
    True
    >>> partial_date.precision = PartialDate.MONTH
    >>> partial_date
    2012-09
    >>> partial_date = PartialDate("2015-11-01")
    >>> partial_date.date
    datetime.date(2015, 11, 1)

.. code:: python

    >>> from partial_date import PartialDate
    >>> partial_date = PartialDate("2015-11-01")
    >>> partial_date
    2015-11-01
    >>> partial_date.format('%Y', '%m/%Y', '%m/%d/%Y')
    '11/01/2015'
    >>> partial_date = PartialDate("2015-11")
    >>> partial_date
    2015-11
    >>> partial_date.format('%Y', '%m/%Y', '%m/%d/%Y')
    '11/2015'
    >>> partial_date = PartialDate("2015")
    >>> partial_date
    2015
    >>> partial_date.format('%Y', '%m/%Y', '%m/%d/%Y')
    '2015'

Thanks for their collaborations to
=====================================
* lorinkoz
* howieweiner
* bbirke
politico-civic-entity 1.0a1.dev3
Manage political people and organizations, the POLITICO way.
License: MIT

![POLITICO](https://rawgithub.com/The-Politico/src/master/images/logo/badge.png)

# django-politico-civic-entity

Manage political people and organizations, the POLITICO way.

### Quickstart

1. Install the app.

  ```
  $ pip install politico-civic-entity
  ```

2. Add the app to your Django project settings.

  ```python
  INSTALLED_APPS = [
      # ...
      'rest_framework',
      'entity',
  ]
  ```

3. Migrate the database

  ```
  $ python manage.py migrate entity
  ```


### Developing

##### Running a development server

Move into the example directory, install dependencies and run the development server with pipenv.

  ```
  $ cd example
  $ pipenv install
  $ pipenv run python manage.py runserver
  ```

##### Setting up a PostgreSQL database

1. Run the make command to setup a fresh database.

  ```
  $ make database
  ```

2. Add a connection URL to `example/.env`.

  ```
  DATABASE_URL="postgres://localhost:5432/entity"
  ```

3. Run migrations from the example app.

  ```
  $ cd example
  $ pipenv run python manage.py migrate
  ```