Base class is abstract.
class Base(models.Model):
plano = models.ForeignKey(Plano)
class Meta:
abstract = True
base_manager_name
<https://docs.djangoproject.com/en/1.10/ref/models/options/#base-manager-name>
On Saturday, February 18, 2017 at 9:20:03 PM UTC-3, Melvyn Sopacua wrote:
>
> On Saturday 18 February 2017 22:27:46 Elton Pereira wrote:
>
>
>
> > class ProdutoServicoManager(models.Manager):
>
> > def get_queryset(self):
>
> > expression = models.Sum(models.F('custounitario__valor') *
>
> > models.F('custounitario__quantidade'))
>
> > total_expr = models.ExpressionWrapper(expression,
>
> > output_field=models.DecimalField())
>
> > return
>
> > super().get_queryset().annotate(custo_producao=total_expr)
>
> >
>
> > class ProdutoServico(Base):
>
>
>
> What's the manager on Base?
>
>
>
> > produto = models.BooleanField(default=True)
>
> > descricao = models.TextField()
>
> > objects = ProdutoServicoManager()
>
> >
>
> > class Meta:
>
> > base_manager_name = 'objects'
>
>
>
> Cause this doesn't actually do anything, beside being explicit.
>
>
>
> --
>
> Melvyn Sopacua
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/1f0c3fe3-9724-4a0f-b362-2d334ccaf3e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.