Re: Facing performance issue bcoz of db data

2017-01-04 Thread Anjali Pradeep
Vijay, Thanks for the response. I will be executing multiple queries in a nested form based on one particular criteria to form a final dictionary with a set of field values from different db table as keys and values pairs. Best Regards, Anjali On Wed, Jan 4, 2017 at 6:35 PM, Vijay Khemlani

using django with multiple apps

2017-01-04 Thread bng0802
Can anyone point to me in the right direction regarding how to use Django with Multiple apps. I am trying to build website that can work seamlessly that would direct from one view to the other based on some logic. Obviously, I have both o2m (one to many) and m2m (many to many) relationships.

Re: browser testing

2017-01-04 Thread Mike Dewhirst
Thanks Alex M On 5/01/2017 11:40 AM, Alex Heyden wrote: Everyone who wants into that space compares themselves to Selenium, because Selenium is that good and has that much market share. It's obnoxious to use, excludes some less technical users, but behaves very predictably in skilled hands

Re: browser testing

2017-01-04 Thread Alex Heyden
Everyone who wants into that space compares themselves to Selenium, because Selenium is that good and has that much market share. It's obnoxious to use, excludes some less technical users, but behaves very predictably in skilled hands and has plenty of community support. If I needed to include

browser testing

2017-01-04 Thread Mike Dewhirst
Does anyone have any recommendations for testing via the browser? I have heard Selenium mentioned and saw a feature contrast between Selenium and Imacro which indicated Imacro is the best choice. Before I do the right thing and dig into it myself, are there any war stories or testimonials out

Re: good pratices to write many lines on database

2017-01-04 Thread Avraham Serour
can you elaborate on this scenario? how and why can your database shutdown? I second the suggestion about returning error and telling the client to try later, but it should be >=500 not 400. 4xx Are for client errors, 5xx are for server errors. see

Override save method to add list in the many to many field

2017-01-04 Thread Robin Lery
I have this model to save post from the users: class Tag(models.Model): name = models.CharField(max_length=255, unique=True) def add_tags(obj_id, body): object = Post.objects.get(id=obj_id) tag_list = [Tag.objects.create(name=word) for word in body.split()] for tag in tag_list:

Re: Filter a contenttype with the content object's field

2017-01-04 Thread Robin Lery
Yes, this works. Thank you. But, as there are or will be more than one ContentType objects (i.e., Post model and Photo model), how do I iterate over it? Should I query them separately? Like post_activities = Activity.objects.filter(post__tags__in=tags).distinct() photos_activities =

Re: request.read() is empty in POST

2017-01-04 Thread Michal Petrucha
On Fri, Dec 30, 2016 at 01:50:51PM -0800, Flávio Cardoso wrote: > Hello! I'm getting crazy, PLEASE someone, give me some light!!! > > I'm using Django 1.10.4, Python 3.5 on Windows using Visual Studio > Community 2015. > > I have some class-based views to response some json. > > from

Re: good pratices to write many lines on database

2017-01-04 Thread Vinicius Assef
Or you could return a http status 400 if the transaction couldn't be committed. So, the client should re-run the request later. If this is not an option, you should lay upon a queue as you suggested. Bad things always can happen. So, try your best to avoid i/o problems if your clients cannot

Dynamic Models

2017-01-04 Thread Guilherme Leal
Is there a way to populate Django model cache on the fly? I was thinking about saving the model definition on some backend (database for instance) and loading as needed. This way we can basically build a custom admin interface for the model definitions, and load the models (through "type()" or

RE: request.read() is empty in POST

2017-01-04 Thread Matthew Pava
I have never used request.read() or tried decoding the request, and I had no idea that request even had an encoding attribute. You stated that you had the exact same code working elsewhere. Is there some difference in the settings file? Some difference in the environment you are using? When

Re: request.read() is empty in POST

2017-01-04 Thread Avraham Serour
aand you are angry. So we can start yet another flame war, if that's the case I'll reply to each of your points. If you still want help you may reply to the first reply of this thread, which was trying to help but was ignored. I'm also willing to call you and help for at least 20min, just send

Re: request.read() is empty in POST

2017-01-04 Thread ludovic coues
Have you tried reading request.body ? You can use `print(repr(request.body))` to check the value of request.body. It should give you more information. I hope that help you 2017-01-04 21:06 GMT+01:00 Flávio Cardoso : > Childish? Ok, so I'm stuck, my project is stopped,

Re: request.read() is empty in POST

2017-01-04 Thread Flávio Cardoso
Childish? Ok, so I'm stuck, my project is stopped, nobody, no one, even YOU, can give me a hand. I spent days researching and debugging trying to solve the problem. I've been waiting for days for anything and nothing, nobody, including YOU told nothing to help me. If the platform - AND THE

[ANNOUNCE] Django bugfix release: 1.10.5

2017-01-04 Thread Tim Graham
Details are available on the Django project weblog: https://www.djangoproject.com/weblog/2017/jan/04/bugfix-release/ -- 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

Re: How to handle file upload

2017-01-04 Thread Magnus Brattlöf
Hi! I found this tutorial pretty helpful: https://simpleisbetterthancomplex.com/tutorial/2016/08/01/how-to-upload-files-with-django.html Den onsdag 4 januari 2017 kl. 13:47:40 UTC+1 skrev JJEMBA KENNETH: > > Hey guys can any one help with the right way to handle file upload in > django. Am new

good pratices to write many lines on database

2017-01-04 Thread Bruno Barbosa
Hello everybody! I have an application that receives about 1000 POST requests per second. On each request I writte a line on my database table. On this scenario my database can shutdown during execution. Is it a good pratice to store these data on array in cache (redis) and on each minute

Re: How to send user specific data on Group().send() on Channels?

2017-01-04 Thread Andrew Godwin
On Wed, Jan 4, 2017 at 3:22 AM, Utku Gültopu wrote: > It is for sending fresh data to users. Let's say user A follows users B, C > and D. However, only users A, B and C are online. Then only B's and C's > data should be sent to user A. Because user D's data would be stale. >

Re: How to handle file upload

2017-01-04 Thread C. Kirby
https://docs.djangoproject.com/en/1.10/topics/http/file-uploads/ On Wednesday, January 4, 2017 at 2:47:40 PM UTC+2, JJEMBA KENNETH wrote: > > Hey guys can any one help with the right way to handle file upload in > django. Am new to the framework. > > -- > Jjemba kenneth > -- You received this

Re: Deployment/NameError Problem

2017-01-04 Thread Antonis Christofides
The error occurs in line 68 of admin.py. The admin.py you're showing doesn't seem to have 68 lines. Maybe the admin.py you have in development is not the same you have in production. Or the admin.py the system's reading is not the one you think it is (maybe it's reading it from another directory).

Migration issue on Webfaction

2017-01-04 Thread Richard Jackson
Hi there - I'm incredibly inexperienced and using a Mezzanine-powered site, but this should still be an issue with my lack of Django understanding: My site is currently down ("Internal Server Error") due to mishandled migrations. When I try to deploy the code

Deployment/NameError Problem

2017-01-04 Thread Richard Jackson
Hi there I've been having some issues with my Mezzanine-powered site and have solved all issues locally (including a fresh migration covering all additional models). However, when I try to deploy the site to the server (WebFaction) I'm given a NameError: [81.95.157.172] out: File

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
> Because attempting to interpret the string '17/06/2017' as a date is risky and will lead to trouble sooner or later, regardless the backend. This is a valid point, but I believe this is related to sqlite behaviour not the ORM using it. mysql for example has its own bugs, there was one about

Re: request.read() is empty in POST

2017-01-04 Thread Avraham Serour
That's an incredibly childish response and I hope future people trying to learn python or django don't give up upon a roadblock, any future people reading this don't ever feel that you are helpless, the community has many resources to help including this mailing list. Sometimes it is difficult to

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread jorrit787
I use SQLite locally for development and Postgres in production. So when my migration runs fine locally I expect it to also work fine when I upload it 5 minutes later and try to apply it to my Postgres database. On Wednesday, January 4, 2017 at 3:59:52 PM UTC+1, Avraham Serour wrote: > > well

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Antonis Christofides
> if one is using sqlite why enforce stricter rules than the backend I'm using > just because one other backend has a problem with it? Because attempting to interpret the string '17/06/2017' as a date is risky and will lead to trouble sooner or later, regardless the backend. Antonis Christofides

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
well the ORM does abstract the different API's for each backend, you may give an datetime object and it will take care to format to the appropriate thing the backend needs. you are right that it does not check the type of the value passed, it is a valid point that the library should check the

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Antonis Christofides
Instead of default='17/06/2017', you should write default=datetime(2017, 6, 17). The bug in Django (if it is a bug, and I think it is) is that it does not require you to do so. There's probably a reason for it, but I don't really know.. Regards, Antonis Antonis Christofides

Re: request.read() is empty in POST

2017-01-04 Thread Flávio Cardoso
I work with ASP.Net since version 1.1. I've never been with a stuck project. I'm trying to directly read the request because it is application/json, so Django doesn't delivery the data via request.GET nor .POST. And I got an exception on request.body: raise RawPostDataException("You cannot

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread jorrit787
I thought the whole point of an ORM was to abstract away differences between backends... That's why this seems like a bug to me. On Wednesday, January 4, 2017 at 1:02:07 PM UTC+1, Avraham Serour wrote: > > Well this is the reality right now, if you think the framework is acting > wrong you may

Re: Facing performance issue bcoz of db data

2017-01-04 Thread Vijay Khemlani
A poorly optimized query or a query that returns too many results (too many as un hundrends of thousands), but it doesn't make sense to execute a query that large in a request / response cycle. Or too many subsequent queries after the original one Without more information it's kinda hard to tell

Re: Filter a contenttype with the content object's field

2017-01-04 Thread Michel Rodrigues
Sorry, the point is a list of tags as argument, you can do this: >>> Activity.objects.filter(tags_act__tags__name__in=['tag1','tag3']).distinct() , , ]> Without .distinct() django return duplicated objects: >>> Activity.objects.filter(tags_act__tags__name__in=['tag1','tag3']) , , , ]> --

Re: Filter a contenttype with the content object's field

2017-01-04 Thread Michel Rodrigues
Sorry, the point is a list of tags as argument, you can do this: >>> Activity.objects.filter(tags_act__tags__name__in=['tag1','tag3']) , , , ]> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

How to handle file upload

2017-01-04 Thread JJEMBA KENNETH
Hey guys can any one help with the right way to handle file upload in django. Am new to the framework. -- Jjemba kenneth -- 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

Re: Filter a contenttype with the content object's field

2017-01-04 Thread Michel Rodrigues
You may try add a related_query_name in the field activity: activity = GenericRelation(Activity, related_query_name="post_tags") https://docs.djangoproject.com/en/1.10/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericRelation.related_query_name I make a test: 'michel' has a

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
Well this is the reality right now, if you think the framework is acting wrong you may file a bug report. In my opinion the wrong side of the equation is you, the framework is just passing the value you assigned, the ORM tries to make a consistent API between backends but I wouldn't really expect

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread jorrit787
The fact that some backends are more forgiving is exactly my point. Maybe the migrations engine should always force a datetime object (or at least a -MM-DD notation) to make it work consistently on all backends. On Wednesday, January 4, 2017 at 11:35:38 AM UTC+1, Avraham Serour wrote: > >

Re: Query on AppRegistryNotReady: Apps aren't loaded yet error

2017-01-04 Thread Nilesh
Really, I did not face this issue in past. It may be some setup issue. Some app is not registered properly. Check admin.py or settings.py On Wed, Jan 4, 2017 at 3:18 PM, pritesh modi wrote: > Team > > > In VM Django with 1.6 run below code and generate a HTMLreport

Re: How to send user specific data on Group().send() on Channels?

2017-01-04 Thread Utku Gültopu
It is for sending fresh data to users. Let's say user A follows users B, C and D. However, only users A, B and C are online. Then only B's and C's data should be sent to user A. Because user D's data would be stale. I thought of holding online users in a table of two columns, one column is a

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
DateField is a representation of datetime.date, so you should assign a date object and not a string, sqlite is more forgiving and doesn't complain so much in many cases On Wed, Jan 4, 2017 at 12:13 AM, wrote: > This field: > > activity_date = models.DateField('Datum',

Re: How to send user specific data on Group().send() on Channels?

2017-01-04 Thread Utku Gültopu
It is for sending fresh data to users. Let's say user A follows users B, C and D. However, only users A, B and C are online. Then only B's and C's data should be sent to user A. Because user D's data would be stale. I thought of holding online users in a table of two columns, one column is a

Re: How to send user specific data on Group().send() on Channels?

2017-01-04 Thread Utku Gültopu
It is for sending fresh data to users. Let's say user A follows users B, C and D. However, only users A, B and C are online. Then only B's and C's data should be sent to user A. Because user D's data would be stale. I thought of holding online users in a table of two columns, one column is a

Facing performance issue bcoz of db data

2017-01-04 Thread anjalimk68
In local host, for a particular query data(which is very huge) is coming up but for the same query in apache it is taking too much of time like 1 hr or more. I tried using caching of a page , even for that also Django works per user request ie for the first time for every user it will take much