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 %}
>
> 
>
> 
>
> 
>
> {{ form.postal_code.label }}
>
> {{ form.postal_code }}
>
> 
>
> 
>
> {{ form.city.label }}
>
> {{ form.city }}
>
> 
>
> 
>
>
>
> {{ form.street.label }}
>
> {{ form.street }}
>
> 
>
> 
>
> 
>
> {{ form.no_house.label }}
>
> {{ form.no_house }}
>
> 
>
> 
>
> {{ form.no_local.label }}
>
> {{ form.no_local }}
>
> 
>
> 
>
> 
>
> {% endfor %}
>
>
> OR
>
>
> {{ formset_create_company.management_form }}
>
> {% for field in formset_create_company %}
>
> 
>
> {{ field.errors }}
>
> {{ field.label_tag }}: {{ field }}
>
> 
>
> {% endfor %}
>
>
> How to create field but not used loop "for"? eg. {{ 
> formset_create_company.form.no_house }}??
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 separate column value.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 changed the URLs 
to:

http://host//subdir/django-app

Which of course does not work. I expected it to do something like:

http://host/subdir//django-app

Am I doing something wrong? I can't find out how to change that behaviour.

Regards

Sebastian

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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'),
url(r'^request/(?P\d+)$', 'custrequest.views.request'),
)

urlpatterns += patterns('',
url(r'^utils.js$', 'custrequest.views.utilsjs'),
url(r'^request.css$', 'custrequest.views.requestcss'),
)

urlpatterns += patterns('',
url(r'^captcha/', include('captcha.urls')),
)

if settings.DEBUG:
urlpatterns += patterns('',
(r'^500/$', 'django.views.defaults.server_error'),
(r'^404/$', 'django.views.generic.simple.direct_to_template', 
{'template': '404.html'}),
)


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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, Mar 3, 2013 at 11:16 AM, Asier Hernández Juanes <
> asiertxo...@gmail.com> wrote:
>
>> Hi everyone,
>>
>> i have a remote Linux server with a Django application running in a nginx
>> server but when I make a change in urls.py like adding a new urlpattern the
>> server is not applying the changes. I have restarted nginx server but the
>> new url is not loading.
>>
>> Does anyone know what may be the problem?
>>
>> Thanks a lot!
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Serge G. Spaolonzi
> Cobalys Systems
> http://www.cobalys.com
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 of records when it's deployed.
>
> I'd love to hear your workflow or suggestions. Also I haven't seen many
> articles that focus on developing high-performance webapps in Django. May
> be it's the problem with me. so if you know of any good articles which
> would help me, kindly share it too.
>
>
Well, data modelling is independent of all this - right? :)

I mean, benchmarking should not drive database design; and if it does, then
there is a VERY HIGH probability that you are not doing things right. IF
your models are right, then the problems would be in the way you are
constructing the query and django-debug-toolbar is a life-saver here.

Regards,
Venkat

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 patience to look into your code and debug stuff for
you unless you shortlist the possible errors. Well, technically someone
will, provide you pay them :)

Anywayz, if you are unsure what you did, drop the database and recreate it.

-Venkat

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 handle both, provided those who will be
maintaining it will have no trouble understanding it.

Rather than  a template filter, I would probably opt for a model method,
producing a list of strings over which the inner "for" could iterate.  Such
a method has access to all aspects of, so it could behave differently
depending on class, allowing for mixed lists, if you prefer.

Bill

On Sun, Mar 3, 2013 at 9:03 AM, Serge G. Spaolonzi wrote:

> I am looking for best way to access object attributes described in a
> external list.
> The user case is to display a list of objects for different classes
> showing only some attributes, every list will contain only objects of the
> same kind, all the functionality repeats except the attributes to be
> displayed that vary according to the list.
> In the view I have a factory that retrieves the different
> objects transparently.
>
> The two solutions I have now are:
>
> 1) Iterate through attributes:
>
> items: is a list of items of the same kind
> item_display_field: is a list of field to be displayed
> getattribute: is a custom filter
>
> {% for item in items %}
>> {% for field in item_display_field %}
>> {{ item | getattribute:field }}
>> {% endfor  %}
>> 
>> {% endfor  %}
>
>
> 2) Faster but less DRY is to keep the view factory but specify different
> templates according the class, I will have to repeat the code but win
> the processor time used to iterate through attributes.
>
> Is there a better way to do it in Django templates?
>
> Thanks
>
> --
> Serge G. Spaolonzi
> Cobalys Systems
> http://www.cobalys.com
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 server is loading an old .pyc file. try to delete the urls.pyc 
>> file and restart the server. 
>>
>>
>> On Sun, Mar 3, 2013 at 11:16 AM, Asier Hernández Juanes <
>> asier...@gmail.com > wrote:
>>
>>> Hi everyone,
>>>
>>> i have a remote Linux server with a Django application running in a 
>>> nginx server but when I make a change in urls.py like adding a new 
>>> urlpattern the server is not applying the changes. I have restarted nginx 
>>> server but the new url is not loading.
>>>
>>> Does anyone know what may be the problem?
>>>
>>> Thanks a lot! 
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>
>>
>> -- 
>> Serge G. Spaolonzi
>> Cobalys Systems
>> http://www.cobalys.com
>>  
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 = session.get_decoded()
uid_list.append(data.get('_auth_user_id', None))

# Query all logged in users based on id list
return User.objects.filter(id__in=uid_list)


On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote:
>
> I want to list users currently on our site.
> Would I use the last login date time?
>
> If so, what should the query look like?
>
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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_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 = session.get_decoded()
> uid_list.append(data.get('_auth_user_id', None))
>
> # Query all logged in users based on id list
> return User.objects.filter(id__in=uid_list)
>
>
> On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote:
>>
>> I want to list users currently on our site.
>> Would I use the last login date time?
>>
>> If so, what should the query look like?
>>
>> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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:
>
> class User(models.Model):
> name = models.CharField()
>
> class Product(models.Model):
> name = models.CharField()
>
> class Order(models.Model):
> user = models.ForeignKey(User)
>
> status = models.CharField()
>
> products = models.ManyToManyField(Product, through='OrderProduct')
>
> class OrderProduct(models.Model):
> product = models.ForeignKey(Product)
> order = models.ForeignKey(Order)
> amount = models.IntegerField()
>
>
> And I want to get all the products bought by User1, so I'd do something like
>
> Product.objects.filter(order__status='completed', order__user=User1)
>
> Which then returns just Product1, but now I want the amount the user bought,
>
> but it seems wrong to make another query like:
>
> Product1.orderproduct_set.filter(order__user=User1)
>
> And hit the database again to get data my first query can already bring
> me...
>
>
> So what I want to know is, based on a queryset that filters by related
> models,
>
> is there a way to get just the actual related models of my result?
>
>
> Thanks,
>
> Gabriel
>

Hi Gabriel

Read about select_related() and start from the appropriate point:

https://docs.djangoproject.com/en/1.4/ref/models/querysets/#select-related

Eg, this will result in only one query:

  qs = OrderProduct.objects.filter(order__user=user).select_related('product')
  for op in qs:
print u'%d x %s' % (op.amount, op.product.name)

Cheers

Tom

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 defining a formset with initial data in it:

class DirectIfaceInlineFormSet(BaseInlineFormSet):
def __init__(self, *args, **kwargs):
kwargs['initial'] = [{ 'name': 'eth1', }, {'name': 'eth2'},]
super(DirectIfaceInlineFormSet, self).__init__(*args, **kwargs)


In this case 2 Direct ifaces with names eth1 and eth2.

The problem is that those ifaces doesn't get stored when I hit the save
button, that's because has_changed == False.
So is there a way to tell Django to save formsets with only initial data ?

Thanks !

-- 
Marc

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 CSS. So instead
> of '/static/css/style.css' I'm getting '/css/style.css' ...
>
> 

Technically speaking, if that is your template, and you end up with
"/css/style.css", then STATIC_URL is not empty, it is '/'.

>
> STATIC_URL is working on the 2 projects that use generic views, but not on
> the other one. So how can 'STATIC_URL' be blank and how can this be fixed? I
> tried adding the following to my index.html template but no joy...
>
> {% load static %}
> {% get_static_prefix as STATIC_PREFIX %}
>

To clarify - you only have one project, with three apps in it. In two
of the apps, which only use generic views, STATIC_URL works correctly,
but in third app it does not.

Do these views in the third app use RequestContext to render the
templates? Generic views do…

Cheers

Tom

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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  wrote:

> Bill,
>
> The URLs in the file for app1 do not have such prefix. Following are two
> lines from project/app1/urls.py -- other URLs have similar structure,
> including that for app2.
>
> urlpatterns = patterns('project.app1.views',
> url(r'^$',  'index',
> name='index'),
> url(r'^(?P\d+)/$',   'introduction',
> name='introduction'),
> )
>
>
> On Sat, Mar 2, 2013 at 8:49 PM, Bill Freeman  wrote:
>
>> You haven't show project/app1/urls.py (or wherever you're getting
>> project.app1.urls).  My guess is that it also specifies that each url
>> begins with "app1/".  Since the root urlconf matches *and consumes* one
>> "app1/" from the request path, any "app1/" required by app1's urls.py is
>> required in addition.
>>
>> Or isn't that your question?
>>
>> Bill
>>
>> On Fri, Mar 1, 2013 at 10:57 AM, Barun Saha wrote:
>>
>>> I have two Django apps (say, app1 and app2) hosted on the same machine
>>> using Apache mod_wsgi. These two apps are hosted on two different
>>> environments:
>>>
>>>  1. On a physical server where only these two apps are hosted. They are
>>> accessed as http://www.example.com/app1/app1/ and
>>> http://www.example.com/app2/app2/.
>>>  2. In the second environment there is a proxy server. A separate web
>>> page on that server is accessed as http://www.domain.com/. This links
>>> to the above two apps (now hosted on a single virtual machine) as
>>> http://www.domain.com/id1/ and http://www.domain.com/id2/
>>>
>>> The URLconf file looks like:
>>>
>>> urlpatterns = patterns('',
>>> (r'^admin/', include(admin.site.urls)),
>>> (r'^app1/', include('project.app1.urls')),
>>> )
>>>
>>> The problem is, this URL configurations works in the environment 1, but
>>> not in the environment 2. Now, if I do something *crazy* in the environment
>>> 2 such as
>>>
>>>  urlpatterns = patterns('',
>>> (r'^admin/', include(admin.site.urls)),
>>> (r'^app1/app1/app1/', include('project.app1.urls')),
>>> (r'^app1/app1/', include('project.app1.urls')),
>>> (r'^app1/', include('project.app1.urls')),
>>>  )
>>>
>>> then the application works. In the env. 2, the app is accessed as
>>> http://www.domain.com/id1/app1/app1/.
>>>
>>> I couldn't understand why we need to prefix app1 in the URL so many
>>> times. In other words, why (how) this works.
>>>
>>> Could someone clarify on this? Also, note that all configurations need
>>> to be done on the virtual machine. I don't have access to the proxy server.
>>>
>>> (Posted in Stackoverflow:
>>> http://stackoverflow.com/questions/15159134/django-urls-with-without-proxy-server
>>> )
>>>
>>>  --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/g-rUctm_0oY/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Thanks,
> Barun Saha
> JPA
> IIT, Kharagpur
>
> http://pothi.com/pothi/book/barun-saha-swapner-kheya
> http://delay-tolerant-networks.blogspot.com/p/one-tutorial.html
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group

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 permissions issue).

The other way this could be a .pyc problem is if the .py file was updated
in such a way that the modified time is left older than that of the .pyc
(differences in time setting on the two machines, some funky transfer
mechanism that sets the target modified time to match that of the source,
where the .pyc is newer, or the machine time was messed up the first time
the app was started, yielding a .pyc modified time far in the future).

When I've had troubles like this it has more often been that I've had two
copies of the site on the deployment box, and I've been fixing the wrong
one.

Bill

On Mon, Mar 4, 2013 at 9:03 AM, frocco  wrote:

> 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 server is loading an old .pyc file. try to delete the urls.pyc
>>> file and restart the server.
>>>
>>>
>>> On Sun, Mar 3, 2013 at 11:16 AM, Asier Hernández Juanes <
>>> asier...@gmail.com> wrote:
>>>
 Hi everyone,

 i have a remote Linux server with a Django application running in a
 nginx server but when I make a change in urls.py like adding a new
 urlpattern the server is not applying the changes. I have restarted nginx
 server but the new url is not loading.

 Does anyone know what may be the problem?

 Thanks a lot!

 --
 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...@**googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.

 Visit this group at 
 http://groups.google.com/**group/django-users?hl=en
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>
>>>
>>>
>>> --
>>> Serge G. Spaolonzi
>>> Cobalys Systems
>>> http://www.cobalys.com
>>>
>>> --
>>> 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...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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.
>
> 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_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 = session.get_decoded()
>> uid_list.append(data.get('_auth_user_id', None))
>>
>> # Query all logged in users based on id list
>> return User.objects.filter(id__in=uid_list)
>>
>>
>> On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote:
>>>
>>> I want to list users currently on our site.
>>> Would I use the last login date time?
>>>
>>> If so, what should the query look like?
>>>
>>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 the site.

On Sun, Mar 3, 2013 at 6:29 PM, Randa Hisham  wrote:

> Iam now working in aproject using django 1.4.2 could I upgrade to django
> 1.5?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 Freeman  wrote:

> 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 permissions issue).
>
> The other way this could be a .pyc problem is if the .py file was updated
> in such a way that the modified time is left older than that of the .pyc
> (differences in time setting on the two machines, some funky transfer
> mechanism that sets the target modified time to match that of the source,
> where the .pyc is newer, or the machine time was messed up the first time
> the app was started, yielding a .pyc modified time far in the future).
>
> When I've had troubles like this it has more often been that I've had two
> copies of the site on the deployment box, and I've been fixing the wrong
> one.
>
> Bill
>
> On Mon, Mar 4, 2013 at 9:03 AM, frocco  wrote:
>
>> 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 server is loading an old .pyc file. try to delete the
 urls.pyc file and restart the server.


 On Sun, Mar 3, 2013 at 11:16 AM, Asier Hernández Juanes <
 asier...@gmail.com> wrote:

> Hi everyone,
>
> i have a remote Linux server with a Django application running in a
> nginx server but when I make a change in urls.py like adding a new
> urlpattern the server is not applying the changes. I have restarted nginx
> server but the new url is not loading.
>
> Does anyone know what may be the problem?
>
> Thanks a lot!
>
> --
> 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...@**googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
>
> Visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>



 --
 Serge G. Spaolonzi
 Cobalys Systems
 http://www.cobalys.com

 --
 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...@**googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.

 Visit this group at 
 http://groups.google.com/**group/django-users?hl=en
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>
>>>  --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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_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 = session.get_decoded()
>>> uid_list.append(data.get('_**auth_user_id', None))
>>>
>>> # Query all logged in users based on id list
>>> return User.objects.filter(id__in=**uid_list)
>>>
>>>
>>> On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote:

 I want to list users currently on our site.
 Would I use the last login date time?

 If so, what should the query look like?

 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...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 having an empty string for a named url, which is not allowed).

So this:

{% url myapp_home %}

would become this:

{% url "myapp_home" %}

Just a "gotcha" to point out in case you haven't taken care of it already.

--
Joey "JoeLinux" Espinosa*
*




On Mon, Mar 4, 2013 at 10:52 AM, Brad Pitcher  wrote:

> 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 the site.
>
>
> On Sun, Mar 3, 2013 at 6:29 PM, Randa Hisham wrote:
>
>> Iam now working in aproject using django 1.4.2 could I upgrade to django
>> 1.5?
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 method I override calls the parent class' method
first.

Is the tempfile supposed to be left behind?

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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 TemporaryFileUploadHandler
> subclass, but each method I override calls the parent class' method
> first.
>
> Is the tempfile supposed to be left behind?
>
> Thanks
>
> Hello,
I am not an experienced django developer so maybe this solution doesnt
follow 'the django way', but as i read at:
http://docs.nullpobug.com/django/trunk/django.core.files.uploadhandler-pysrc.html#FileUploadHandler.new_file
TemporaryFileUploadHandler subclass FileUploadHandler. The 'new_file'
method at FileUploadHandler saves
the file name at the class instance as 'file_name' (self.file_name). So, i
would try to overrite the 'file_complete'
method from my own class that subclass TemporaryFileUploadHandler and do
something like:

class MyTemporaryFileUploadHandler(TemporaryFileUploadHandler):

def file_complete(self, file_size):
if os.path.isfile(self.file_name):
os.unlink(self.file_name)
super(TemporaryFileUploadHandler, self).file_complete(file_size)

I'm not sure if self.file_name points to the temporary file, so maybe this
is not util.


-- 
"Code without tests is broken by design." - Jacob Kaplan-Moss
Show me the mone ... code!: https://bitbucket.org/edvm

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 >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 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_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 = session.get_decoded()
 uid_list.append(data.get('_**auth_user_id', None))

 # Query all logged in users based on id list
 return User.objects.filter(id__in=**uid_list)


 On Sunday, March 3, 2013 11:49:09 AM UTC-5, frocco wrote:
>
> I want to list users currently on our site.
> Would I use the last login date time?
>
> If so, what should the query look like?
>
> 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...@**googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at 
 http://groups.google.com/**group/django-users?hl=en
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .
  
  

>>>
>>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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')[:25].iterator():
print user.username.ljust(20, ' '), user.get_full_name().ljust(30,
' '), user.last_login

Just alter the queryset to use a timedelta query for last_login
instead of a row limit. Shouldn't be a big load on the system.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 checkout/update, tar).
You usually have to go out of your way to get the modified (and created and
accessed time) reflected from the source to the target.  If doing that,
don't.  If your mechanism preserves modified time by default (maybe rsync?)
see if you can't surpress it.  Or "touch" the file after transfer.

On Mon, Mar 4, 2013 at 11:03 AM, Venkatraman S  wrote:

> 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 Freeman  wrote:
>
>> 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 permissions issue).
>>
>> The other way this could be a .pyc problem is if the .py file was updated
>> in such a way that the modified time is left older than that of the .pyc
>> (differences in time setting on the two machines, some funky transfer
>> mechanism that sets the target modified time to match that of the source,
>> where the .pyc is newer, or the machine time was messed up the first time
>> the app was started, yielding a .pyc modified time far in the future).
>>
>> When I've had troubles like this it has more often been that I've had two
>> copies of the site on the deployment box, and I've been fixing the wrong
>> one.
>>
>> Bill
>>
>> On Mon, Mar 4, 2013 at 9:03 AM, frocco  wrote:
>>
>>> 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 server is loading an old .pyc file. try to delete the
> urls.pyc file and restart the server.
>
>
> On Sun, Mar 3, 2013 at 11:16 AM, Asier Hernández Juanes <
> asier...@gmail.com> wrote:
>
>> Hi everyone,
>>
>> i have a remote Linux server with a Django application running in a
>> nginx server but when I make a change in urls.py like adding a new
>> urlpattern the server is not applying the changes. I have restarted nginx
>> server but the new url is not loading.
>>
>> Does anyone know what may be the problem?
>>
>> Thanks a lot!
>>
>> --
>> 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...@**googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>>
>> Visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>
>>
>>
>
>
>
> --
> Serge G. Spaolonzi
> Cobalys Systems
> http://www.cobalys.com
>
> --
> 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...@**googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
>
> Visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

  --
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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-us

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 variables 
from the View to the HTML part of the template. My Question is, How do I 
pass the variable from the View to the JQuery slider bar?

Thankyou for any help. I am new to Django, JQuery and pretty much all Web 
programming, my main experince is working with microcontollers and low 
level language between chips.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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')[:25].iterator(): 
> print user.username.ljust(20, ' '), user.get_full_name().ljust(30, 
> ' '), user.last_login 
>
> Just alter the queryset to use a timedelta query for last_login 
> instead of a row limit. Shouldn't be a big load on the system. 
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 wouldn't
represent reality.

You could get fancy and log the timestamp of the last request of every
user with middleware and compare it to your session timeout. Of course
that still wouldn't know when people closed their browsers when before
their sessions expired, but it should capture users active beyond the
session timeout.

Shawn

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 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 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 wouldn't 
> represent reality. 
>
> You could get fancy and log the timestamp of the last request of every 
> user with middleware and compare it to your session timeout. Of course 
> that still wouldn't know when people closed their browsers when before 
> their sessions expired, but it should capture users active beyond the 
> session timeout. 
>
> Shawn 
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 
> streaming it, I don't think list this is the best resource. 
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 files (hampster dance, anyone?) many years ago 
> in HTML. 
>
> http://www.w3schools.com/html/html_sounds.asp 
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 wrote:

> On Mon, 25 Feb 2013 21:06:33 +0100
> Anton  wrote:
> 
>> Hi,
>> 
>> I am using my django in the following way:
>> 
>> OS: Windows 7 (64 bit)
>> 
>>  + Python 2.7.3 (32bit)
>> 
>>  + apache 2.4.3 (32 bit) from apachelounge
>>(I use the version which was build with vs2008 like python 2.7.3)
>> http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-
win32-
>> VC9.zip
>> 
>>  + django 1.4.5
>> 
>>  + mod_wsgi 3.4 (32 bit) from http://code.google.com/p/modwsgi/
>>(compiled manually with vs2008 since no binaries available)
>>  
>> I would like to use the typical Windows intranet scenario
>> where you have a single-sign-on with the internet explorer.
>> 
>> At least in our company the ASP .NET powered intranet sites
>> work fine with this.
>> 
>> I googled around, as if I understood right, this auth system
>> is called NTLM and if you want to use it, you need
>> the apache module "mod-auth-sspi".
>> 
>> If I look at the project page
>> http://sourceforge.net/projects/mod-auth-sspi/?source=dlp
>> I see only stuff dated from 2011 and only for *apache 2.2*.
>> 
>> And if I read this article on apachelounge:
>> 
>> http://www.apachelounge.com/viewtopic.php?t=4548
>> 
>> then there will be *never* a support for Apache 2.4.
>> 
>> In the Django docs:
>> "Authentication using REMOTE_USER"
>> https://docs.djangoproject.com/en/1.4/howto/auth-remote-user/
>> 
>> you get links to mod_auth_sspi but its has be forgotten to mention
>> that this module (seems) now obsolete.
>> 
>> So the question is:
>> 
>> Is it possible to obtain SSO with Django on a Windows powered machine,
>> or do I have to give up and try my luck with ASP.NET or perhaps php
>> for windows or whatever.
>> 
>> I love Django & python, but I am here in a dead end.
>> 
>> Is there somebody using this scenarion (which is quit common in big
>> companies)?
>> 
>> Thanks.
>> Anton
>> 
> 
> Hm... Did you maybe think about using Kerberos part of the AD for
> authentication instead?
> 
> Best regards
> 


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 this be practical, has anyone thought of this?

avraham


On Mon, Mar 4, 2013 at 11:19 PM, Anton  wrote:

> @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 wrote:
>
> > On Mon, 25 Feb 2013 21:06:33 +0100
> > Anton  wrote:
> >
> >> Hi,
> >>
> >> I am using my django in the following way:
> >>
> >> OS: Windows 7 (64 bit)
> >>
> >>  + Python 2.7.3 (32bit)
> >>
> >>  + apache 2.4.3 (32 bit) from apachelounge
> >>(I use the version which was build with vs2008 like python 2.7.3)
> >> http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-
> win32-
> >> VC9.zip
> >>
> >>  + django 1.4.5
> >>
> >>  + mod_wsgi 3.4 (32 bit) from http://code.google.com/p/modwsgi/
> >>(compiled manually with vs2008 since no binaries available)
> >>
> >> I would like to use the typical Windows intranet scenario
> >> where you have a single-sign-on with the internet explorer.
> >>
> >> At least in our company the ASP .NET powered intranet sites
> >> work fine with this.
> >>
> >> I googled around, as if I understood right, this auth system
> >> is called NTLM and if you want to use it, you need
> >> the apache module "mod-auth-sspi".
> >>
> >> If I look at the project page
> >> http://sourceforge.net/projects/mod-auth-sspi/?source=dlp
> >> I see only stuff dated from 2011 and only for *apache 2.2*.
> >>
> >> And if I read this article on apachelounge:
> >>
> >> http://www.apachelounge.com/viewtopic.php?t=4548
> >>
> >> then there will be *never* a support for Apache 2.4.
> >>
> >> In the Django docs:
> >> "Authentication using REMOTE_USER"
> >> https://docs.djangoproject.com/en/1.4/howto/auth-remote-user/
> >>
> >> you get links to mod_auth_sspi but its has be forgotten to mention
> >> that this module (seems) now obsolete.
> >>
> >> So the question is:
> >>
> >> Is it possible to obtain SSO with Django on a Windows powered machine,
> >> or do I have to give up and try my luck with ASP.NET or perhaps php
> >> for windows or whatever.
> >>
> >> I love Django & python, but I am here in a dead end.
> >>
> >> Is there somebody using this scenarion (which is quit common in big
> >> companies)?
> >>
> >> Thanks.
> >> Anton
> >>
> >
> > Hm... Did you maybe think about using Kerberos part of the AD for
> > authentication instead?
> >
> > Best regards
> >
>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 though.




On 05/03/13 06:23, 7equivale...@gmail.com wrote:
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 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 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 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...@googlegroups.com
.
To post to this group, send email to
django...@googlegroups.com .
Visit this group at
http://groups.google.com/group/django-users?hl=en
.
For more options, visit
https://groups.google.com/groups/opt_out
.



--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 swing at it.


Cheers,
AT

On Mon, Mar 4, 2013 at 6:24 PM, Avraham Serour  wrote:

> 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 this be practical, has anyone thought of this?
>
> avraham
>
>
> On Mon, Mar 4, 2013 at 11:19 PM, Anton  wrote:
>
>> @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 wrote:
>>
>> > On Mon, 25 Feb 2013 21:06:33 +0100
>> > Anton  wrote:
>> >
>> >> Hi,
>> >>
>> >> I am using my django in the following way:
>> >>
>> >> OS: Windows 7 (64 bit)
>> >>
>> >>  + Python 2.7.3 (32bit)
>> >>
>> >>  + apache 2.4.3 (32 bit) from apachelounge
>> >>(I use the version which was build with vs2008 like python 2.7.3)
>> >> http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-
>> win32-
>> >> VC9.zip
>> >>
>> >>  + django 1.4.5
>> >>
>> >>  + mod_wsgi 3.4 (32 bit) from http://code.google.com/p/modwsgi/
>> >>(compiled manually with vs2008 since no binaries available)
>> >>
>> >> I would like to use the typical Windows intranet scenario
>> >> where you have a single-sign-on with the internet explorer.
>> >>
>> >> At least in our company the ASP .NET powered intranet sites
>> >> work fine with this.
>> >>
>> >> I googled around, as if I understood right, this auth system
>> >> is called NTLM and if you want to use it, you need
>> >> the apache module "mod-auth-sspi".
>> >>
>> >> If I look at the project page
>> >> http://sourceforge.net/projects/mod-auth-sspi/?source=dlp
>> >> I see only stuff dated from 2011 and only for *apache 2.2*.
>> >>
>> >> And if I read this article on apachelounge:
>> >>
>> >> http://www.apachelounge.com/viewtopic.php?t=4548
>> >>
>> >> then there will be *never* a support for Apache 2.4.
>> >>
>> >> In the Django docs:
>> >> "Authentication using REMOTE_USER"
>> >> https://docs.djangoproject.com/en/1.4/howto/auth-remote-user/
>> >>
>> >> you get links to mod_auth_sspi but its has be forgotten to mention
>> >> that this module (seems) now obsolete.
>> >>
>> >> So the question is:
>> >>
>> >> Is it possible to obtain SSO with Django on a Windows powered machine,
>> >> or do I have to give up and try my luck with ASP.NET or perhaps php
>> >> for windows or whatever.
>> >>
>> >> I love Django & python, but I am here in a dead end.
>> >>
>> >> Is there somebody using this scenarion (which is quit common in big
>> >> companies)?
>> >>
>> >> Thanks.
>> >> Anton
>> >>
>> >
>> > Hm... Did you maybe think about using Kerberos part of the AD for
>> > authentication instead?
>> >
>> > Best regards
>> >
>>
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 joe looks
up his schedule for today essentially I end up doing a query get
records for today, where user name is joe. Same thing would happen
when Mary looks up her schedule, we do DB lookup for records for Mary.

I am worried that when 10,000 people start to query this my database
is going to become a bottleneck (?) Should I be implementing some of
home grown daemon that caches the data associated with most common
queries and serve the data out of that daemon.

I am sure I am not the first one to encounter this issue, how do
people scale their query response time when using django as their
framework.

(Hope this Q made sense...)

-Subodh

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 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 of records when it's
deployed.

I'd love to hear your workflow or suggestions. Also I haven't seen
many articles that focus on developing high-performance webapps in
Django. May be it's the problem with me. so if you know of any good
articles which would help me, kindly share it too.


Well, data modelling is independent of all this - right? :)

I mean, benchmarking should not drive database design; and if it does,
then there is a VERY HIGH probability that you are not doing things
right. IF your models are right, then the problems would be in the way
you are constructing the query and django-debug-toolbar is a life-saver
here.

Regards,
Venkat

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 enter to achieve this?
Thank you for your help.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 do this. What command
> exactly do I enter to achieve this?
> Thank you for your help.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
Hi Ugorji,

first off, to enjoy programming, do not let anything look so big a
problem to tackle. Of course, there would be challenges, but none of
these challenges should be bigger than they really are.

That said, while starting out, you must have successfully created a
project called mysite. This happened when you ran the following
command:

django-admin.py  startproject mysite

This would've created a project file called 'mysite' at a location you
chose by yourself; this location is where you ran the above command
from. E.g on a windows machine, if you issued the command from
'c:/users/ugorna/desktop>>'
The project folder would've been created on your desktop!
Go to that project folder called mysite, open it and you would see
some .py files in there; one of these files is settings.py. Edit it
with your choice editor.

Hope that helps.

Just to clear my doubt, have you read about python at all??? If yes,
cool. If no, you may want to take a look at it first before coming to
django.
This would make your django experience worthwhile.

Regards.

-- 
Elegbede Muhammed Oladipupo

web: www.dipoelegbede.com
skype: dipo.elegbede
mobile: (234) 803 3299 270
(234) 807 7682 428

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 pay there's a $30 version that comes
with video lessons.
It'll cover anything from setting python up, to working with the terminal,
to picking and
configuring your text editor.


In case you're just looking for some direct tip, and use GNU/Linux, I'd
suggest typing
gedit mysite/settings.py

Gedit is a good enough editor to start with, it has some helpful programming
features out of the box that will not get in your way, like syntax
highlighting.
If you're using Windows, I'd recommend getting Notepad++. I haven't used it
in a long
time, but it used to be like gedit.

I can't help with Mac stuff, though...


- Gabriel

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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_ul %}

And this dynamically generates the HTML for all my form fields including 
the captcha field:

Captcha:




My issue is that I can't use {% form.as_ul %} to display my form, because 
each field requires customised css styling.

So I'll need to replace the {% form.as_ul %} with the actual HTML code in 
my template.

This works fine, however, the captcha field value needs to be re-generated 
each time, so I need to generate the captcha field value dynamically each 
time the form is loaded.

What is the best way to do this? I guess I'm looking for something similar 
to the way the csrf token works, ie. the {% csrf_token %} tag, which 
dynamically generates the csrf token. Is there an equivalient for simple 
captcha, like {% captcha_value %} or something?

thanks in advance,
Mark

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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')
> name = models.CharField(max_lenght=64)
>
> And what I'm doing is defining a formset with initial data in it:
>
>  class DirectIfaceInlineFormSet(BaseInlineFormSet):
> def __init__(self, *args, **kwargs):
> kwargs['initial'] = [{ 'name': 'eth1', }, {'name': 'eth2'},]
> super(DirectIfaceInlineFormSet, self).__init__(*args, **kwargs)
>
>
> In this case 2 Direct ifaces with names eth1 and eth2.
>
> The problem is that those ifaces doesn't get stored when I hit the save
> button, that's because has_changed == False.
> So is there a way to tell Django to save formsets with only initial data ?
>

Sure - just provide the initial data as actual data. If, instead of using
'initial', you pass the same content as 'data', the form will be saveable.

Yours,
Russ Magee %-)

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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.barebones.com/products/textwrangler/) on Windows. Though I
haven't used it myself, Sublime Text (http://www.sublimetext.com/) looks
really cool.

You could also use an IDE (which is an editor plus other project
management tools). I prefer PyCharm (http://www.jetbrains.com/pycharm/)
for this. Or on the free side, try Aptana (http://www.aptana.com/)

Happy coding!
_Nik

On 3/4/2013 3:37 PM, 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 do this. What
> command exactly do I enter to achieve this?
> Thank you for your help.
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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']
 ccopia = form.cleaned_data['ccopia']
 from django.core.mail import send_mail
 send_mail(subject, mensaje, email, 'x...@xx.com')
 return HttpResponseRedirect('/gracias/') 
else:
form = ContactForm(
initial={'subject': 'Me agrada su sitio!'}
)
return render(request, 'contacto_form.html', {
 'form': form,
})

line 89


from django.core.mail import send_mail
 ^
IndentationError: unindent does not match any outer indentation level


Book code is not working https://docs.djangoproject.com/en/dev/topics/forms/

Thanks for any comment

Django 1.4.4
'Apache/2.2.16 (Debian)'


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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 never use tabs.

Most text editors let you configure them to use spaces instead of tabs.

If you do that you will need to replace all tabs with your preferred 
number of spaces.


Once you fix that the error will go away.

Mike



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']
  ccopia = form.cleaned_data['ccopia']
  from django.core.mail import send_mail
  send_mail(subject, mensaje, email, 'x...@xx.com')
  return HttpResponseRedirect('/gracias/')
 else:
 form = ContactForm(
 initial={'subject': 'Me agrada su sitio!'}
 )
 return render(request, 'contacto_form.html', {
  'form': form,
 })

line 89


from django.core.mail import send_mail
  ^
IndentationError: unindent does not match any outer indentation level


Book code is not working https://docs.djangoproject.com/en/dev/topics/forms/

Thanks for any comment

Django 1.4.4
'Apache/2.2.16 (Debian)'


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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['recado']
 email = form.cleaned_data['email']
 ccopia = form.cleaned_data['ccopia']
 from django.core.mail import send_mail
 send_mail(subject, mensaje, email, 'x...@xx.com')
 return HttpResponseRedirect('/gracias/')
else:
form = ContactForm(
initial={'subject': 'Me agrada su sitio!'}
)
return render(request, 'contacto_form.html', {
 'form': form,
})


On Mon, Mar 4, 2013 at 10:05 PM, Ana Molf  wrote:

> 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']
>  ccopia = form.cleaned_data['ccopia']
>  from django.core.mail import send_mail
>  send_mail(subject, mensaje, email, 'x...@xx.com')
>  return HttpResponseRedirect('/gracias/')
> else:
> form = ContactForm(
> initial={'subject': 'Me agrada su sitio!'}
> )
> return render(request, 'contacto_form.html', {
>  'form': form,
> })
>
> line 89
>
>
> from django.core.mail import send_mail
>  ^
> IndentationError: unindent does not match any outer indentation level
>
>
> Book code is not working https://docs.djangoproject.com/en/dev/topics/forms/
>
> Thanks for any comment
>
> Django 1.4.4
> 'Apache/2.2.16 (Debian)'
>
>
>  --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.