django-year-calendar


Namedjango-year-calendar JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/esimorre/django-year-calendar
SummaryA year calendar application for django
upload_time2024-02-14 14:48:14
maintainer
docs_urlNone
author
requires_python
license
keywords django calendar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Django year calendar
====================

[![Django CI](https://github.com/esimorre/django-year-calendar/actions/workflows/django.yml/badge.svg)](https://github.com/esimorre/django-year-calendar/actions/workflows/django.yml)

A django app based on [js-year-calendar](https://github.com/year-calendar/js-year-calendar/)

<img src="https://year-calendar.github.io/assets/img/calendar.png">

Dynamic view implemented with Bootstrap 5 and JS Fetch API (no jquery).

Popups are not supported,
replaced by a modal dialog raised on date range selection.

Get started
===========

Clone the repository or download the project

Optional: set a django environnement, then activate
```bash
python -m venv venv
venv\Scripts\activate.bat (windows)
. venv/bin/activate       (linux)
pip install django
```

Install django_year_calendar (or give an access)
```bash
pip install django-year-calendar
#  or
python setup.py install
# or put current directory in PYTHONPATH
```

Go to the example django project, initialize the project then run dev server
```bash
cd example_project
python manage.py migrate
python manage.py loaddata sample_data.json
python manage.py runserver
```
Check then http://localhost:8000

You can also go to the admin panel http://localhost:8000/admin (login admin passwd admin) to browse models
and add some more data.

Usage for an existing django project
====================================

Add the django_year_app to your project
```bash
INSTALLED_APPS = [
    ...
    'django_year_calendar',
]
```

Add some routes to views in the urls.py file
```bash
urlpatterns = [
    ...
    path('my_calendar', include('django_year_calendar.urls')),
    path('minimal_fr', TemplateView.as_view(template_name='django_year_calendar/minimal.html',
                                            extra_context = {'calendar_lang': 'fr'})),
    ...
]
```

You may (or not) add some settings in your settings.py file:
```python
CALENDAR_LANG  = "fr"   # see https://github.com/year-calendar/js-year-calendar/tree/master/locales
CALENDAR_WEEKSTART = 1  # monday
CALENDAR_WEEKNUMBER = True # display week number

CALENDAR_TPL = "django_year_calendar/bootstrap5"
# style: 'border' | 'background' | [custom_template] for 'custom' style
CALENDAR_RENDERER = 'background'

CALENDAR_VIEWS = [
    ...
    {'manager': 'app.models.MyModel[.myManager[.a_method]]',
     'color': 'blue',
     'style': 'background | border'},
    ...
]
```

Add some code to the models to display on the calendar, 
```bash
class MyEvent(models.Model):
    ...
    # REQUIRED
    def start_date(self) -> DateField | date :
        ...
        return some_date
    # REQUIRED    
    def end_date(self):
        ...
        return another_date
    
    # optional
    def color(self) -> str:
        return 'blue'
    def infos(self) -> str:
        return "my birthday"
    def style(self) -> str ('background' | 'border' ):
        return 'border'
```
You can make your own views in various ways depending on your needs:
 * new templates based on the provided ones in django_year_calendar/templates
 * parameters in the urls.py file
 * new views based on CalendarView provided by the django_year_calendar app

See example_project for more details.

### Future

 * Customizing the calendar view based on user rights
 * Helpers for building event editing views
 * ...


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/esimorre/django-year-calendar",
    "name": "django-year-calendar",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,calendar",
    "author": "",
    "author_email": "",
    "download_url": "",
    "platform": "any",
    "description": "Django year calendar\r\n====================\r\n\r\n[![Django CI](https://github.com/esimorre/django-year-calendar/actions/workflows/django.yml/badge.svg)](https://github.com/esimorre/django-year-calendar/actions/workflows/django.yml)\r\n\r\nA django app based on [js-year-calendar](https://github.com/year-calendar/js-year-calendar/)\r\n\r\n<img src=\"https://year-calendar.github.io/assets/img/calendar.png\">\r\n\r\nDynamic view implemented with Bootstrap 5 and JS Fetch API (no jquery).\r\n\r\nPopups are not supported,\r\nreplaced by a modal dialog raised on date range selection.\r\n\r\nGet started\r\n===========\r\n\r\nClone the repository or download the project\r\n\r\nOptional: set a django environnement, then activate\r\n```bash\r\npython -m venv venv\r\nvenv\\Scripts\\activate.bat (windows)\r\n. venv/bin/activate       (linux)\r\npip install django\r\n```\r\n\r\nInstall django_year_calendar (or give an access)\r\n```bash\r\npip install django-year-calendar\r\n#  or\r\npython setup.py install\r\n# or put current directory in PYTHONPATH\r\n```\r\n\r\nGo to the example django project, initialize the project then run dev server\r\n```bash\r\ncd example_project\r\npython manage.py migrate\r\npython manage.py loaddata sample_data.json\r\npython manage.py runserver\r\n```\r\nCheck then http://localhost:8000\r\n\r\nYou can also go to the admin panel http://localhost:8000/admin (login admin passwd admin) to browse models\r\nand add some more data.\r\n\r\nUsage for an existing django project\r\n====================================\r\n\r\nAdd the django_year_app to your project\r\n```bash\r\nINSTALLED_APPS = [\r\n    ...\r\n    'django_year_calendar',\r\n]\r\n```\r\n\r\nAdd some routes to views in the urls.py file\r\n```bash\r\nurlpatterns = [\r\n    ...\r\n    path('my_calendar', include('django_year_calendar.urls')),\r\n    path('minimal_fr', TemplateView.as_view(template_name='django_year_calendar/minimal.html',\r\n                                            extra_context = {'calendar_lang': 'fr'})),\r\n    ...\r\n]\r\n```\r\n\r\nYou may (or not) add some settings in your settings.py file:\r\n```python\r\nCALENDAR_LANG  = \"fr\"   # see https://github.com/year-calendar/js-year-calendar/tree/master/locales\r\nCALENDAR_WEEKSTART = 1  # monday\r\nCALENDAR_WEEKNUMBER = True # display week number\r\n\r\nCALENDAR_TPL = \"django_year_calendar/bootstrap5\"\r\n# style: 'border' | 'background' | [custom_template] for 'custom' style\r\nCALENDAR_RENDERER = 'background'\r\n\r\nCALENDAR_VIEWS = [\r\n    ...\r\n    {'manager': 'app.models.MyModel[.myManager[.a_method]]',\r\n     'color': 'blue',\r\n     'style': 'background | border'},\r\n    ...\r\n]\r\n```\r\n\r\nAdd some code to the models to display on the calendar, \r\n```bash\r\nclass MyEvent(models.Model):\r\n    ...\r\n    # REQUIRED\r\n    def start_date(self) -> DateField | date :\r\n        ...\r\n        return some_date\r\n    # REQUIRED    \r\n    def end_date(self):\r\n        ...\r\n        return another_date\r\n    \r\n    # optional\r\n    def color(self) -> str:\r\n        return 'blue'\r\n    def infos(self) -> str:\r\n        return \"my birthday\"\r\n    def style(self) -> str ('background' | 'border' ):\r\n        return 'border'\r\n```\r\nYou can make your own views in various ways depending on your needs:\r\n * new templates based on the provided ones in django_year_calendar/templates\r\n * parameters in the urls.py file\r\n * new views based on CalendarView provided by the django_year_calendar app\r\n\r\nSee example_project for more details.\r\n\r\n### Future\r\n\r\n * Customizing the calendar view based on user rights\r\n * Helpers for building event editing views\r\n * ...\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A year calendar application for django",
    "version": "0.5.0",
    "project_urls": {
        "Bug Reports": "https://github.com/esimorre/django-year-calendar/issues",
        "Homepage": "https://github.com/esimorre/django-year-calendar",
        "Say Thanks!": "https://year-calendar.github.io/",
        "Source": "https://github.com/esimorre/django-year-calendar"
    },
    "split_keywords": [
        "django",
        "calendar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2d34c44a8c61191f8db5d3c57d73309eb5e62c3309ded093bf3502dbd96f6a9",
                "md5": "771c4f5126b36604ac90a5bdb5c5b66e",
                "sha256": "b7e854a32a1ec42d0d8c4ff4283d1927025e4ba4b94b6eebb50b3024e42c68b2"
            },
            "downloads": -1,
            "filename": "django_year_calendar-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "771c4f5126b36604ac90a5bdb5c5b66e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17157,
            "upload_time": "2024-02-14T14:48:14",
            "upload_time_iso_8601": "2024-02-14T14:48:14.660626Z",
            "url": "https://files.pythonhosted.org/packages/a2/d3/4c44a8c61191f8db5d3c57d73309eb5e62c3309ded093bf3502dbd96f6a9/django_year_calendar-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-14 14:48:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "esimorre",
    "github_project": "django-year-calendar",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "django-year-calendar"
}
        
Elapsed time: 0.18850s