Hi all,

Anyone having complete practical knowledge of Django. Kindly help me to do
so.

Warm regards,
Arjun Kumar
Delhi, India


On Thu, 17 Jun 2021 at 16:40, Aritra Ray <aritra...@gmail.com> wrote:

> Hi,
> I've been building a Django E-commerce website and I'm facing this problem.
> I have created a Banner model which will take in images via
> django.ResizedImage and then display it in the homepage. But I'm unable to
> process them in CSS.
> Kindly help me out.
>
> PS: I'll have to process it as background-image orelse when passed as
> <img> in html, we're getting extra wrapped spaces which aren't needed.
>
> Below given are: views.py, models.py, index.html, css block.
> Kindly help me out as it is urgent. Thank you for your support in advance.
>
> Regards,
> Aritra
>
> class HomeView(ListView):
>     context_object_name = 'items'
>     template_name = "index.html"
>     queryset = Items.objects.all()
>
>     def get_context_data(self, **kwargs):
>         context = super(HomeView, self).get_context_data(**kwargs)
>         context['banners'] = Banner.objects.all()
>         return context
>
> class Banner(BaseModel):
>     image = ResizedImageField(upload_to="banner", null=True, blank=True)
>
> <div class="banner header-text">
>     <div class="owl-banner owl-carousel">
>       {% for banner in banners %}
>         <div class="banner-item-01" style= --item: {{banner.image.url}}></div>
>       {% endfor %}
>     </div>
> </div>
>
>   .banner-item-01 {
>    padding:300px 0px;
>    background-size: cover;
>    background-image: url(var(--item));
>    background-repeat: no-repeat;
>    background-position: center center;
> }
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFecadvDi5V4%3DuetJhSZo1FSyOyGsvLH_s7K%2Bhc-vMLU%2BHLBpA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFecadvDi5V4%3DuetJhSZo1FSyOyGsvLH_s7K%2Bhc-vMLU%2BHLBpA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFURcXxyVB-jjAr9Duruehs5HTdUugos55gp1vMhm1ODrd6ehQ%40mail.gmail.com.

Reply via email to