Re: TestCase.setUpTestData in-memory data isolation.

2018-11-30 Thread hunar techie
hi there , im from kurdistan and my mother language is kurdish but
unfortunately django doesnt support kurdish language , sometimes i need to
add multi language to my projects , how can i add multi language?
thanks for advice

On Fri, Nov 30, 2018 at 7:15 PM Tobias McNulty 
wrote:

> Hi Simon,
>
> Intriguing proposal! Thanks for bringing it up. This is certainly
> something I've struggled with on older projects we've continued to maintain.
>
> My first impression (and it may be only that) is that this seems a big
> magical and potentially confusing, especially in the event the copy
> operation fails. I would want some way to disable the behavior, or even
> have "disabled" as the default, at least for a couple releases (e.g., by
> keeping it as a decorator the way you have it now). Alternatively, is there
> a reason this couldn't continue to live as an external package?
>
> I'm also not sure I understand the argument about how the current
> implementation doesn't help reduce round trips to the database. Is this
> just a case of the docs offering a less-than-optimal recommendation? When
> tests do need to modify a record in the database that was created in
> setUpTestData(), it's easy enough to replace self.obj.foo = bar;
> self.obj.save() with Model.objects.filter(pk=self.obj.pk).update(foo=bar),
> which will avoid modifying the Python object and be *at least* as
> efficient as the original code, without the need for any additional
> overhead. I'll admit tracking down the offending code can be a pain, but it
> can be done.
>
> Could we, for example, include something along these lines as the
> preferred approach in the docs
> ,
> and/or even find a way to raise an error or warning when a test does modify
> an object that it shouldn't?
>
> Tobias
>
> On Wed, Nov 28, 2018 at 11:42 PM charettes  wrote:
>
>> Hey Josh, glad the package can help in the mean time!
>>
>> > Is there anyway to determine the pickle-ability of something without
>> just trying to pickle it? I wouldn't be keen on that overhead.
>>
>> Not that I'm aware off but unfortunately. There really shouldn't be much
>> overhead though because the deepcopy is only performed on instance
>> attribute access. That means that tests that are only creating test data
>> without accessing attributes assigned during setUpTestData() are not going
>> to be affected by this change at all. In other words, I suggest only doing
>> the deep copy if required for the requested attributes so if you define a
>> complex data set in setUpTestData() then only the few attributes and their
>> related objects would get deepcopied on instance attribute accesses.
>>
>> > Could you just capture any copy exceptions, raise a deprecation
>> warning, and abandon the copy for that attribute?
>>
>> Yeah that's the exact plan for the deprecation phase; warn and return the
>> actual attribute. From Django 3.1 this would result in an AttributeError.
>>
>> I've updated the branch with the deprecation warnings[0] approach.
>>
>> I'll give it one or two more weeks to gather a bit more feedback but it
>> looks like this could be a viable option so far.
>>
>> Cheers,
>> Simon
>>
>> [0]
>> https://github.com/django/django/compare/master...charettes:testdata#diff-5d7d8ead1a907fe91ffc121f830f2a49R1032
>>
>> Le mercredi 28 novembre 2018 21:40:53 UTC-5, Josh Smeaton a écrit :
>>>
>>> Our project also suffers extensively with mutating objects assigned from
>>> setUp, preventing us from moving most of our tests to setUpTestData. I'll
>>> likely begin using your pypi package right away, thanks Simon!
>>>
>>> Backward compat issues are probably likely - but they'd be in test cases
>>> exclusively, making them extremely easy to find during an upgrade. That
>>> said, a deprecation warning is probably the most sensible path forward to
>>> prevent the need for immediate action.
>>>
>>> Is there anyway to determine the pickle-ability of something without
>>> just trying to pickle it? I wouldn't be keen on that overhead. Could you
>>> just capture any copy exceptions, raise a deprecation warning, and abandon
>>> the copy for that attribute?
>>>
>>> On Saturday, 24 November 2018 14:29:33 UTC+11, charettes wrote:

 Dear developers,

 Django 1.8 introduced the `TestCase.setUpTestData()` class method as a
 mean to
 speed up test fixtures initialization as compared to using `setUp()`[0].

 As I've come to use this feature and review changes from peers using it
 in
 different projects the fact that test data assigned during its execution
 couldn't be safely altered by test methods without compromising test
 isolation
 has often be the source of confusion and frustration.

 While the `setUpTestData` documentation mentions this limitation[1] and
 ways to
 work around it by using `refresh_from_db()` in `setUp()` I believe it
 defeats
 the whole p

Re: Fellow Reports - January 2019

2019-02-03 Thread hunar techie
https://stackoverflow.com/questions/54503581/python-setup-in-cpanel-file-usr-bin-virtualenv-errno-2-no-such-file-or-dir

please someone can help me to fix this issues

On Sun, Feb 3, 2019 at 12:46 AM Tim Graham  wrote:

> Week ending February 2, 2019
>
> Triaged
>
> ---
>
> https://code.djangoproject.com/ticket/30146 - Move change form fieldset
> toggle to the right side (wontfix)
>
> https://code.djangoproject.com/ticket/30150 - Django 1.11 with MySQL 8:
> "Unknown system variable 'TX_ISOLATION'" (wontfix)
>
> https://code.djangoproject.com/ticket/30151 - QuerySet.last() and []
> operator give different results (invalid)
>
> https://code.djangoproject.com/ticket/30152 - MySQL: "Cannot change
> column 'id': used in a foreign key constraint" when altering pk of model
> with ForeignKey to self (accepted)
>
> https://code.djangoproject.com/ticket/30153 - ModelAdmin with custom
> widgets, inlines, and filter_horizontal can merge media in broken order
> (accepted)
>
> Authored
>
> --
>
> https://github.com/praekelt/django-recaptcha/pull/180 - Add testing for
> Django 2.2
>
> https://github.com/django-haystack/django-haystack/pull/1659 - Add
> testing for Django 2.2
>
> https://github.com/pennersr/django-allauth/pull/2192 - Add testing for
> Django 2.2
>
> https://github.com/SmileyChris/easy-thumbnails/pull/510 - Add testing for
> Django 2.2
>
> Reviewed/committed
>
> --
>
> https://github.com/django/django/pull/10904 - Fixed #30137 -- Replaced
> OSError aliases with the canonical OSError.
>
> https://github.com/django/django/pull/10851 - Made test table cleanup in
> OperationTestBase more robust.
>
> https://github.com/django/django/pull/10716 - Fixed #29973 -- Added
> compilemessages --ignore option.
>
> https://github.com/django/django/pull/10874 - Fixed #30108 -- Allowed
> adding foreign key constraints in the same statement that adds a field.
>
> https://github.com/django/django/pull/10877 - Fixed #22423 - Added
> support for MySQL operators on real geometries.
>
> https://github.com/django/django/pull/10760 - Fixed #30020 -- Fixed
> importing nulls with LayerMapping.
>
> https://github.com/django/django/pull/10822 - Fixed #30076 -- Added
> Model.get_FOO_display() even if field's choices are empty.
>
> https://github.com/django/django/pull/10919 - Fixed #30147 -- Simplified
> directory creation with os.makedirs(..., exist_ok=True).
>
> https://github.com/django/django/pull/10891 - Refs #28161 -- Doc'd
> INSTALLED_APPS requirement for ArrayField(CIText).
>
> https://github.com/django/django/pull/10918 - Used LoginRequiredMixin in
> "Models and request.user" example.
> https://github.com/django/django/pull/10730 - Fixed #29393 -- Prevented
> infinite loop in ExceptionReporter.get_traceback_frames().
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/6fa3a54e-c8b0-47fd-a088-48afc41b5318%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2BuQ%3DiQ7M__%3DVBUNhJC1oT_kBRZG2%3DGkXeXLZYAVy1kQ4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


mysqlclient

2019-03-22 Thread hunar techie
hi there
im working on a project and i want to live it through my cpanel , but when
i try to install pip install mysqlclient
i get this error
[image: er.PNG]
thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2BsX73xqnWX%3DLCsh%3DS9JQxtbe-5Wo8y1%2BV8LnhB%2BchaPQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


select quantity for each items selected in many to many field

2019-07-19 Thread hunar techie
hi there i'm working on an restaurant ordering system , when someone order
more than one product with different quantities for each product , be able
to select its quantities
it may order 3 Pizza with 2 sandwich , how to let the customer to define
the quantities of each product , and then calculate with its prices
 class Restaurant(models.Model):

name = models.CharField(max_length=50)
price = models.PositiveIntegerField(default=1)


def __str__(self):
return self.name
class Topping(models.Model):
name = models.CharField(max_length=50)
product_names = models.ManyToManyField(Restaurant, blank=True)
quantity = models.PositiveIntegerField(default=1)


total price of orders , for one product for example : one pizza with
one sandwich however they order more than one pizza and sandwich

@property
def total(self):
return self.product_names.aggregate(Sum('price'))['price__sum']

I expected to provide a quantity field for each selected items : pizza : 3
, sandwich:2 , then calculate them (3*pizza price , 2*sandwich price)

thanks for advice

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2Bt3BPPr6m4jkeU0qPR00p5Aoun1h%2Bw7mi%2BYi5jqNf4WoQ%40mail.gmail.com.


select quantity for each items selected in many to many field

2019-07-20 Thread hunar techie
hi there i'm working on an restaurant ordering system , when someone order
more than one product with different quantities for each product , be able
to select its quantities
it may order 3 Pizza with 2 sandwich , how to let the customer to define
the quantities of each product , and then calculate with its prices
 class Restaurant(models.Model):

name = models.CharField(max_length=50)
price = models.PositiveIntegerField(default=1)


def __str__(self):
return self.name
class Topping(models.Model):
name = models.CharField(max_length=50)
product_names = models.ManyToManyField(Restaurant, blank=True)
quantity = models.PositiveIntegerField(default=1)


total price of orders , for one product for example : one pizza with
one sandwich however they order more than one pizza and sandwich

@property
def total(self):
return self.product_names.aggregate(Sum('price'))['price__sum']

I expected to provide a quantity field for each selected items : pizza : 3
, sandwich:2 , then calculate them (3*pizza price , 2*sandwich price)

thanks for advice

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2Bti%3Dh4jve4J6GSOhvWfWj-FB1-o0OAZv0EzzFEX1k-%2BiA%40mail.gmail.com.


this feature available in django

2019-07-23 Thread hunar techie
https://stackoverflow.com/questions/57147616/define-quantity-for-each-selected-item-in-the-same-time

i asked everywhere but i didnt find a solution

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2BsQghxuDEHifwiLPYBbDMOwjLGbgHbjppfFeiP9%2BsqKCw%40mail.gmail.com.


Re: this feature available in django

2019-07-23 Thread hunar techie
i asked alot everywhere , stackoverflow , github , facebook django groups ,
i didnt get a result , if you can help me out , please let me know , i much
appreciate


On Tue, Jul 23, 2019 at 2:52 PM Adam Johnson  wrote:

> Hi again!
>
> I think you've (again) found the wrong mailing list for this post. This
> mailing list is for the development of Django itself, not for support using
> Django. This means the discussions of bugs and features in Django itself,
> rather than in your code using it. People on this list are unlikely to
> answer your support query with their limited time and energy. Read more on
> the mailing lists at https://www.djangoproject.com/community/
>
> For support, please use the django-users mailing list, or IRC #django on
> Freenode, or a site like Stack Overflow. There are people out there willing
> to help on those channels, but they might not respond if you don't ask your
> question well. Stack Overflow's question guide can help you frame it well:
> https://stackoverflow.com/help/how-to-ask .
>
> Also if you haven't read it, please take a look at Django's Code of
> Conduct: https://www.djangoproject.com/conduct/ . These are our "ground
> rules" for working well as a community, and will help you get the most out
> of Django and our fantastic community.
>
> Thanks for your understanding,
>
> Adam
>
> On Tue, 23 Jul 2019 at 09:58, hunar techie 
> wrote:
>
>>
>> https://stackoverflow.com/questions/57147616/define-quantity-for-each-selected-item-in-the-same-time
>>
>> i asked everywhere but i didnt find a solution
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CAKJtO%2BsQghxuDEHifwiLPYBbDMOwjLGbgHbjppfFeiP9%2BsqKCw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-developers/CAKJtO%2BsQghxuDEHifwiLPYBbDMOwjLGbgHbjppfFeiP9%2BsqKCw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Adam
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMyDDM2dAJypW%2BVHZPa7z9MX34T2rDxVvBKp2Cic10gYQJg7RA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAMyDDM2dAJypW%2BVHZPa7z9MX34T2rDxVvBKp2Cic10gYQJg7RA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAKJtO%2Bvqc%3Dtow_dxWwdpcSuyFvc%2B%3DmGX%2B%3D%2B25_T2Br%2BHpbJdZg%40mail.gmail.com.