Re: Inserting literal % sign in QuerySet.extra()

2015-03-27 Thread Tim Graham
This is fixed in Django 1.8. See the fifth item in https://docs.djangoproject.com/en/dev/releases/1.8/#models. On Friday, March 27, 2015 at 5:38:15 PM UTC-4, Gergely Polonkai wrote: > > Hello, > > I’d like to execute the following code: > > Booking.objects.filter(start_ts__isnull = False,

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Gabriel Pugliese
Thanks for kind answers guys. Best Regards On Fri, Mar 27, 2015, 5:31 PM Simon Charette wrote: > Hi Gabriel, > > One thing I dislike about how PHP/Rail deal with this is the fact they > expose an easy way to shoot yourself in the foot. > > e.g. PHP > > Your code expects

Inserting literal % sign in QuerySet.extra()

2015-03-27 Thread Gergely Polonkai
Hello, I’d like to execute the following code: Booking.objects.filter(start_ts__isnull = False, end_ts__isnull = False).extra(select = {'amount': "strftime('%s', end_ts) - strftime('%s', start_ts)"}) However, in the shell, I get the following error: Traceback (most recent call last): File "",

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Simon Charette
Hi Gabriel, One thing I dislike about how PHP/Rail deal with this is the fact they expose an easy way to shoot yourself in the foot. e.g. PHP Your code expects $_GET['foo'] to be an array() but the querystring is missing the trailing "[]" (?foo=bar) and crash. This also open a door for

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Carl Meyer
Hi Gabriel, On 03/27/2015 02:10 PM, Gabriel Pugliese wrote: > I perfectly understand what you are saying. It was very clear and > informative, but do not agree with the design chosen here. Below is just > an opinion and you do not have to agree with it: That's good :-) I probably won't continue

Re: Django TCP socket communication

2015-03-27 Thread Bill Freeman
There is a sense in which what you are describing, for the Django side, is what a webserver, including one involving Django, ordinarily does. The only requirement the web server makes (and some can get around it with work) is that the data sent over the socket, at least from the client

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Gabriel Pugliese
Hi Carl, I perfectly understand what you are saying. It was very clear and informative, but do not agree with the design chosen here. Below is just an opinion and you do not have to agree with it: My buddies have given PHP and Rails examples, but there are other frameworks from other

Manage.py not found when deploying using chef (application_python cookbook)

2015-03-27 Thread Paul
I'm trying to deploy a django application on ec2 using chef. I followed blogs that got me to the point where the application(_python) cookbook has setup a clone of the repo to shared-copy and the chef client invokes the first command to syncdb. Then however a problem occurs that is easy to

Re: Django TCP Socket Communication

2015-03-27 Thread François Schiettecatte
Have you looked at the ‘socket’ python library ? François > On Mar 27, 2015, at 3:05 PM, bobdxcool wrote: > > I am new to TCP socket programming. I have a django based server > communicating with a microcontroller. Now, I want to implement TCP based > socket on the server

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Carl Meyer
Hi Gabriel, On 03/27/2015 01:34 PM, Gabriel Pugliese wrote: > @Masklinn > That input is from jQuery's default serializer. It sends the data with > contentType 'application/x-www-form-urlencoded; charset=UTF-8'. I just > need to pass a data parameter with my JS Object (JSON) and it does the >

Django TCP Socket Communication

2015-03-27 Thread bobdxcool
I am new to TCP socket programming. I have a django based server communicating with a microcontroller. Now, I want to implement TCP based socket on the server side in order to communicate with the TCP socket on the microcontroller. Can anyone give me an idea on how to do this ? What libraries

Re: QueryDict and its .dict() method - why does it do that?

2015-03-27 Thread Gabriel Pugliese
@Daniel, oh really that Rails is not Django? Haven't noticed on my years of Python web development. Thanks! @Masklinn That input is from jQuery's default serializer. It sends the data with contentType 'application/x-www-form-urlencoded; charset=UTF-8'. I just need to pass a data parameter with

Django TCP socket communication

2015-03-27 Thread Bobby
I am new to TCP socket programming. I have a django based server communicating with a microcontroller. Now, I want to implement TCP based socket on the server side in order to communicate with the TCP socket on the microcontroller. Can anyone give me an idea on how to do this ? What libraries

Re: Global access to request.user

2015-03-27 Thread Stephen J. Butler
On Fri, Mar 27, 2015 at 10:30 AM, Thomas Güttler wrote: > You have an instance method to render one row of a search result (a custom > paginator). > > One column of this row displays a link. Some users are allowed to follow the > link, > some are not. You need to check the (row

Re: Textarea taking htnml tags

2015-03-27 Thread aRkadeFR
Hey, He doubled post. A thread already exists about this called: "textarea showing image instead of code" On 03/27/2015 03:54 PM, Filipe Ximenes wrote: Can you send us the code of the view and the template of this form? On Fri, Mar 27, 2015 at 3:27 AM,

Re: Global access to request.user

2015-03-27 Thread Cal Leeming
Hmm this all sounds quite dirty :/ However if you absolutely want to have a global object, you could try something like [1], although I don't recommend it at all. There are some situations where your modelling needs request introspection, for example row level auditing, but these are very

Re: Global access to request.user

2015-03-27 Thread Thomas Güttler
Am 27.03.2015 um 15:49 schrieb Cal Leeming: There is a reason that state is passed around from method to method, rather than being stored as a global, because this is the correct way to do things. Is a threadlocal global state part of the correct way, or is it "evil"? However, it sounds

Re: Performance of file-based sessions vs database-backed sessions

2015-03-27 Thread Filipe Ximenes
>From what I understand, using file based sessions will work with no problems in production environment. But, you will have a problem in case you need to horizontally scale (have multiple machines serving your app) your system. In this situation, since files from one machine wont be able to access

Re: Textarea taking htnml tags

2015-03-27 Thread Gabriel - Iulian Dumbrava
Have you checked if the html tags actually end up in the database? If yes, then the problem is either in the view or in the template (like not using the safe filter). vineri, 27 martie 2015, 08:27:15 UTC+2, akash...@ranosys.com a scris: > > Hie to all, > In one of my template i am using text

Performance of file-based sessions vs database-backed sessions

2015-03-27 Thread David Riddle
I am using Django 1.7, and I have read the documentation on the SESSION_ENGINE setting. It is not clear to me what are the advantages and disadvantages of using file-based sessions. Do file-based sessions have better or worse performance than database-backed sessions? Are file-based sessions

Re: Search user from Database

2015-03-27 Thread Filipe Ximenes
Just checking: when you say you are adding users using Group.users.add(user) ​ in this case `Group` is an instance of the Group model and NOT the actual model, correct? if so, you can make a query using the same instance, looking for the user: user = Group.user.filter(user).first() if user:

Re: Textarea taking htnml tags

2015-03-27 Thread Filipe Ximenes
Can you send us the code of the view and the template of this form? On Fri, Mar 27, 2015 at 3:27 AM, wrote: > Hie to all, > In one of my template i am using text area. The issue is that when i write > html tags with some image link using img tag, when i am saving this i

Re: Global access to request.user

2015-03-27 Thread Cal Leeming
There is a reason that state is passed around from method to method, rather than being stored as a global, because this is the correct way to do things. However, it sounds like the architectural design of your code is flawed, as throwing around the request object indicates that you don't have

Strange deployment problem

2015-03-27 Thread Miloš Kozák
Hi, I have rather strange problem with already deployed application. I added some new ACL rules which I need to write to the database, so I wanted to call syncdb --all. However, using the command: ./manage.py syncdb or ./manage.py syncdb --settings=intranet.settings.demo I get this:

Re: Global access to request.user

2015-03-27 Thread Anderson Resende
Other way is use sessions! Django provide session midleware. You can get the session dict out of the view! Sorry my english, I am a Brazilian guy! > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

Re: Global access to request.user

2015-03-27 Thread Anderson Resende
Maybe a global state? Yes! https://docs.djangoproject.com/en/1.7/topics/http/middleware/#init I never did that, but you can try! -- 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

Adding admin access for external users

2015-03-27 Thread Murthy Sandeep
Hi I am setting up an admin user account to manage my Django app on my local machine, but would it be possible for me to also give admin access to external users using their own machines? My machine is not part of a LAN/WAN, just standalone, but I am thinking that to enable this I should provide

Problem at server startup

2015-03-27 Thread Sebastian Andres Guerra Montecino
Hi everyone, i'm just started on django... and i have a problem :(. I install django on windows (with Setuptools and PIP, according to the documentation), create a new project, use migrate but throws me a mistake: C:\Users\Kompressor\Documents\lalolando>python manage.py runserver 8080

Re: textarea showing image instead of code

2015-03-27 Thread aRkadeFR
What is db.TextProperty!? Is it Django? Where the "result" variable comes from? please read: https://docs.djangoproject.com/en/1.7/ref/models/ On 03/27/2015 10:20 AM, Akash Patni wrote: Hi This is my html {% block content %} src="/site_media/images/digital-assets-note-icon.png"

Re: Global access to request.user

2015-03-27 Thread Daniel França
I don't understand how middlware or filter would help on those cases. Why not only pass the variable where it's needed? On Fri 27 Mar 2015 at 10:18 guettli wrote: > > > Am Donnerstag, 26. März 2015 15:52:07 UTC+1 schrieb Anderson Resende: >> >> You can use middlewares!!! It is

Re: Django project for multiple clients

2015-03-27 Thread Gabriel - Iulian Dumbrava
If your clients are using different subdomains, like client1.webapp.com, client2.webapp.com then you can have separate settings file per subdomain and completely isolate the client data, but still use the same virtualenv and codebase. You must also take care of the file upload/access because

Re: textarea showing image instead of code

2015-03-27 Thread Akash Patni
Hi This is my html {% block content %} View Notes See your notes details. {% for i in result %} Note Title {{i.note_title}} Note *{{i.note}* Beneficiaries {% if all_nominees %} {% for nominee in all_nominees %}

Re: Global access to request.user

2015-03-27 Thread guettli
Am Donnerstag, 26. März 2015 15:52:07 UTC+1 schrieb Anderson Resende: > > You can use middlewares!!! It is a way... > > > I don't understand how middleware can help here. The only way I see is that the middleware updates a global variable for the data. In my case request.user. Anderson, is

Re: When I mark to delete the formset, django requires complete all fields, he does not ignore the marked form to delete.

2015-03-27 Thread aRkadeFR
Thanks for the code paste. You mean in your views, the formset.is_valid() returns False and so does not delete your form tagged to delete? I don't quite understand where exactly is the problem? On 03/27/2015 12:17 AM, Neto wrote: When I mark to delete the formset, django requires complete all

Re: textarea showing image instead of code

2015-03-27 Thread aRkadeFR
Hello, You could provide us more information when asking for help please. Your template and view code at least. I guess your problem is in your HTML but to be sure, please dump your information at the POST request to see what is send. Then review your template. Maybe there's a "name" attribute

Re: Global access to request.user

2015-03-27 Thread aRkadeFR
I agree with Anderson, this is one solution, even though I don't know if it's a good way. For example a middleware is used to add the user to the request. You could do the same with the request to a singleton instance and get it back then from your form, view etc.? But be aware that some

textarea showing image instead of code

2015-03-27 Thread akash . patni
Hie to all, In one of my template i am using text area. The issue is that when i write html tags with some image link using img tag, when i am saving this i am getting image on the desription field. Actual-Image is comming Expected-I want HTML code to be displayed in the discription. Please

Textarea taking htnml tags

2015-03-27 Thread akash . patni
Hie to all, In one of my template i am using text area. The issue is that when i write html tags with some image link using img tag, when i am saving this i am getting image on the desription field. Actual-Image is comming Expected-I want HTML code to be displayed in the discription. Please