najrono


Namenajrono JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/tahamusvi/najrono
SummaryDjango library for managing **Jalali (Persian) dates** in your models
upload_time2024-12-22 09:26:23
maintainerNone
docs_urlNone
authorTaha Musvi
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements jalali_core jdatetime
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Najrono

Najrono is a Django library for managing **Jalali (Persian) dates** in your models, with built-in **caching capabilities** for optimized data access. The name "Najrono" is inspired by the combination of "Najla" and "Chrono" (referring to time), reflecting its focus on elegant time management.

---

## Features

<!-- - **Jalali DateField**: A custom field for handling Jalali dates in Django models.
- **Built-in Caching**:
  - **Today**: Logs for the current day.
  - **Current Month**: Aggregated data for the current month.
  - **Current Year**: Aggregated data for the current year.
  - **Past Years**: Static cache for previous years.
- **Efficient Querying**: Combines cached data with database queries for the most recent updates.
- **Easy Integration**: Plug-and-play setup for Django projects. -->

---

## Installation

Install Najrono using pip:

```bash
pip install najrono
```

---

## Quick Start

### 1. Add Najrono to Installed Apps

Add `najrono` to your Django project's `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    ...
    'najrono',
]
```

### 2. Use JalaliDateField in Your Models

<!-- Define your model with the `JalaliDateField` and use `CacheableModelMixin` for caching:

```python
from najrono.models import CacheableModelMixin, JalaliDateField
from django.db import models

class Log(CacheableModelMixin, models.Model):
    user = models.ForeignKey("auth.User", on_delete=models.CASCADE)
    jalali_date = JalaliDateField()

    def __str__(self):
        return f"Log for {self.user} on {self.jalali_date}"
``` -->

### 3. Fetch Logs with Caching

<!-- Use the built-in caching methods to fetch logs efficiently:

```python
from myapp.models import Log

user = User.objects.get(id=1)

# Retrieve cached logs
logs = Log.get_cached_logs(user)

print("Logs for today:", logs["today"])
print("Logs for this month:", logs["month"])
print("Logs for this year:", logs["year"])
print("Logs for past years:", logs["past_years"])
```

--- -->

## Configuration

<!-- Najrono provides default cache timeouts that you can customize in your Django settings:

```python
NAJRONO_CACHE_TIMEOUTS = {
    "today": 60 * 60 * 2,       # 2 hours
    "month": 60 * 60 * 24 * 7,  # 1 week
    "year": 60 * 60 * 24 * 30, # 1 month
    "past_years": None,        # Permanent
}
``` -->

--- 

## Requirements

- Python 3.8+
- Django 3.2+

---

## License

Najrono is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

## Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue to discuss potential changes or improvements.

---

## Acknowledgments

Najrono is inspired by the need for a robust and efficient system to handle Jalali dates and caching in Django projects. Special thanks to the Django community for their continuous support.

---

## Contact

For questions or feedback, please contact [TahaM8000@gmail.com].


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tahamusvi/najrono",
    "name": "najrono",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Taha Musvi",
    "author_email": "TahaM8000@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/d6/2e729c4c280cf5a672241f35fe63cd0d4e4e99fb87a13143951b59f4b938/najrono-0.0.3.tar.gz",
    "platform": null,
    "description": "# Najrono\r\n\r\nNajrono is a Django library for managing **Jalali (Persian) dates** in your models, with built-in **caching capabilities** for optimized data access. The name \"Najrono\" is inspired by the combination of \"Najla\" and \"Chrono\" (referring to time), reflecting its focus on elegant time management.\r\n\r\n---\r\n\r\n## Features\r\n\r\n<!-- - **Jalali DateField**: A custom field for handling Jalali dates in Django models.\r\n- **Built-in Caching**:\r\n  - **Today**: Logs for the current day.\r\n  - **Current Month**: Aggregated data for the current month.\r\n  - **Current Year**: Aggregated data for the current year.\r\n  - **Past Years**: Static cache for previous years.\r\n- **Efficient Querying**: Combines cached data with database queries for the most recent updates.\r\n- **Easy Integration**: Plug-and-play setup for Django projects. -->\r\n\r\n---\r\n\r\n## Installation\r\n\r\nInstall Najrono using pip:\r\n\r\n```bash\r\npip install najrono\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n### 1. Add Najrono to Installed Apps\r\n\r\nAdd `najrono` to your Django project's `INSTALLED_APPS`:\r\n\r\n```python\r\nINSTALLED_APPS = [\r\n    ...\r\n    'najrono',\r\n]\r\n```\r\n\r\n### 2. Use JalaliDateField in Your Models\r\n\r\n<!-- Define your model with the `JalaliDateField` and use `CacheableModelMixin` for caching:\r\n\r\n```python\r\nfrom najrono.models import CacheableModelMixin, JalaliDateField\r\nfrom django.db import models\r\n\r\nclass Log(CacheableModelMixin, models.Model):\r\n    user = models.ForeignKey(\"auth.User\", on_delete=models.CASCADE)\r\n    jalali_date = JalaliDateField()\r\n\r\n    def __str__(self):\r\n        return f\"Log for {self.user} on {self.jalali_date}\"\r\n``` -->\r\n\r\n### 3. Fetch Logs with Caching\r\n\r\n<!-- Use the built-in caching methods to fetch logs efficiently:\r\n\r\n```python\r\nfrom myapp.models import Log\r\n\r\nuser = User.objects.get(id=1)\r\n\r\n# Retrieve cached logs\r\nlogs = Log.get_cached_logs(user)\r\n\r\nprint(\"Logs for today:\", logs[\"today\"])\r\nprint(\"Logs for this month:\", logs[\"month\"])\r\nprint(\"Logs for this year:\", logs[\"year\"])\r\nprint(\"Logs for past years:\", logs[\"past_years\"])\r\n```\r\n\r\n--- -->\r\n\r\n## Configuration\r\n\r\n<!-- Najrono provides default cache timeouts that you can customize in your Django settings:\r\n\r\n```python\r\nNAJRONO_CACHE_TIMEOUTS = {\r\n    \"today\": 60 * 60 * 2,       # 2 hours\r\n    \"month\": 60 * 60 * 24 * 7,  # 1 week\r\n    \"year\": 60 * 60 * 24 * 30, # 1 month\r\n    \"past_years\": None,        # Permanent\r\n}\r\n``` -->\r\n\r\n--- \r\n\r\n## Requirements\r\n\r\n- Python 3.8+\r\n- Django 3.2+\r\n\r\n---\r\n\r\n## License\r\n\r\nNajrono is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Feel free to submit a pull request or open an issue to discuss potential changes or improvements.\r\n\r\n---\r\n\r\n## Acknowledgments\r\n\r\nNajrono is inspired by the need for a robust and efficient system to handle Jalali dates and caching in Django projects. Special thanks to the Django community for their continuous support.\r\n\r\n---\r\n\r\n## Contact\r\n\r\nFor questions or feedback, please contact [TahaM8000@gmail.com].\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Django library for managing **Jalali (Persian) dates** in your models",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/tahamusvi/najrono"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9d62e729c4c280cf5a672241f35fe63cd0d4e4e99fb87a13143951b59f4b938",
                "md5": "b019d39c037658295480e6312c1f280d",
                "sha256": "3b8e69d9074db6d966087a404842822667edcc086ffccced32a563ebe2f1c665"
            },
            "downloads": -1,
            "filename": "najrono-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b019d39c037658295480e6312c1f280d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4088,
            "upload_time": "2024-12-22T09:26:23",
            "upload_time_iso_8601": "2024-12-22T09:26:23.672572Z",
            "url": "https://files.pythonhosted.org/packages/f9/d6/2e729c4c280cf5a672241f35fe63cd0d4e4e99fb87a13143951b59f4b938/najrono-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-22 09:26:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tahamusvi",
    "github_project": "najrono",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "jalali_core",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "jdatetime",
            "specs": [
                [
                    "==",
                    "5.0.0"
                ]
            ]
        }
    ],
    "lcname": "najrono"
}
        
Elapsed time: 0.56410s