Re: how to create formset field but not used loop in template

2013-03-04 Thread Witold Greń
It works! Thank you ;) W dniu piątek, 1 marca 2013 12:43:22 UTC+1 użytkownik Witold Greń napisał: > > When i create formset in template i must used loop "for": > > {{ formset_create_company.management_form }} > > {% for form in formset_create_company.forms %} > > > > > >

MYSQL DB

2013-03-04 Thread Nagarajan Dharmar Sitha
{% for d in datas %} Games Best Player :{{ d }} {% endfor %} I am taking d for displaying the value of the table but it showing the all the column values in single statement how to get sepa

I18N URL patterns and wsgi

2013-03-04 Thread Sebastian Wiesinger
Hello, I have a Django project (Django 1.4.5) at an URL like this: http://host/subdir/django-app This is implemented with apache + WSGI and is configured in the apache configuration: WSGIScriptAlias /subdir /some/path/to/django-app.wsgi Now I implemented I18N and tried it on the webserver. It

Re: I18N URL patterns and wsgi

2013-03-04 Thread Sebastian Wiesinger
My urls.py looks like this: from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf.urls.i18n import i18n_patterns import settings urlpatterns = i18n_patterns('', url(r'^request/?$', 'custrequest.views.request'),

Re: urls.py not loading changes

2013-03-04 Thread Venkatraman S
Always prefer to delete the .pyc fie for issues such as these wherein changes are not reflected despite server restart. On Sun, Mar 3, 2013 at 9:59 PM, Serge G. Spaolonzi wrote: > Maybe the server is loading an old .pyc file. try to delete the urls.pyc > file and restart the server. > > > On Sun,

Re: Benchmarking and timing DB transactions in Django

2013-03-04 Thread Venkatraman S
On Fri, Feb 22, 2013 at 4:48 PM, R R wrote: > > I was wondering if there are any tools to benchmark DB transactions using > the Django ORM. I'm using PostGreSQL with Django 1.4. I'm required to > compare and come up with the best possible database design for a project > which will have millions o

Re: error in filling data in dtabase through admin page..

2013-03-04 Thread Venkatraman S
On Fri, Mar 1, 2013 at 12:32 PM, Avnesh Shakya wrote: > hi, i have got one error during adding data in database though admin page, > actually it was working fine, but i made some attributes optional, now it's > generating error.. > i m adding m models.py ,plz help me.. > No one will have the pati

Re: Templates: best way to access object attributes described in a external list.

2013-03-04 Thread Bill Freeman
Are you saying that you need control over which of an item's attributes are shown and which are not and/or the order in which attributes are shown, or are you saying that the way python/django converts the attributes to strings does not meet your requirements, or both? Your approach can certainly

Re: urls.py not loading changes

2013-03-04 Thread frocco
That's good to know. On Monday, March 4, 2013 8:12:15 AM UTC-5, Venkatraman.S. wrote: > > Always prefer to delete the .pyc fie for issues such as these wherein > changes are not reflected despite server restart. > > On Sun, Mar 3, 2013 at 9:59 PM, Serge G. Spaolonzi > > > wrote: > >> Maybe the

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
Thanks for your input, I found this on google also. def get_all_logged_in_users(): # Query all non-expired sessions sessions = Session.objects.filter(expire_date__gte=datetime.now()) uid_list = [] # Build a list of user ids from that query for session in sessions: data

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Venkatraman S
If your website is massive, the following can cause latency issues(also hang!). Check what the SQL that gets generated using the django-debug-toolbar to get some more cues. On Mon, Mar 4, 2013 at 7:35 PM, frocco wrote: > Thanks for your input, I found this on google also. > > def get_all_logged_

Re: Getting only the models related to my queryset.

2013-03-04 Thread Tom Evans
On Fri, Mar 1, 2013 at 7:11 PM, Gabriel Koscky wrote: > Hi, I've been having some trouble with filtering the related models of a > queryset, > and I'm not sure if I'm approaching this wrong or if Django can't actually > do it. > > Basically I have some models with ManyToMany relationships, like: >

Django inline formsets, force initial data to be saved.

2013-03-04 Thread Marc Aymerich
Hi, I've spend several hours trying to figure out how to save inlines with initial data in them. basically I have a very simple model with 2 fields: class DirectIface(models.Model): parent = models.ForeignKey('nodes.Node') name = models.CharField(max_lenght=64) And what I'm doing is defi

Re: empty static_url

2013-03-04 Thread Tom Evans
On Sat, Mar 2, 2013 at 4:47 PM, Phil wrote: > Hi, > > I'm using django1.4.3 > > I have a django project with 3 apps. All 3 apps templates extend 'app.html'. > On 2 of my projects the CSS loads fine, but on third one the CSS doesn't get > loaded because it's not adding '/static/' to the url to the

Re: Django URLs with/without proxy server

2013-03-04 Thread Bill Freeman
I don't know then. If it were me, at this point I'd be single stepping through the resolver code with pdb (runserver), or if the problem doesn't happen under runserver, adding logging calls to the url resolver code to see what it's doing where and when. On Mon, Mar 4, 2013 at 1:28 AM, Barun Saha

Re: urls.py not loading changes

2013-03-04 Thread Bill Freeman
This should not be a .pyc problem, since upon startup python compares the modified time of the .pyc to that of the .py, if available. python will use the .pyc if it can't see the .py . I don't know what it will do if the .py is there, but it doesn't have permission to read it (possible permission

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
I plan on using this only on the admin side. On Monday, March 4, 2013 9:18:59 AM UTC-5, Venkatraman.S. wrote: > > If your website is massive, the following can cause latency issues(also > hang!). > Check what the SQL that gets generated using the django-debug-toolbar to > get some more cues. >

Re: Upgrade to django 1.5

2013-03-04 Thread Brad Pitcher
It should be safe, just test things out. Also, if you have DEBUG=False you must also include an ALLOWED_HOSTS array, which became required in Django 1.4.4: https://www.djangoproject.com/weblog/2013/feb/19/security/#s-issue-host-header-poisoning It should contain a list of domains used to access th

Re: urls.py not loading changes

2013-03-04 Thread Venkatraman S
Well, it so happens that when you ftp the file from your local box to a remote machine the timezones are mostly different. For eg. i am in India and we are 'ahead' of the US, so when i push my code to a server in US timezone, i see this problem most often. On Mon, Mar 4, 2013 at 8:26 PM, Bill Free

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Venkatraman S
Even then, its till a 'code'. You admin might not even load :) On Mon, Mar 4, 2013 at 8:33 PM, frocco wrote: > I plan on using this only on the admin side. > > On Monday, March 4, 2013 9:18:59 AM UTC-5, Venkatraman.S. wrote: >> >> If your website is massive, the following can cause latency issue

Re: Upgrade to django 1.5

2013-03-04 Thread Joey Espinosa
Also, if you haven't already, make sure your {% url %} template tags are properly quoted (unless they're variables). Django 1.5 no longer accepts named urls that are not quoted; they will be treated as variables if not quoted (and if they're not actually variables, then you'll get an error about ha

TemporaryFileUploadHandler leaving tempfiles behind on disk

2013-03-04 Thread msoulier
Hi, I'm using a ModelForm to upload a large file that ends up being written to a tempfile on disk. When I call form.save(), the file gets copied to the final filename, but the tempfile is left behind on disk. I am using a custom handler, which is a TemporaryFileUploadHandler subclass, but each me

Re: TemporaryFileUploadHandler leaving tempfiles behind on disk

2013-03-04 Thread Emiliano Dalla Verde Marcozzi
2013/3/4 msoulier > Hi, > > I'm using a ModelForm to upload a large file that ends up being > written to a tempfile on disk. When I call form.save(), the file gets > copied to the final filename, but the tempfile is left behind on disk. > > I am using a custom handler, which is a TemporaryFileUpl

Re: TemporaryFileUploadHandler leaving tempfiles behind on disk

2013-03-04 Thread Michael P. Soulier
On 04/03/13 Emiliano Dalla Verde Marcozzi said: > method from my own class that subclass TemporaryFileUploadHandler and do > something like: Yeah, I'm doing that, but it seems odd to me that the handler leaves the file around, when it's supposed to be temporary, no? Mike -- You received this m

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
ok, do you have a better idea on how I might do this? user is used to seeing this from a PHP site that I am porting. On Monday, March 4, 2013 11:04:41 AM UTC-5, Venkatraman.S. wrote: > > Even then, its till a 'code'. You admin might not even load :) > > On Mon, Mar 4, 2013 at 8:33 PM, frocco >wrot

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 1:02 PM, frocco wrote: > ok, do you have a better idea on how I might do this? > user is used to seeing this from a PHP site that I am porting. > I use this at the shell sometimes: from django.contrib.auth.models import User for user in User.objects.order_by('-last_login')

Re: urls.py not loading changes

2013-03-04 Thread Bill Freeman
Yes. So it is best to select transfer mechanisms that set the modified time of the .py file to the target machine's current time at the moment that the newly written copy is closed, rather than caring about the modified time on the source machine. Most mechanisms do this by default (cp, mercurial

How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread 7equivalents
Hello, my goal is to use a Django powered website to control the brightness of a light. I am using a JQuery slider bar as a dimmer switch. When the JQuery slider bar loads, I need it to iniciate to a value I have in my database. I already have my View, Model, and Template setup, and can pass va

Re: How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread Shawn Milochik
Probably consume the view with AJAX, doing a POST on the change event of the slider. http://api.jquery.com/category/ajax/ Put your result in a dictionary within your view and return it as JSON: return HttpResponse(json.dumps(result), mimetype="application/json") -- You received this message be

Re: How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread Gabriel
If I understood it right, I think it would be enough to serve the javascript with the initialization value hardcoded in it, right? Like using {{ }} tags. Is there a way to do this if there's a separate .js file? - Gabriel On Mon, Mar 4, 2013 at 1:41 PM, Shawn Milochik wrote: > Probably consume

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
So are you saying the best I can do is show users that logged in xx minutes ago, even through they may have logged off? Thank you On Monday, March 4, 2013 1:06:07 PM UTC-5, Shawn Milochik wrote: > > On Mon, Mar 4, 2013 at 1:02 PM, frocco > > wrote: > > ok, do you have a better idea on how I mi

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 2:05 PM, frocco wrote: > So are you saying the best I can do is show users that logged in xx minutes > ago, even through they may have logged off? Actually, yes. Because most users never log out. They just close their browsers. So even if you did look at the session data it

Re: How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread 7equivalents
Yes, Thankyou for helping me clean up my line of questioning, That is exactly what I want to know, can I use the {{ }} tags to do this, and can they be placed in a seperate .js file. On Monday, March 4, 2013 1:50:39 PM UTC-5, Gabriel wrote: > > If I understood it right, I think it would be enoug

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
Would this do the trick? SESSION_EXPIRE_AT_BROWSER_CLOSE = True I am still kinda new to django, about a month now. :) On Monday, March 4, 2013 2:11:50 PM UTC-5, Shawn Milochik wrote: > > On Mon, Mar 4, 2013 at 2:05 PM, frocco > > wrote: > > So are you saying the best I can do is show users th

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread Shawn Milochik
No, because that will just invalidate the cookie so that they'll have to log in again when they reopen their browser. It doesn't magically notify your Django app that the browser closed. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubs

Re: Is there a way to list users that have logged in within the pass 30 minutes

2013-03-04 Thread frocco
ok, thank you. I try the users logged in xx minutes ago code in stead of messing with the sessions. On Monday, March 4, 2013 3:10:19 PM UTC-5, Shawn Milochik wrote: > > No, because that will just invalidate the cookie so that they'll have to > log in again when they reopen their browser. > > It

I need to play a wav file

2013-03-04 Thread frocco
Hi, What is the django way to play a wav file? I only need to play it for a second or two. Thanks -- 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+

Re: I need to play a wav file

2013-03-04 Thread Shawn Milochik
This has nothing to do with Django. It's an HTML or maybe a JavaScript thing. Just do a Google search. Unless you're going to dynamically generate the WAV file and need help streaming it, I don't think list this is the best resource. -- You received this message because you are subscribed to the

Re: I need to play a wav file

2013-03-04 Thread frocco
ok, I was thinking it was a python code thing. On Monday, March 4, 2013 3:23:10 PM UTC-5, Shawn Milochik wrote: > > This has nothing to do with Django. It's an HTML or maybe a JavaScript > thing. Just do a Google search. > > Unless you're going to dynamically generate the WAV file and need help

Re: I need to play a wav file

2013-03-04 Thread Shawn Milochik
On Mon, Mar 4, 2013 at 3:35 PM, frocco wrote: > ok, I was thinking it was a python code thing. > No, you can't execute arbitrary Python code on the user's machine. People were playing wav files (hampster dance, anyone?) many years ago in HTML. http://www.w3schools.com/html/html_sounds.asp -- Y

Re: I need to play a wav file

2013-03-04 Thread Nikolas Stevenson-Molnar
Right. The Python code runs on your webserver, not the user's computer. So... you could probably play a sound your webserver, but that's not likely to do you much good ;) _Nik On 3/4/2013 12:37 PM, Shawn Milochik wrote: > On Mon, Mar 4, 2013 at 3:35 PM, frocco wrote: >> ok, I was thinking it was

Re: I need to play a wav file

2013-03-04 Thread frocco
Thanks for the link. On Monday, March 4, 2013 3:37:38 PM UTC-5, Shawn Milochik wrote: > > On Mon, Mar 4, 2013 at 3:35 PM, frocco > > wrote: > > ok, I was thinking it was a python code thing. > > > > No, you can't execute arbitrary Python code on the user's machine. > People were playing wav f

Re: I need to play a wav file

2013-03-04 Thread Nikolas Stevenson-Molnar
Ah, hampster dance... that was all the rage in middle school :) _Nik On 3/4/2013 12:37 PM, Shawn Milochik wrote: > hampster dance, anyone? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: Impossible? Django with NTLM SSO auth on windows?

2013-03-04 Thread Anton
@Branko, no...I didn't think about Kerberos, I only realised in the last day that Ad use this system which I don't know either) Do you know some tutorial/howto describing this SSO with Django/apache on windows? Or I am the only one on this planet with this ides? Thanks Anton Branko Majic w

Re: Impossible? Django with NTLM SSO auth on windows?

2013-03-04 Thread Avraham Serour
Hi, Does anyone think using ntlm instead of/on top of oauth/social logins. Ideally this could be given as another choice of login/authentication on top of oauth options, this would be a solution to the user not having to remember yet another password. does linux have anything like that? would thi

Re: How to pass a value from a Django View to a JQuery Slider bar.

2013-03-04 Thread Michael Pimmer
I usually keep a separate .js file in my templates where I set such javascript variables (preferrably as a hash or module). You can directly include it in the base.html template so you don't make 2 requests out of it. The main javascript functionality should definitely go to the static files tho

Re: Impossible? Django with NTLM SSO auth on windows?

2013-03-04 Thread Andre Terra
FYI, I found a nginx module for Kerberos authentication too: https://github.com/fintler/nginx-mod-auth-kerb http://michaelshadle.com/2010/01/17/spnego-for-nginx-a-start-at-least It hasn't been updated in quite some time, but it is apparenlty working and perhaps one of you will feel like taking a s

django DB optimization

2013-03-04 Thread Subodh Nijsure
Hi, I have implemented a django application that willl maintain schedule for 100s of people that work for a company. People access this schedule using desktop or mobile device to lookup their task list for current day, this week etc. Now the question is how do I scale this -- example when user jo

Re: django DB optimization

2013-03-04 Thread Shawn Milochik
Rule #1: Measure first. Don't add any complexity to fix any bottlenecks until you know for a fact where they are. Once you know where one is, the solution will probably be fairly obvious. Caching, denormalization, etc. Come up with a way to stress-test your app and add measurements. -- You rece

Re: Benchmarking and timing DB transactions in Django

2013-03-04 Thread Mike Dewhirst
There are a few interesting pages if you google 'scaling django' and here is one those ... https://speakerdeck.com/jacobian/django-doesnt-scale Mike On 5/03/2013 12:29am, Venkatraman S wrote: On Fri, Feb 22, 2013 at 4:48 PM, R R mailto:r01123581...@gmail.com>> wrote: I was wondering i

New to Django & Programming - Trying to work with the tutorial. How to edit mysite/settings.py

2013-03-04 Thread Ugorji Nnanna
Hello, I'm new to Django and programming. I'm going through the tutorial here: https://docs.djangoproject.com/en/1.5/intro/tutorial01/ to start learning. I'm at the Database setup part and it says: Now, edit mysite/settings.py. I'm at a loss how exactly to do this. What command exactly do I ent

Re: New to Django & Programming - Trying to work with the tutorial. How to edit mysite/settings.py

2013-03-04 Thread Oladipupo Elegbede
On 3/5/13, Ugorji Nnanna wrote: > Hello, I'm new to Django and programming. I'm going through the tutorial > here: https://docs.djangoproject.com/en/1.5/intro/tutorial01/ to start > learning. I'm at the Database setup part and it says: Now, edit > mysite/settings.py. I'm at a loss how exactly to d

Re: New to Django & Programming - Trying to work with the tutorial. How to edit mysite/settings.py

2013-03-04 Thread Gabriel
In case you have no previous experience with Python, I would seriously recommend you follow Zed Shaw's Learn Python the Hard Way ( http://learnpythonthehardway.org/) Don't let the title scare you off, it's actually a great book for programming beginners. It's free online, or if you're willing to p

Django Simple Captcha - Manually displaying the Captcha field in a template

2013-03-04 Thread mmuk2
Hi, I'm currently trying to implement django simple captcha on my form. It's quite straight forward to set up with the "out of the box" django form functionality - just add a captcha field to the form in forms.py, and in the template, use the built in django form template like this: {% form.as

Re: Django inline formsets, force initial data to be saved.

2013-03-04 Thread Russell Keith-Magee
On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich wrote: > Hi, > I've spend several hours trying to figure out how to save inlines with > initial data in them. > > basically I have a very simple model with 2 fields: > > class DirectIface(models.Model): > parent = models.ForeignKey('nodes.Node')

Re: New to Django & Programming - Trying to work with the tutorial. How to edit mysite/settings.py

2013-03-04 Thread Nikolas Stevenson-Molnar
You need a text editor. Source code is plain text, so something like Notepad will work. But in practice, you'll want a source code editor. There are many out there, some free some paid. My personal favorites are Notepad++ (http://notepad-plus-plus.org/) on Windows and TextWrangler (http://www.bareb

Django 1.4.3 contact_form

2013-03-04 Thread Ana Molf
I can¡t solve the follow error def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): asunto = form.cleaned_data['asunto'] recado = form.cleaned_data['recado'] email = form.cleaned_data['email']

Re: Django 1.4.3 contact_form

2013-03-04 Thread Mike Dewhirst
On 5/03/2013 2:05pm, Ana Molf wrote: I can﹀ solve the follow error The error message says you have an indentation error. That means you need to make sure to have exactly the same quantity of indentation each time the source code gets indented. In practice, most people use four spaces and ne

Re: Django 1.4.3 contact_form

2013-03-04 Thread william ratcliff
Check the indentation of the clause I mark with * Also, do you use tabs? def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): asunto = form.cleaned_data['asunto'] recado = form.cleaned_data['recad