Closed A4TIF closed 4 years ago
The PR was already merged, Thanks for the contribution @kptac
hey @kptac I'm currently having the problems that ManyToMany-field values are neither shown in the list-view nor in the-display. It seems you have solved this problem with this PR but to me it's unclear how to use this. Would you mind a short explanation?
@benmaier - make sure to have a string representation set by implementing Model.str() method.
Also, are you on the latest version?
Hope that helps.
Yes to both!
The __str__()
method of one of the models is called if it's in a ForeignKey-field but not for a ManyToManyField.
The version I'm on is 0.0.17+git.a154def
. I've clone this repo today.
my setup is basically the one I described in #133 ... maybe the select-widget is overriding things in the display-view? That'd be rather weird though. I'd be super thankful if you could take a short look at it!
The latest release is: 0.0.17+git.081101d
for your geoname model, try this:
class Geoname(models.Model):
name = models.CharField(max_length=255)
population = models.PositiveIntegerField(blank=True,null=True)
def __str__(self):
return '%s' % self.name
My Geoname-model already has this property
The latest release is: 0.0.17+git.081101d
Yes, I know, but this release is from July 10 and does not include your changes (see e.g. https://github.com/oscarmlage/django-cruds-adminlte/tree/0.0.17%2Bgit.081101d/cruds_adminlte/templates/cruds/columns where your file is missing). I'm on the latest master commit which is 0.0.17+git.a154def and includes your changes.
Ahh ok, my bad, didn't see the commits on the latest release. So in your CRUDView, are you including the m2m field in list_fields? Can I see how you're inheriting CRUDView?
Ah! list_fields
wasn't mentioned anywhere in the documentation, so I didn't know about it. That did the trick, thank you so much!
Looks like ManyToMany fields do not work. Perhaps we can add a linked string representation of each object within columns.
123