Re: Hello ! I'm having some issues in django unit testing. Is there anybody to help ?

2020-11-06 Thread Monaco investment
Am having hard time learning django...can someone please get in touch...I will 
be really grateful... thanks

Get Outlook for Android


From: django-users@googlegroups.com  on behalf 
of Nilima Dahal 
Sent: Friday, November 6, 2020 1:11:59 PM
To: Django users 
Subject: Hello ! I'm having some issues in django unit testing. Is there 
anybody to help ?

Hello ! I'm having some issues in django unit testing. Is there anybody to help 
?
I'm having confusion in testing django mixins . Can anyone share his/her git 
with such unit testing or have some experienced shareable codes.

how do I test this ?

def dispatch(self,request,*args,**kwargs):
if self.request.user.is_superuser:
return super().dispatch(request, *args, **kwargs)
return self.handle_no_permission()




--
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/44f22b97-7499-4762-92d2-59fa6dd6ad8bn%40googlegroups.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AM6PR03MB595708923241D013CF47325AA7EC0%40AM6PR03MB5957.eurprd03.prod.outlook.com.


Hello ! I'm having some issues in django unit testing. Is there anybody to help ?

2020-11-06 Thread Nilima Dahal
Hello ! I'm having some issues in django unit testing. Is there anybody to 
help ? 
I'm having confusion in testing django mixins . Can anyone share his/her 
git with such unit testing or have some experienced shareable codes.

how do I test this ?

def dispatch(self,request,*args,**kwargs):
if self.request.user.is_superuser:
return super().dispatch(request, *args, **kwargs)
return self.handle_no_permission()



-- 
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/44f22b97-7499-4762-92d2-59fa6dd6ad8bn%40googlegroups.com.


Re: Dropdown

2020-11-06 Thread Adithya Gowli
Hi Shubham Deshpande Hope you're doing good
   For making a dropbox you can use bootstrap it
gives different types of navs bars https://getbootstrap.com/

On Thu, Nov 5, 2020 at 7:38 PM Kasper Laudrup  wrote:

> Hi Shubham.
>
> On 05/11/2020 06.17, Shubham Deshpande wrote:
> > How do you make a dropdown box in django
> >
>
> You don't use Django for that. That's plain HTML:
>
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/8be280a1-4c43-2d87-fe4d-787da0d625c0%40stacktrace.dk
> .
>

-- 
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/CADPiQZRKnHw-EfSLFJiG%2B6zVAo_yCG%2B4MBKHCK0tB%2B3KhPi-RA%40mail.gmail.com.


Re: bug in bulk_create

2020-11-06 Thread Jakub Stawowy
That's happened in Django 3.x when Method 'add' is used with many-to-many 
relations if intermediate model is used. consider call it on intermediate 
model manager like `DealCategoryThrough.objects.create(deal=deal, 
dealcategory=category)`


wtorek, 4 sierpnia 2020 o 14:10:15 UTC+2 nima salemahim napisaƂ(a):

> Traceback (most recent call last):
>   File "/usr/lib/python3.7/code.py", line 90, in runcode
> exec(code, self.locals)
>   File "", line 1, in 
>   File 
> "/home/nima/.virtualenvs/behtarino/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py",
>  
> line 946, in add
> through_defaults=through_defaults,
>   File 
> "/home/nima/.virtualenvs/behtarino/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py",
>  
> line 1150, in _add_items
> ])
> TypeError: bulk_create() got an unexpected keyword argument 
> 'ignore_conflicts'
>
> hi i have three models
>
> when i try to add on deal to one a category 
>
> like : deal.categories.add(category)
>
> i face error above can you help me about what the problem is ?
>
> i dont know exactly it is django problem or django-ordered-model module 
> problem
>
> class Deal(ModificationLogMixin, models.Model):
> title = models.CharField(max_length=160, blank=True, null=True)
> description = models.TextField(blank=True, null=True)
> initial_price = models.IntegerField(blank=True)
> discounted_price = models.IntegerField(blank=True)
> categories = models.ManyToManyField(
> 'deal.DealCategory',
> related_name='deals',
> blank=True,
> through='DealCategoryThrough',
> through_fields=('deal', 'dealcategory')
> )
>
> class DealCategory(OrderedModel):
> business = models.ForeignKey(Business, related_name='deal_categories',
>  on_delete=deletion.CASCADE)
> name = models.CharField(max_length=100, blank=True, null=True)
> order_with_respect_to = 'business'
>
> class DealCategoryThrough(OrderedModel):
> deal = models.ForeignKey('deal.Deal', on_delete=models.deletion.CASCADE,
>  related_name='ordered_deals')
> dealcategory = models.ForeignKey(DealCategory, 
> on_delete=models.deletion.CASCADE,
>  related_name='ordered_deals')
> order_with_respect_to = 'dealcategory'
>
>

-- 
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/63929fc3-db58-41b1-b142-f16822ed4f44n%40googlegroups.com.