Using smart_selects in the admin for a ChainedManyToMany?

19 views
Skip to first unread message

Derek

unread,
Nov 18, 2020, 7:05:02 AM11/18/20
to django-users
Looking for some help, if possible

Working Django with 1.11.x and Django smart_selects 1.5.x

from smart_selects.db_fields import ChainedManyToManyField

class Project(Model):
    """Project is a holder for a group of activities carried out as sub-projects.
    """
    id = AutoField(primary_key=True)
    name = CharField(unique=True)
    description = CharField()


class Milestone(Model):
    """Milestone is a time-based goal for a Project.
    """
    id = AutoField(primary_key=True)
    project = ForeignKey(Project)
    description = TextField()
    planned_year = PositiveIntegerField()
    planned_quarter()
   
   
class SubProject(Model):
    """SubProject is an activity carried out as part of a single Project.
    """
    id = AutoField(primary_key=True)
    project = ForeignKey(Project)
    code = CharField(unique=True)
    milestones = ChainedManyToManyField(
        Milestone,
        blank=True,
        horizontal=True,
        chained_field="project",
        chained_model_field="milestones")


However, the admin form for SubProject simply shows the usual admin multi-select box (i.e. just a long list of unfiltered milestones).

What needs to change in the above code to create a working smart_selects version?

Thanks
Derek

Bhuvan Kumar

unread,
Nov 18, 2020, 9:45:33 AM11/18/20
to django...@googlegroups.com
This is not iam expecting sir how to set path  for getabsoluteurl  and url

--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1Wu3OK%2BgjaScANCO%3DxC4xi%2BT-e9iaaZqfKtzPpz7jhy6Ai6Q%40mail.gmail.com.

Bhuvan Kumar

unread,
Nov 18, 2020, 9:45:40 AM11/18/20
to django...@googlegroups.com
Iam using 2.0.4 version

Reply all
Reply to author
Forward
0 new messages