Re: How to make a Purchase Order app?

2018-08-03 Thread Andréas Kühne
Hi, I think you are doing it right. I would remove the PurchaseOrderTotal model however. The reason for this is that the purchase order itself should know it's total and so on. Either you can add a signal on the save of the PurchaseOrderItem - and update the PurchaseOrder total or the PurchaseOrde

Re: CI build failing but local builds pass

2018-08-03 Thread Ismail Sunni
Thanks so much. I got this problem also. On Thursday, August 2, 2018 at 2:02:34 AM UTC+7, Ajat Prabha wrote: > > The issue is fixed now, it happened because Travis used PostgreSQL v9.2 by > default and Django v2.1 works with v9.4+ (changelog >

Django dynamic Database

2018-08-03 Thread Cheran Rj
Hi! how to create dynamic database for each user or organisation -- 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 p

Re: Do some task using models in a view before a request is executed.

2018-08-03 Thread Christian
Thanks! Am Donnerstag, 2. August 2018 15:18:36 UTC+2 schrieb Jason: > > DRF viewsets provide default implementations of list (GET resource/) and > retrieve (GET resource/id). You can just reimplement those methods and > call `rfm_update` in them. > -- You received this message because you are

Re: GEOSGeometry function dies with error pure virtual method called message

2018-08-03 Thread Tim Graham
The code you gave doesn't crash on my system, even with Django 2.0.x. Can you give a complete traceback? On Thursday, August 2, 2018 at 12:15:52 PM UTC-4, Saurabh Khanduja wrote: > > The version of django is 2.0.4 > Debugging - Just step into code where the program is crashing in transform > fun

JSON serializable error

2018-08-03 Thread Anusha Kommineni
Hi, I am getting below error.Can anyone help me? TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON serializable -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails fro

Django keeps object references in case of exception

2018-08-03 Thread claudio . cilloni
Hi all. I know Python but I'm pretty new to Django. It seems to me this is a bug, but I'd like your opinions before actually filing a bug report. this is my function, executed by an http call: @csrf_exempt def main(request): obj = MyClass() # raise AssertionError return HttpRespon

Re: JSON serializable error

2018-08-03 Thread Julio Biason
Hi Anusha, It seems you're trying to generate a JSON of some object/dictionary with a Datetime in it. Datetimes are not serializable 'cause there is no date/time representation in JSON (maybe epoch, but that's not the default). On Fri, Aug 3, 2018 at 11:18 AM, Anusha Kommineni < anushakommineni..

Re: JSON serializable error

2018-08-03 Thread vineeth sagar
You can use unix timestamp, It's json serializable and can be converted to a datetime object. If I am not wrong you were trying to store it in a session? try this. import time timestamp=time.time() request.session['current time']= timestamp import datetime datetime.datetime.fromtimestamp(request

Re: JSON serializable error

2018-08-03 Thread Christophe Pettus
> On Aug 3, 2018, at 07:18, Anusha Kommineni > wrote: > TypeError: datetime.datetime(2018, 2, 12, 0, 0, tzinfo=) is not JSON > serializable The error means what it says; there is no default way of serializing a datetime into JSON. You can use the DjangoJSONEncoder, which does allow serializ

Re: Django keeps object references in case of exception

2018-08-03 Thread Christophe Pettus
> On Aug 3, 2018, at 07:23, claudio.cill...@gmail.com wrote: > > It seems to me this is a bug, but I'd like your opinions before actually > filing a bug report. I suspect what you are seeing there is a difference in garbage collection behavior. __del__ is not run immediately upon the referen

Re: Django keeps object references in case of exception

2018-08-03 Thread claudio . cilloni
Sorry but... no. It's not mandatory for any Python implementation, but the CPython interpreter collects any objects as soon as its reference count reaches zero, thus running the __del__ method. https://docs.python.org/3/c-api/intro.html#reference-counts https://docs.python.org/3/reference/datamo

Re: Django dynamic Database

2018-08-03 Thread carlos
What ? Need more information when you say dynamic database El vie., 3 de ago. de 2018 5:36 a. m., Cheran Rj escribió: > Hi! how to create dynamic database for each user or organisation > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To

How to test TestContextDecorator

2018-08-03 Thread Kamil Pluciński
Hi all ;) I work with this ticket: 29024 . I changed decorate_class function in TextContextDecorator : def setUp(inner_self): context = self.enable() if self.attr_name:

Re: How to make a Purchase Order app?

2018-08-03 Thread Alexander Joseph
Thanks Andréas, very helpful! One more question - Since I'm using class based views and this view requires 2 models I'm unsure how to fetch the data from both the models to use in the same view. It looks like I need to modify the get_context_data() method but I'm unsure how to filter this way.

Re: How to test TestContextDecorator

2018-08-03 Thread john-django
Kamil, Maybe I am missing something, but you can test for exceptions like this: class TestSomething(unittest.TestCase):   def test_something_that_raises_an_exception(self): *with self.assertRaises(Exception):* # Do something that is supposed to raise an exception John On

Re: Django dynamic Database

2018-08-03 Thread Mikhailo Keda
Do you mean multi-tenancy? If so - check those apps - https://djangopackages.org/grids/g/multi-tenancy/ -- 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-u

Re: GEOSGeometry function dies with error pure virtual method called message

2018-08-03 Thread Mikhailo Keda
I replicated this, No traceback, python crashes with a message: libc++abi.dylib: Pure virtual function called! I'm assuming this is related to GDAL on macOS. Without debug it works fine. Environment details: > Django 2.0.7 Python 3.7.0 GDAL 1.11.5 macOS High Sierra -- You received this message