accrete 0.0.111__py3-none-any.whl → 0.0.112__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- accrete/contrib/sequence/migrations/0003_alter_sequence_tenant.py +20 -0
 - accrete/models.py +1 -3
 - {accrete-0.0.111.dist-info → accrete-0.0.112.dist-info}/METADATA +1 -1
 - {accrete-0.0.111.dist-info → accrete-0.0.112.dist-info}/RECORD +6 -6
 - accrete/annotation.py +0 -46
 - {accrete-0.0.111.dist-info → accrete-0.0.112.dist-info}/WHEEL +0 -0
 - {accrete-0.0.111.dist-info → accrete-0.0.112.dist-info}/licenses/LICENSE +0 -0
 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Generated by Django 5.1.1 on 2025-01-07 20:24
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            import django.db.models.deletion
         
     | 
| 
      
 4 
     | 
    
         
            +
            from django.db import migrations, models
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            class Migration(migrations.Migration):
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                dependencies = [
         
     | 
| 
      
 10 
     | 
    
         
            +
                    ('accrete', '0002_initial'),
         
     | 
| 
      
 11 
     | 
    
         
            +
                    ('sequence', '0002_alter_sequence_name'),
         
     | 
| 
      
 12 
     | 
    
         
            +
                ]
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                operations = [
         
     | 
| 
      
 15 
     | 
    
         
            +
                    migrations.AlterField(
         
     | 
| 
      
 16 
     | 
    
         
            +
                        model_name='sequence',
         
     | 
| 
      
 17 
     | 
    
         
            +
                        name='tenant',
         
     | 
| 
      
 18 
     | 
    
         
            +
                        field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accrete.tenant', verbose_name='Tenant'),
         
     | 
| 
      
 19 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 20 
     | 
    
         
            +
                ]
         
     | 
    
        accrete/models.py
    CHANGED
    
    | 
         @@ -3,12 +3,10 @@ from django.conf import settings 
     | 
|
| 
       3 
3 
     | 
    
         
             
            from django.utils.translation import gettext_lazy as _
         
     | 
| 
       4 
4 
     | 
    
         
             
            from django.contrib.auth.validators import UnicodeUsernameValidator
         
     | 
| 
       5 
5 
     | 
    
         
             
            from accrete.tenant import get_tenant
         
     | 
| 
       6 
     | 
    
         
            -
            from accrete.annotation import AnnotationModelMixin
         
     | 
| 
       7 
6 
     | 
    
         
             
            from accrete.managers import TenantManager
         
     | 
| 
       8 
     | 
    
         
            -
            from accrete.tenant import unscoped
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            class TenantModel(models.Model 
     | 
| 
      
 9 
     | 
    
         
            +
            class TenantModel(models.Model):
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
11 
     | 
    
         
             
                class Meta:
         
     | 
| 
       14 
12 
     | 
    
         
             
                    abstract = True
         
     | 
| 
         @@ -1,12 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            accrete/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       2 
2 
     | 
    
         
             
            accrete/admin.py,sha256=MUYUmCFlGYPowiXTbwl4_Q6Cq0-neiL53WW4P76JCLs,1174
         
     | 
| 
       3 
     | 
    
         
            -
            accrete/annotation.py,sha256=GCpTTX3fJH9w2vOOOydKcAALdEd1gRNjh_Ws9LkJ4aA,1355
         
     | 
| 
       4 
3 
     | 
    
         
             
            accrete/apps.py,sha256=F7ynMLHJr_6bRujWtZVUzCliY2CGKiDvyUmL4F68L2E,146
         
     | 
| 
       5 
4 
     | 
    
         
             
            accrete/config.py,sha256=eJUbvyBO3DvAD6xkVKjTAzlXy7V7EK9bVyb91girfUs,299
         
     | 
| 
       6 
5 
     | 
    
         
             
            accrete/forms.py,sha256=H2hPQemslRLvTVV0Wl1TfUmTc5wU3Z98nQTMiLMliqo,1288
         
     | 
| 
       7 
6 
     | 
    
         
             
            accrete/managers.py,sha256=3wylSG4XBL9s2hrIWJ8FHIL75PbuYgPZg5Svacwj2-Y,1454
         
     | 
| 
       8 
7 
     | 
    
         
             
            accrete/middleware.py,sha256=YN73WloNkN01oel9Dcj3xyhurcWoB6zMV0NT3hY8DGw,2264
         
     | 
| 
       9 
     | 
    
         
            -
            accrete/models.py,sha256= 
     | 
| 
      
 8 
     | 
    
         
            +
            accrete/models.py,sha256=6vymvqZ-ygaIZ5r-P1F57twy17VxdRQbzr8PMLwsWxs,5453
         
     | 
| 
       10 
9 
     | 
    
         
             
            accrete/storage.py,sha256=Jp3oE_uPMqgarjS_G49KDFrR2eSe4XuIJK9oAF_QBxk,1288
         
     | 
| 
       11 
10 
     | 
    
         
             
            accrete/tenant.py,sha256=-__rFtYrc5SbxFX2-Dvw6Wc1XzSAD6DeIBRuOVQlbWQ,1908
         
     | 
| 
       12 
11 
     | 
    
         
             
            accrete/tests.py,sha256=Agltbzwwh5htvq_Qi9vqvxutzmg_GwgPS_N19xJZRlw,7197
         
     | 
| 
         @@ -23,6 +22,7 @@ accrete/contrib/sequence/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6 
     | 
|
| 
       23 
22 
     | 
    
         
             
            accrete/contrib/sequence/views.py,sha256=xc1IQHrsij7j33TUbo-_oewy3vs03pw_etpBWaMYJl0,63
         
     | 
| 
       24 
23 
     | 
    
         
             
            accrete/contrib/sequence/migrations/0001_initial.py,sha256=iAR_hhGN2wDAk40IS9PwEsm7iYqfgasoKRrTLFEpOY8,1352
         
     | 
| 
       25 
24 
     | 
    
         
             
            accrete/contrib/sequence/migrations/0002_alter_sequence_name.py,sha256=70tpxJ0_edWpzj69PxV73m3CwI7Hy5x1YK8m6_2niP4,398
         
     | 
| 
      
 25 
     | 
    
         
            +
            accrete/contrib/sequence/migrations/0003_alter_sequence_tenant.py,sha256=W0RJKpTK1DKKpipktRJASr9aG-24Xuzr7GxYYGkwoJk,535
         
     | 
| 
       26 
26 
     | 
    
         
             
            accrete/contrib/sequence/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       27 
27 
     | 
    
         
             
            accrete/contrib/system_mail/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         
     | 
| 
       28 
28 
     | 
    
         
             
            accrete/contrib/system_mail/admin.py,sha256=9hXwwfZn446juyRoBOygLWm12X6N9waRC-1LHBLrgZk,227
         
     | 
| 
         @@ -363,7 +363,7 @@ accrete/utils/forms.py,sha256=IvxbXNpSd4a-JBgsTJhs2GHe-DCRWX-xnVPRcoiCzbI,3104 
     | 
|
| 
       363 
363 
     | 
    
         
             
            accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
         
     | 
| 
       364 
364 
     | 
    
         
             
            accrete/utils/models.py,sha256=2xTacvcpmDK_Bp4rAK7JdVLf8HU009LYNJ6eSpMgYZI,1014
         
     | 
| 
       365 
365 
     | 
    
         
             
            accrete/utils/views.py,sha256=AutijWetWGgjdO1PNc4gxCblT-i1fAfldNDFRbO9Sac,5012
         
     | 
| 
       366 
     | 
    
         
            -
            accrete-0.0. 
     | 
| 
       367 
     | 
    
         
            -
            accrete-0.0. 
     | 
| 
       368 
     | 
    
         
            -
            accrete-0.0. 
     | 
| 
       369 
     | 
    
         
            -
            accrete-0.0. 
     | 
| 
      
 366 
     | 
    
         
            +
            accrete-0.0.112.dist-info/METADATA,sha256=KdP41pM_6cq8Jx0oEy3TCHNTVwEhKSVI2pIivZr89Nk,4953
         
     | 
| 
      
 367 
     | 
    
         
            +
            accrete-0.0.112.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         
     | 
| 
      
 368 
     | 
    
         
            +
            accrete-0.0.112.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
         
     | 
| 
      
 369 
     | 
    
         
            +
            accrete-0.0.112.dist-info/RECORD,,
         
     | 
    
        accrete/annotation.py
    DELETED
    
    | 
         @@ -1,46 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            from django.db.models import Field, Subquery, OuterRef
         
     | 
| 
       2 
     | 
    
         
            -
            from django.db.models.expressions import Func
         
     | 
| 
       3 
     | 
    
         
            -
            from django.db.models.aggregates import Aggregate
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            class Annotation:
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                def __init__(
         
     | 
| 
       9 
     | 
    
         
            -
                        self,
         
     | 
| 
       10 
     | 
    
         
            -
                        verbose_name: str,
         
     | 
| 
       11 
     | 
    
         
            -
                        field: type[Field],
         
     | 
| 
       12 
     | 
    
         
            -
                        function: type[Func] | type[Aggregate],
         
     | 
| 
       13 
     | 
    
         
            -
                        help_text: str = '',
         
     | 
| 
       14 
     | 
    
         
            -
                        **kwargs
         
     | 
| 
       15 
     | 
    
         
            -
                ):
         
     | 
| 
       16 
     | 
    
         
            -
                    self.verbose_name = verbose_name or self
         
     | 
| 
       17 
     | 
    
         
            -
                    self.field = field
         
     | 
| 
       18 
     | 
    
         
            -
                    self.function = function
         
     | 
| 
       19 
     | 
    
         
            -
                    self.help_text = help_text
         
     | 
| 
       20 
     | 
    
         
            -
                    self.__dict__.update(kwargs)
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            class AnnotationModelMixin:
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                @classmethod
         
     | 
| 
       26 
     | 
    
         
            -
                def get_annotations(cls) -> list[dict]:
         
     | 
| 
       27 
     | 
    
         
            -
                    return list({'name': a, 'annotation': getattr(cls, a)} for a in filter(
         
     | 
| 
       28 
     | 
    
         
            -
                        lambda a:
         
     | 
| 
       29 
     | 
    
         
            -
                        not a.startswith('__')
         
     | 
| 
       30 
     | 
    
         
            -
                        and isinstance(getattr(cls, a), Annotation),
         
     | 
| 
       31 
     | 
    
         
            -
                        cls.__dict__
         
     | 
| 
       32 
     | 
    
         
            -
                    ))
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            class AnnotationManagerMixin:
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                def get_annotations(self, queryset):
         
     | 
| 
       38 
     | 
    
         
            -
                    if not hasattr(self.model, 'get_annotations'):
         
     | 
| 
       39 
     | 
    
         
            -
                        return {}
         
     | 
| 
       40 
     | 
    
         
            -
                    return {
         
     | 
| 
       41 
     | 
    
         
            -
                        annotation['name']: Subquery(
         
     | 
| 
       42 
     | 
    
         
            -
                            queryset.annotate(**{
         
     | 
| 
       43 
     | 
    
         
            -
                                annotation['name']: annotation['annotation'].function
         
     | 
| 
       44 
     | 
    
         
            -
                            }).filter(pk=OuterRef('pk')).values(annotation['name'])[:1])
         
     | 
| 
       45 
     | 
    
         
            -
                        for annotation in self.model.get_annotations()
         
     | 
| 
       46 
     | 
    
         
            -
                    }
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |