Tuesday, May 18, 2021

Re: i need to show multiselectfields

there is no error, just removing id numbers

1.PNG

On Tuesday, 18 May 2021 at 21:28:41 UTC+4 bharath...@gmail.com wrote:
What is the error you are facing. Please share the screenshots

On Tue, 18 May 2021, 10:17 pm Gegi Esitashvili, <gegiesi...@gmail.com> wrote:
I tried it before posted here, It doesnt work unfortuntly :(

On Tue, 18 May 2021 at 19:11, RANGA BHARATH JINKA <bharath...@gmail.com> wrote:
use {{ facilitie.name }} instead of {{ facilitie }}
<li class="fac"><i class="fas fa-swimmer iconsize"></i>{{ facilitie.name }}</li>

On Tue, May 18, 2021 at 8:27 PM RANGA BHARATH JINKA <bharath...@gmail.com> wrote:
Hi,

Please share screenshots. So that we can understand where you want to show

On Tue, May 18, 2021 at 8:04 PM Gegi Esitashvili <gegiesi...@gmail.com> wrote:

and i got it what i wanted but it is only facilitiess id and not its name, so i need to show up its name and not id.
On Monday, 17 May 2021 at 08:21:25 UTC+4 bharath...@gmail.com wrote:
Hi,

Use a select box with multiple attribute instead of ul and li. Loop through options. Please go through this. https://www.w3schools.com/tags/att_select_multiple.asp#:~:text=For%20windows%3A%20Hold%20down%20the,button%20to%20select%20multiple%20options

All the best 

On Sun, May 16, 2021 at 8:50 PM Gegi Esitashvili <gegiesi...@gmail.com> wrote:
hello everyone, i am using django allauth, also i have installed multiselectfield and trying show my facilities on the site.

this is my models.py

class Hotel(models.Model):
name = models.CharField(max_length=128)
description = models.TextField()
stars = models.IntegerField()
price = models.IntegerField()
picture = models.ImageField(upload_to='images', default="images/124180566_3771168516249284_3976912378791517206_o.jpg")
HOTEL_TYPE = (
("Free WiFi", "free wiFi"),
("Free Parking", "Free Parking"),
)
popular_facilities = MultiSelectField(choices=HOTEL_TYPE)


this is my views.py 

def see_more(request, id):
seemore = Hotel.objects.get(id=id)
reviews = HotelReview.objects.filter(review=id, permission=True)[:2]
facilities = seemore.popular_facilities
form = HotelReviewForm()
if request.method == "GET":
form = HotelReviewForm(request.GET or None) #request.FILES მედიას ატვირთვა თუ გვინდა
if form.is_valid():
data = form.save(commit=False)
data.review = seemore
data.name = form.cleaned_data.get("name")
data.email = form.cleaned_data.get('email')
data.comment = form.cleaned_data.get('comment')
data.rating_number = form.cleaned_data.get('rating_number')
data.permission = True
data.save()

return redirect('hotel:seemore', id)

context = {
'seemore':seemore,
'reviews':reviews,
'form':form,
'facilities':facilities
}
return render(request, 'hotel/seemore.html', context)

and this is my html

<p class="se-p">Popular Facilities</p>
<ul>
{% for facilitie in facilities %}
<li class="fac"><i class="fas fa-swimmer iconsize"></i>{{ facilitie }}</li>
{% endfor %}

and this is what is showed up1.PNG



can anyone help me?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db5fa916-7676-4ba8-bea0-05f4e0f8af8cn%40googlegroups.com.


--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea022731-01bf-44ca-9b9a-dfb9bf4761ecn%40googlegroups.com.


--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114


--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/XkHCuUnLsoQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m316DHEKv954tZ2atwEOdPGK6WMquRqvGHnwW3ByK6PJY-A%40mail.gmail.com.
--
Sincerely

Gegi Esitashvili

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9fd75768-6ee9-41d8-ad13-f9b76991454en%40googlegroups.com.

No comments:

Post a Comment