semvec/pypi-packages huggingface dataset:
django-old-records 2.0.8
A Python library to provide easy old records management for Django models
License: MIT
Requires Python: >=3.6

# Django Old Records

A simple Django app with tools to manage old records of Django models

## Install

`pip install django-old-records`

Add `django_old_records` to your project's `INSTALLED_APPS`
## Usage

There is a manager that decides if a record is too old based on a date field (`created_at` by default) and a `max_age`. Ex.:

```python
from django_old_records import OldRecordsManager
from django.db import models

class Cat(models.Model):

    name = models.CharField()
    created_at = models.DateTimeField(auto_now_add=True)

    max_age = 365 * 20 # 20 years

    old_records = OldRecordsManager()
```

```python
Cat.old_records.all() # lists all cat records older than 20 years
```

`max_age` could be an integer representing days or a python `timedelta` for a more detailed value. Ex.:

```python
from django_old_records import OldRecordsManager
from django.db import models
from datetime import timedelta

class Cat(models.Model):

    name = models.CharField()
    created_at = models.DateTimeField(auto_now_add=True)

    max_age = timedelta(hours=4, seconds=20)

    old_records = OldRecordsManager()
```

```python
Cat.old_records.all() # lists all cat records older than 4 hours and 20 seconds
```

If your model's `created_at` has a different name you can specify it with the `created_at_field` attribute. Ex.:

```python
class Cat(models.Model):

    name = models.CharField()
    was_born = models.DateTimeField(auto_now_add=True)

    created_at_field = 'was_born'
    max_age = 365 * 20 # 20 years

    old_records = OldRecordsManager()
```
There is also a management command that deletes all old records from all models with the `old_records` manager:

`python manage.py delete_old_records`
progressbars 1.1.10
A python package to display progress of loops to the user
License: MIT

# ProgressBars
A python package to display progress of loops to the user.

# Installation
This package can be installed using pip.
```
pip install progressbars
```

# Usage
The class you'll be using is called the ProgressBar class, here is an example of how to use it.
```python
from progressbars import ProgressBar, widgets

def isPrime(n: int) -> bool:
    "A very slow algorithm to calculate if a given number is prime."

    for i in range(2, n):
        if n % i == 0:
            return False
    return n > 1

# Create an empty list to store the primes we find
primes = []

# Create a colorless progress bar that uses all the default widgets
bar = ProgressBar([
    widgets.Percentage,
    widgets.IterationSpeed,
    widgets.Counter,
    widgets.ElapsedTime,
    widgets.RemainingTime
], color=None)

# Loop through all numbers from 0-30_000
for i in bar(range(30_000)):
    if isPrime(i): # If the current number is prime, append it to the primes list
        primes.append(i)

# Print how many primes we found
print("\nFound", len(primes), "primes!")
```