These are chat archives for django/django

Oct 2017
Anish Shrestha
Oct 05 2017 10:38
@LukeVideo Sorry Luke
In [25]: BaseItem.objects.filter(search_fields__type3__contains='2-hair-care')
Out[25]: <QuerySet [<BaseItem: Coco Oil (1.0 ltr) in Hair Care>]>

In [26]: BaseItem.objects.filter(search_fields__type3__contains='2-hair-car')
Out[26]: <QuerySet []>
search_fields is a postgres JSONField
In [27]: BaseItem.objects.all().filter(id=59).values('search_fields')
Out[27]: <QuerySet [{'search_fields': '{"type1": "0-supermarket", "type2": "1-personal-care", "type3": "2-hair-care", "cat1_name": "Supermarket", "cat2_name": "personal care", "cat3_name": "Hair Care"}'}]>
Can you please tell me why contains expression shows no results in the [26] queryset
Anyone? Please.
Thank you
Oct 05 2017 10:42
Asking the question again in case someone has any idea:
"Hey everyone. I was wondering what is the best way to go when one wants to use Django with DynamoDB. Any advice or example code?"
Anish Shrestha
Oct 05 2017 13:05
Furthermore, how can I be able to declare filters based on the request params.
type3 = df.CharFilter(name="<varying_json_param_here>", lookup_expr='iexact')
It is required to take any form based on request.
name="extra__color", ... or name="extra__size", ...
Here extra is a Jsonfield. Do you think it can be achieved?
Oct 05 2017 13:25


There isn't an easy, simple integration. That said, why do you need it? I think Amazon's RDS would probably be a much better fit. You can just use the builtin Posgres backend to connect.

If you genuinely need DynamoDB, then you're most likely way out of your depth because systems that need that kind of performance require very strong technical skills in which case a custom database backend wouldn't be too difficult for you to write.

Oct 05 2017 13:28
I am using DynamoDB for the noSQL nature (so that new fields can be added with no hussle in the future) and the performance, as I need real-time read performance. What I need to do is get a POST request through the DRF and save those data into the DB. The other feature is to fetch those data and send them to the frontend as a JSON object
Oct 05 2017 13:32
hello everyone...I am a beginner in both django and open source. does anyone know any django repository that i can contribute to for gsoc ?
Oct 05 2017 13:57

@gtseres There is django-nonrel that may be of interest, but I get why you want DynamoDB if you want essentially real time. You can makybe look at their code to see how they do it, and then tie it in with PynamodDB. There really is going to be no easy solution.

If you don't mind me asking, why do you need realtime? That's always hard to work around.

Also, you could probably mix PynamoDB with the builtin in ORM model of Django. Would be quite hacky, but you could offload some to DynamoDB and some to whatever database backend you need.

Also, be realtime, do you mean subsecond, or sub millisecond? A well configured Posgres or MariaDB instance is insanely fast. On top of that, you're going to find that datacentre location, and other network latency will probably be far more pronounced.

Oct 05 2017 15:48
@dfmeyer Subsecond realtime would be great. If I chose a RDBMS, I would need to be a bit hacky on saving new data, as the schema won't be something fixed. I was thinking of a solution where I would get the request data, do some basic validation, and then store them in DynamoDB using boto3. Except for the non-ORM interface, what other drawbacks would such a solution have?
Philip Eckert
Oct 05 2017 16:19
Really struggling to display a pretty dynamic nested model in a template. I'm thinking about just building the html in the view where I have more flexibility/access and then passing the custom html through context variables. Anybody done this? Am I being silly?
Daniel van Flymen
Oct 05 2017 23:56
@pae4557 can you elaborate?