how to show image with index in python as context variable

2017-04-25 Thread Shamaila Moazzam
hi, i am trying to display a set of images with the use of index. here is the code: {% for item in product.productimage_set.all %} {% endfor %} the above code is displaying a set of images for one product .right. i want to displa

Displaying the multiple images in the product detail page

2017-04-25 Thread hadiqakhurshid1
I have created a separate image class where you can add images but I'm unable to show the multiple images on the product detail page. If anyone can guide me, it would be great. class Image(models.Model): active = models.BooleanField(default=True) product = models.ForeignKey(Product)

RE: Displaying the multiple images in the product detail page

2017-04-25 Thread Matthew Pava
You could reference the images from your Product object like so: product.image_set.all() You may want to use models.ImageField, which inherits from models.FileField, instead of models.FileField For more information: https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_one/ https:/

Re: Why my tests need to run migrate before??

2017-04-25 Thread XaviP
Thanks for the response. The problem was about some non-lazy queries in views. El diumenge, 2 abril de 2017 16:51:59 UTC+2, ludovic coues va escriure: > > My first guess would be that test happen on a fresh database and > migrate is how django build its database > > 2017-04-02 11:34 GMT+02:00 X

Models not appearing in Admin page.

2017-04-25 Thread Ratul Shams
Hey Pythonistas! I was working on Django and made a Model, but its not appearing on my Django Admin page even after migrating. https://pastebin.com/A2QiLEhp Suggestions will help people! Thank you! -- You received this message because you are subscribed to the Google Groups "Django users

Re: Models not appearing in Admin page.

2017-04-25 Thread Vijay Khemlani
Register in in the admin.py file https://docs.djangoproject.com/en/1.11/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin On Tue, Apr 25, 2017 at 9:46 AM, Ratul Shams wrote: > Hey Pythonistas! > I was working on Django and made a Model, but its not appearing on my > Django Admin page

Re: Displaying the multiple images in the product detail page

2017-04-25 Thread hadiqakhurshid1
i am trying to display a set of images with the use of index. here is the code: {% for item in product.productimage_set.all %} {% endfor %} the above code is displaying a set of images for one product .right. i want to display it

Re: Attach consumer to dynamically created single-reader channel (Django Channels)

2017-04-25 Thread Alexander Prokhorov
Dear Andrew, thank you for advice. Now I am starting implementing ASGI worked based on one included in Channels. I would like to take a look at example of how to create and use single-reader channels properly, so I took Channels, asgi_redis and Daphne code base and did not found any place where

Re: Attach consumer to dynamically created single-reader channel (Django Channels)

2017-04-25 Thread Andrew Godwin
You did not miss anything, Daphne does not yet implement that part of the spec. It's something I hope to have in the next release. Andrew On Tue, Apr 25, 2017 at 10:28 AM, Alexander Prokhorov wrote: > Dear Andrew, > > thank you for advice. Now I am starting implementing ASGI worked based on > o

Re: SelectDateWidget dosent work

2017-04-25 Thread Melvyn Sopacua
On Monday 24 April 2017 17:26:20 shahab emami wrote: > class ProfileForm(ModelForm): > birth_date= forms.DateField(widget=forms.SelectDateWidget) > class Meta: > model = Member > exclude = () > > > then i expect a dropdownlist for birth_date in template but it is only > a

Re: Displaying the multiple images in the product detail page

2017-04-25 Thread Shamaila Moazzam
{% for item in product.productimage_set.all %} {% endfor %} this code is displaying different images of a single product ,but the question is how to slice them ,how to get image[0], image[1] ..on the product page... can any o

Can't get error to display when using inlineformset_factory.

2017-04-25 Thread Andrew Michael
I am trying to get validation errors to appear on my web page when using an inlineformset_factory. I have a main form called PersonalInformation form and 3 inline forms (Relative, PositionHeld and Phone). I am receiving the main form errors on my page, but I can't get the 3 inline forms to displ

RE: Can't get error to display when using inlineformset_factory.

2017-04-25 Thread Matthew Pava
Try using self.add_error('state': 'Must select state if province is not entered.') or raise ValidationError({'state': 'Must select state if province is not entered.'}) From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Andrew Michael Sent: Tuesday, April 2

Re: SelectDateWidget dosent work

2017-04-25 Thread kenton Fletcher
This is the way I use a SelectDateWidget in my forms.py. from django.forms import ModelForm, SelectDateWidget class ProfileForm(ModelForm): class Meta: widget ={' birth_date': SelectDateWidget() } model = Member fields = '__all__' exclude = () --

RE: SelectDateWidget dosent work

2017-04-25 Thread Matthew Pava
Widget should be plural: widgets ={' birth_date': SelectDateWidget() } From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of kenton Fletcher Sent: Tuesday, April 25, 2017 3:46 PM To: Django users Subject: Re: SelectDateWidget dosent work This is the way I use

Multiplexing results from multiple models in socket

2017-04-25 Thread Yarnball
Hi, I have setup Django channels to fetch `messages` from a given `room`. However, I would like to change this logic to receive messages from several rooms. In DRF, I use serializers for this. I saw some for loops doing this, but I believe it is very inefficient. What is the correct way to do

Multiplex results from (Django-Channels)

2017-04-25 Thread Yarnball
Hi, I've currently setup Django channels to receive all the `messages` from a single `room`. However, I would like to set it up to receive `messages` from several rooms. In DRF, I'd use serializers to achieve this. However, in sockets, I am unsure how I would do it. What is the correct EG fro

Re: Multiplex results from (Django-Channels)

2017-04-25 Thread Andrew Godwin
Hi - I'll only reply to this thread, as you seem to have posted it twice with different subjects. If you're going with the groups approach, as it seems you are, you need to add the user to multiple groups, one for each room, and then stick the room name in the group sends so you can distinguish th

Re: Displaying the multiple images in the product detail page

2017-04-25 Thread m712 - Developer
Stop replying over and over again with the same content, we saw it. Regarding your question, I don't know whether you're referring to item[0].image[x] or item[x]. If you're refferring to the first one then please consider renaming your variables. In any case; this:          {% for item in produc

Re: Displaying the multiple images in the product detail page

2017-04-25 Thread m712 - Developer
I forgot a second {% endfor %} below the there, but you get the idea. On Apr 26, 2017 6:29 AM, m712 - Developer wrote:Stop replying over and over again with the same content, we saw it. Regarding your question, I don't know whether you're referring to item[0].image[x] or item[x]. If you're reffer