Git Product home page Git Product logo

django_partial_date's People

Contributors

jghyllebert avatar ktowen avatar lorinkoz avatar sorinmarti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

django_partial_date's Issues

can't have an empty field

I am working on a project that has start and end date fields. Ideally the end date field would be optional.

However PartialDate won't accept an empty string, or None despite what it says in the documentation; or null=True.

These are the kind of errors I have received -

["'' is not a valid date string (YYYY, YYYY-MM, YYYY-MM-DD)"]

image

Reversion cannot recover PartialDateField versions with an empty value

How to reproduce:

Make sure you have enabled the custom module in your Python virtual environment:

pip install django-partial-date==1.3.2 django-reversion==5.0.4

Create the following class in the django models.py:

from partial_date import PartialDateField

class Station(models.Model):
    name = models.CharField(max_length=200)
    created = PartialDateField(blank=True, null=True)

Register the administration of the object with reversion in admin.py:

from reversion.admin import VersionAdmin

@admin.register(Station)
class StationAdmin(VersionAdmin):
    pass

run migrations on your commandline:

python manage.py makemigrations
python manage.py migrate
  1. Login in the admin interface and create a Station object. Provide only a value for the "name" field and leave all the rest empty. Click save and continue editing.
  2. Provide a partial date value in the "Created" the field. E.g. "2020-05". Click save and continue editing
  3. Click on history.
  4. Click on the older version you created before: unintended behavior: "Could not load Name version - incompatible version data."
  5. Click on the latest version with the partial date specified: intended behavior. The version loads properly

How to create a date without year?

Hi, it's great library! One question, if only month and day are available, could django_partial_date store only month and day without year? something like:

dob=PartialDate(datetime.date(0, 9, 21), precision=PartialDate.DAY)

Thanks!

Add PartialDateForm

I think we need a PartialDateField in forms because of PartialDateField for models exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.