Skip to content

Commit

Permalink
embed favorite beers within user admin detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbrew committed Jul 23, 2019
1 parent dabb9f0 commit 76d5677
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions beers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.http import HttpResponse, HttpResponseRedirect

from . import models
from . import forms


class BeerAlternateNameInline(admin.TabularInline):
Expand Down Expand Up @@ -70,6 +71,13 @@ class ManufacturerAlternateNameInline(admin.TabularInline):
model = models.ManufacturerAlternateName


class UserFavoriteBeerInline(admin.TabularInline):
model = models.UserFavoriteBeer
queryset = models.UserFavoriteBeer.objects.select_related(
'user', 'beer__manufacturer',
)


class ManufacturerAdmin(admin.ModelAdmin):

def url_fields_set(self, manufacturer):
Expand Down
4 changes: 3 additions & 1 deletion hsv_dot_beer/users/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin

from beers.admin import UserFavoriteBeerInline
from .models import User


@admin.register(User)
class UserAdmin(UserAdmin):
pass
inlines = [UserFavoriteBeerInline]

0 comments on commit 76d5677

Please sign in to comment.