整合照片记录
我想将 photologue 与我的 Django 应用程序集成,并用它来显示车辆库存中的照片...有点像 Boost Motor Group Inc. 提供的功能。我已经集成了该应用程序,所以下一步我正在尝试弄清楚如何将其连接到我的车辆模型以及如何显示照片。顺便说一句,我的车型看起来像这样
class Vehicle(models.Model):
stock_number = models.CharField(max_length=6, blank=False)
vin = models.CharField(max_length=17, blank=False)
common_vehicle = models.ForeignKey(CommonVehicle)
exterior_colour = models.ForeignKey(ExteriorColour)
interior_colour = models.ForeignKey(InteriorColour)
interior_type = models.ForeignKey(InteriorType)
odometer_unit = models.ForeignKey(OdometerUnit)
status = models.ForeignKey(Status)
odometer_reading = models.PositiveIntegerField()
selling_price = models.PositiveIntegerField()
purchase_date = models.DateField()
sales_description = models.CharField(max_length=60, blank=False)
feature_sets = models.ManyToManyField(FeatureSet, blank=True)
features = models.ManyToManyField(Feature, blank=True)
def __unicode__(self):
return self.stock_number
I want to integrate photologue with my Django app and use it to display photos in a vehicle inventory...kinda like what is offered by Boost Motor Group Inc. I've already integrated the app so the next step which I'm trying to figure out is how to hook it up into my vehicle model and also how to display the photos. My vehicle model looks like this BTW
class Vehicle(models.Model):
stock_number = models.CharField(max_length=6, blank=False)
vin = models.CharField(max_length=17, blank=False)
common_vehicle = models.ForeignKey(CommonVehicle)
exterior_colour = models.ForeignKey(ExteriorColour)
interior_colour = models.ForeignKey(InteriorColour)
interior_type = models.ForeignKey(InteriorType)
odometer_unit = models.ForeignKey(OdometerUnit)
status = models.ForeignKey(Status)
odometer_reading = models.PositiveIntegerField()
selling_price = models.PositiveIntegerField()
purchase_date = models.DateField()
sales_description = models.CharField(max_length=60, blank=False)
feature_sets = models.ManyToManyField(FeatureSet, blank=True)
features = models.ManyToManyField(Feature, blank=True)
def __unicode__(self):
return self.stock_number
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
出于您的目的,我建议您查看 django-imagekit (我写了 imagekit 和 photologue) 。它被设计为集成到其他应用程序中,而不是作为一个独立的应用程序本身。之后,正如多米尼克所说,我们需要更多地了解您的要求。
For your purposes I would recommend you check out django-imagekit (I wrote both imagekit and photologue). It was designed to be integrated into other applications as opposed to being a stand-alone application itself. After that, as Dominic said, we'll need to know more about your requirements.
使用 ImageKit(太棒了!)
model.py
specs.py
我在模板中
您将像这样访问此缩略图: admin.py 可能如下所示:
关于 ImageKit
将文件specs.py添加到您的应用程序中并告诉ImageKit它,如下所示
向您的照片模型添加一个字段以保存哪种视图/它显示的内容。即 ChoiceField
在视图/模板中您可以对其进行过滤
I use ImageKit (great!)
model.py
specs.py
in your template you will access this thumbnails like this:
admin.py could look like this:
All about ImageKit
add the file specs.py to your app and tell ImageKit of it like this
add a field to your Photo-Model to save what kind of view/ content it shows. i.e. ChoiceField
In view/template you can filter for it