Skip to content

Commit

Permalink
Fix test models
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed May 17, 2024
1 parent a2d6337 commit f597a8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ralph/admin/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def value_from_datadict(self, data, files, name):
def render(self, name, value, attrs=None, choices=()):
attr_value = ','.join(map(str, value or []))
final_attrs = self.build_attrs(
attrs, extra_attrs={name: attr_value} # "type": 'hidden', "name": name, "value": attr_value}
attrs, extra_attrs={name: attr_value}
)
return mark_safe(
'<a class="expand action-expand">Expand all</a>'
Expand Down
2 changes: 1 addition & 1 deletion src/ralph/tests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BarAdmin(RalphAdmin):


class BarsM2MInline(RalphTabularM2MInline):
model = Bar
model = Foo.bars.through
fields = ('name', 'date', 'price', 'count')
extra = 1
verbose_name = _('Bars')
Expand Down
8 changes: 4 additions & 4 deletions src/ralph/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def __str__(self):
return 'Foo: {} / {}'.format(self.id, self.bar)


class Manufacturer(models.Model):
class Manufacturer(AdminAbsoluteUrlMixin, models.Model):
name = models.CharField(max_length=50)
country = models.CharField(max_length=50)


class Car(models.Model):
class Car(AdminAbsoluteUrlMixin, models.Model):
name = models.CharField(max_length=50)
year = models.PositiveSmallIntegerField()
manufacturer = models.ForeignKey(Manufacturer)
Expand All @@ -51,11 +51,11 @@ def get_autocomplete_queryset(cls):
return cls.objects.filter(year=2015)


class Car2(models.Model):
class Car2(AdminAbsoluteUrlMixin, models.Model):
manufacturer = models.ForeignKey(Manufacturer)


class Bar(PriceMixin, models.Model):
class Bar(AdminAbsoluteUrlMixin, PriceMixin, models.Model):
name = models.CharField(max_length=255)
created = models.DateTimeField(auto_now_add=True)
date = models.DateField(blank=True, null=True)
Expand Down

0 comments on commit f597a8d

Please sign in to comment.