#models.py
class shop(models.Model):
client = models.ForeignKey(client , verbose_name=u'客戶')
shop_name = models.CharField(max_length=255, blank=True, null=True)
shop_code = models.CharField(max_length=255, blank=True, null=True)
address = models.CharField(max_length=255, blank=True, null=True)
telephone = models.CharField(max_length=255, blank=True, null=True)
contact_person = models.CharField(max_length=255, blank=True, null=True)
last_updated = models.DateTimeField(auto_now=True)
date_added = models.DateTimeField(auto_now_add=True)
class pickup(models.Model):
order_parent = models.OneToOneField(order_parent)
shop = models.ForeignKey(shop)
telephone = models.CharField(max_length=255, blank=True, null=True)
pickup_date = models.DateField(editable=True)
pickup_quoted_time = models.TimeField(editable=True)
pickup_time_actual = models.TimeField(editable=True)
special_instruction = models.TextField(blank=True, null=True)
last_updated = models.DateTimeField(auto_now=True)
date_added = models.DateTimeField(auto_now_add=True)
I wish to show the form of shop's address, telephone in the pickup admin interface. Is it possible doing in django?
我希望在提货管理界面中显示商店地址的形式,电话。有可能在django做吗?
Thanks.
谢谢。
1 个解决方案
#1
0
The django basic tutorial talks about this. In your myapp/admin.py:
django基础教程讲述了这一点。在你的myapp / admin.py中:
from django.contrib import admin
from myapp.models import Shop, Pickup
class ShopInline(admin.StackedInline):
model = shop
class PickupAdmin(admin.ModelAdmin):
inlines = [shopInline]
admin.site.register(Shop, ShopInline)
admin.site.register(Pickup, PickupAdmin)
#1
0
The django basic tutorial talks about this. In your myapp/admin.py:
django基础教程讲述了这一点。在你的myapp / admin.py中:
from django.contrib import admin
from myapp.models import Shop, Pickup
class ShopInline(admin.StackedInline):
model = shop
class PickupAdmin(admin.ModelAdmin):
inlines = [shopInline]
admin.site.register(Shop, ShopInline)
admin.site.register(Pickup, PickupAdmin)