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

2013-03-05 Thread Branko Majic
I've set-up a Kerberised environment some time ago, but I can't recall
what docs I've been reading back then, so no recommendations there. I
would recommend reading a little about it on Wikipedia (for start) to
get the high-level overview.

The environment I've set-up had relied upon MIT Kerberos
implementation (and to top it off I also used PKINIT), although I was
able to have the Windows 7 clients authenticate against it. So no idea
what happens if using AD.

You're probably not the only person on the planet, but it's probably
avoided solution due to some issues you can get. A small advice -
_always_ first verify that the time on your machines is good. 90% of
problems I had were related to clock differences between server,
Kerberos servers, and user workstations.

Best regards

On Mon, 04 Mar 2013 22:19:35 +0100
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
> > 
> 
> 



-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature


how to add prefix in generic_inlineformset_factory?

2013-03-05 Thread Witold Greń
How to add prefix in generic_inlineformset_factory()? This is posible?

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




Trouble in trying django form wizard example!

2013-03-05 Thread Dilip M
Hi,

I am new to Django and trying out form wizards. I am trying the example
mentioned in
https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#wizard-template-for-each-form
.

After 'submit'ting the data for 'ContactForm1' I am not getting
'ContactForm2'?

I am just trying to print the date I key in ContactForm1 and ContactForm2
in some sample template!



Please help!

Thanks, Dilip

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




raw_id_fields: How to show a name instead of id?

2013-03-05 Thread Almudena Vila Forcén


Customizing a Django Admin panel, I'm using 
raw_id_fields
 to 
select a ForeignKey from a Model which has thousands of elements, because 
the default select-box drop-down is inconvenient with so many elements.

It works but it shows the id as can be seen on this image:

 [image: enter image description here] 

Is there any way to show the name or other field instead of the id? Or, is 
there any better way to accomplish this than using raw_id_fields?

This is my code in models.py:

class Structure(MPTTModel):
name = models.CharField(max_length=200, unique=True, verbose_name = 
_('name'))
parent = TreeForeignKey('self', null=True, blank=True, 
related_name='children', verbose_name = _('parent'))

def __unicode__(self):
return u"%s" % (self.name)

In admin.py:

class StructureAdmin(tree_editor.TreeEditor):
search_fields = ('name',)
raw_id_fields = ('parent',)

Thanks in advance.


-- 
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 add prefix in generic_inlineformset_factory?

2013-03-05 Thread Tom Evans
On Tue, Mar 5, 2013 at 9:20 AM, Witold Greń  wrote:
> How to add prefix in generic_inlineformset_factory()? This is posible?
>

I don't understand precisely what you mean, but two of the arguments
to generic_inlineformset_factory() are 'form' and 'formset', allowing
you to specify a different class for the form objects created, and a
different base class for the formset created. This is generally true
for all formset_factory() functions.

This allows you almost unlimited flexibility in controlling how the
forms are generated, how they behave and so forth. Eg, if I wanted the
formset to take an additional argument on construction, and set that
argument on each instance the formset creates/modifies, I could do
something like this:


  class TeamBaseFormset(BaseModelFormSet):
def __init__(self, *args, **kwargs):
  self.manager = kwargs.pop('manager')
def save(self, commit=True, *args, **kwargs):
  instances = super(TeamBaseFormset, self).save(commit=False,
*args, **kwargs)
  for team in instances:
team.manager = self.manager
if commit:
  team.save()
  return instances

  TeamFormset = modelformset_factory(Team, formset=TeamBaseFormset)

  form = TeamFormset(manager=manager)

Since you have control over the formset class and the form, you can
override or change any behaviour that you want.

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

2013-03-05 Thread graeme
10,000 people does not sound like too heavy a load. How often will they 
check their schedules?

If you are looking up items by day and user, then indices on day and 
(foreign key on) user should be enough to handle a much heavier load.

If you do find you need caching, using Django's built in cache framework 
first, then maybe something like memcached for db queries.

I would also look at things like connection pooling before you decide you 
need caching.

On Tuesday, March 5, 2013 4:38:31 AM UTC+5:30, Subodh Nijsure wrote:
>
> 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: how to add prefix in generic_inlineformset_factory?

2013-03-05 Thread Witold Greń
I need to create two formset (generic_inlineformset_factory). When i create 
formset in template used formset_create_company and formset_create_private, 
field 
names are the same.

c['form_create_company'] = User1()

c['form_create_private'] = User2()

c['formset_create_company'] = 
generic_inlineformset_factory(SpecialData, form=SpecialDataForm, extra=1, 
max_num=2)

c['formset_create_private'] = 
generic_inlineformset_factory(SpecialData, form=SpecialDataForm, extra=1, 
max_num=2)

{{ form_create_company.name }} = created: ''
{{ formset_create_private.name }} = created: ''

I need:

{{ form_create_company.name }} = created: ''
{{ formset_create_private.name }} = created: ''


W dniu wtorek, 5 marca 2013 10:20:36 UTC+1 użytkownik Witold Greń napisał:
>
> How to add prefix in generic_inlineformset_factory()? This is posible?

-- 
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: Request for comments on a new Open Source Paas platform for Django

2013-03-05 Thread Michael
On Sunday, 3 March 2013 17:45:56 UTC+1, Bruno Girin wrote:

> The main stumbling block at the moment and for which we could do with 
> Django expertise is about the structure of the settings files. Some 
> settings are application specific and should be left alone by Juju, others 
> are environment specific and should be generated by Juju (database config 
> for instance). Patrick solved that problem by separating different config 
> elements in different files but this implies that juju'ised applications 
> would need to follow the same structure. Is that a good idea?
>
>
I had a go at something similar a while back [1] (well, a very cut-down 
version of what you guys are attempting), and for that I used configglue's 
in-built support for local settings that override the project settings [2], 
but I'm assuming in this case we'd not want to force juju'ised projects to 
use configglue either.

I've not tried this on any production app, or thought about it more than 
the example below - perhaps others can say the obvious issues they see - 
but one idea that comes to mind is just reversing how people normally split 
up their settings files, something like:

{{{
$ django-admin startproject test_settings
$ cd test_settings/
$ echo 'from django.conf import settings;print("Debug is: %s. LangCode is: 
%s" % (settings.DEBUG, settings.LANGUAGE_CODE))' | ./manage.py shell --plain

(prints "Debug is: True. LangCode is: en-us")

$ echo -e "from test_settings.settings import *\nDEBUG = False" > 
local_settings.py
$ echo 'from django.conf import settings;print("Debug is: %s. LangCode is: 
%s" % (settings.DEBUG, settings.LANGUAGE_CODE))' | ./manage.py shell 
--plain --settings=local_settings

(prints "Debug is: False. LangCode is: en-us")
}}}

-Michael

[1] 
http://micknelson.wordpress.com/2011/11/22/a-generic-juju-charm-for-django-apps/
[2] 
http://bazaar.launchpad.net/~michael.nelson/charms/oneiric/apache-django-wsgi/trunk/view/head:/hooks/manifests/database_settings.pp

-- 
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 admin - Insert into another table

2013-03-05 Thread Bora Aymete
I want to insert into another table when saving a record on Django admin 
panel. For example I have a model named device and I want to create a 
device and keep it in a table, but whenever I make a change to the device, 
I want to make a record history of the changes. Is it possible to do so?

-- 
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-05 Thread Peter Chibunna
def contact(request):

if request.method == 'POST':

#checks if the request method was a post, i.e. if the form has been 
submitted
#and initializes the form with the data that was submitted

form = ContactForm(request.POST)

  if form.is_valid():

  #if form validation passed, do your assigments and extract data 
from the form data

 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, 'xx...@xx.com')

 return HttpResponseRedirect('/gracias/') 

else:

#this is where your problem is. The indent on this line MUST match the if 
for the request.method == 'POST'

  form = ContactForm(initial={'subject': 'Me agrada su sitio!'})

 

#this indent below MUST also match the indent for the request.method 
meaning that it 

return render(request, 'contacto_form.html', {'form': form,})


so that with any condition based on the request method, form will always be 
set.
Hope you got it ? 

On Tuesday, 5 March 2013 04:05:26 UTC+1, 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, 
> 'xx...@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: New to Django & Programming - Trying to work with the tutorial. How to edit mysite/settings.py

2013-03-05 Thread Peter Chibunna
There's exactly no command that you need to achieve what you are asking 
here. The "settings.py" file is a file -like the name suggests- that 
contains settings for your django web application. This includes database 
pointers, database credentials, applications in your site, and all those 
things like "middlewares", etc. Django is not as difficult as you are 
looking at it from that "settings.py" point of view. I'd like to ask you 
some questions to ascertain what level of help you require: Your developing 
platform (Windows, Linux or Mac)? Have you been programming in other 
languages like PHP, JSP, ASP, ... ? 08073207201

On Tuesday, 5 March 2013 00:37:46 UTC+1, 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.




Re: Request for comments on a new Open Source Paas platform for Django

2013-03-05 Thread Dave Murphy
On Sunday, March 3, 2013 4:45:56 PM UTC, Bruno Girin wrote:

> Patrick solved that problem by separating different config elements in 
> different files but this implies that juju'ised applications would need to 
> follow the same structure. Is that a good idea?


If you're aiming for a PaaS-style charm for Django, then trying to emulate 
The Twelve-Factor App [1] and it's opinions on configuration [2] would be a 
good starting point. Basically, if there are things specific to the 
environment then they should be in environment variables, not in generated 
or modified config files.

 

-- 
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: Use variable in my template?

2013-03-05 Thread Amyth Arora
how are you passing the variable to the template ? show us the view method
that renders the template
 On Feb 28, 2013 4:36 PM, "Maria"  wrote:

> Hello everyone,
>
> I have a variable I want to have access to in my Django template. But
> somehow I can't manage to do that.
>
> I got *Django/mytemplates/polls/detail.html (template) *where I want to
> insert an image:
>
>
>> {% load staticfiles %}
>>
>> 
>> 
>> > media="screen" />
>> 
>> 
>>  
>>
>>
>
>
> and
>
> *Django/mysite/polls/marke.py* :
>
>
>> from choice import*
>>
>> global marke
>> marke = read_m()
>>
> The value of marke is *marke3 *and I have an image marke3.jpg. I
> successfully used another variable to insert an image (poll.id) but this
> time it wont work.
> The folder 'polls' is in my INSTALLED_APPS.
>
> What can I do?
>
>
>
>
>
>
> --
> 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: Request for comments on a new Open Source Paas platform for Django

2013-03-05 Thread Michael Nelson
On Tue, Mar 5, 2013 at 1:55 PM, Dave Murphy  wrote:

> On Sunday, March 3, 2013 4:45:56 PM UTC, Bruno Girin wrote:
>
>> Patrick solved that problem by separating different config elements in
>> different files but this implies that juju'ised applications would need to
>> follow the same structure. Is that a good idea?
>
>
> If you're aiming for a PaaS-style charm for Django, then trying to emulate
> The Twelve-Factor App [1] and it's opinions on configuration [2] would be a
> good starting point. Basically, if there are things specific to the
> environment then they should be in environment variables, not in generated
> or modified config files.
>
>

+1 - but Django doesn't support env vars overriding settings out of the box
(although configglue does enable this) which means forcing people using the
charm to update their settings (rather than just encouraging good
practise). That said, it might be a small (and worthwhile) thing to ask of
people wanting to use the charm. (ie. to use this charm, your settings need
to read the following env vars...) If not, writing a local_settings.py that
overrides the required settings from the env may work:

local_settings.py:
{{{
import os
from userproject.settings import *

LANGUAGE_CODE = os.environ['DJANGO_LANGUAGE_CODE']
...
}}}

Are there other better options that wouldn't force people to change their
code to use the charm?

-- 
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 admin - Insert into another table

2013-03-05 Thread Shawn Milochik
Sure. Just use the post-save signal:

https://docs.djangoproject.com/en/1.5/ref/signals/#post-save

-- 
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: Request for comments on a new Open Source Paas platform for Django

2013-03-05 Thread Dave Murphy
On Tuesday, March 5, 2013 1:17:13 PM UTC, Michael wrote:
>
> Are there other better options that wouldn't force people to change their 
> code to use the charm?
>

For the charm to be of sufficient value, it needs to be opinionated, 
otherwise it's going to suffer from trying to work out-of-the-box for 
everyone.

-- 
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 want to check for new orders in the background?

2013-03-05 Thread frocco
Hello,

I want to query the orders database every 5 minutes and alert admins that 
new orders have arrived.
Would I use signals for this?

Anyone have an example?

Thank you

-- 
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 want to check for new orders in the background?

2013-03-05 Thread frocco
Would I send a signal after an order is saved?

On Tuesday, March 5, 2013 8:38:14 AM UTC-5, frocco wrote:
>
> Hello,
>
> I want to query the orders database every 5 minutes and alert admins that 
> new orders have arrived.
> Would I use signals for this?
>
> Anyone have an example?
>
> Thank you
>

-- 
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 want to check for new orders in the background?

2013-03-05 Thread frocco
This is not working, the to: never gets called.

from:
user_order = Signal(providing_args=["request", "order"])
user_order.send(sender=None, request=request, order=order)


to:
def user_order_handler(sender, **kwargs):
order = kwargs('order')

user_order.connect(user_order_handler)

On Tuesday, March 5, 2013 8:49:46 AM UTC-5, frocco wrote:
>
> Would I send a signal after an order is saved?
>
> On Tuesday, March 5, 2013 8:38:14 AM UTC-5, frocco wrote:
>>
>> Hello,
>>
>> I want to query the orders database every 5 minutes and alert admins that 
>> new orders have arrived.
>> Would I use signals for this?
>>
>> Anyone have an example?
>>
>> Thank you
>>
>

-- 
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 want to check for new orders in the background?

2013-03-05 Thread Dave Murphy
On Tuesday, March 5, 2013 1:38:14 PM UTC, frocco wrote:
>
> I want to query the orders database every 5 minutes and alert admins that 
> new orders have arrived.
> Would I use signals for this?
>

Using a receiver attached to the post_save signal of your Order model would 
certainly be more efficient than polling the database. You could also 
generate the e-mail inside the save() method of your model. However you 
need to be careful as both may block your application.
 

> Anyone have an example?
>

Everything you need is here: 
https://docs.djangoproject.com/en/dev/topics/signals/ 

-- 
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 admin - Insert into another table

2013-03-05 Thread Bora Aymete
Looks promising. Thanks

5 Mart 2013 Salı 15:25:13 UTC+2 tarihinde Shawn Milochik yazdı:
>
> Sure. Just use the post-save signal: 
>
> https://docs.djangoproject.com/en/1.5/ref/signals/#post-save 
>

-- 
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 want to check for new orders in the background?

2013-03-05 Thread Jaimin Patel
Take a look at django-notifications app 
- https://github.com/pinax/django-notification

I think it should be able to help you.

you can check the example of it on this SO thread 
- 
http://stackoverflow.com/questions/1609775/how-do-i-display-notifications-from-django-notification

On Tuesday, March 5, 2013 8:38:14 AM UTC-5, frocco wrote:
>
> Hello,
>
> I want to query the orders database every 5 minutes and alert admins that 
> new orders have arrived.
> Would I use signals for this?
>
> Anyone have an example?
>
> Thank you
>

-- 
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 want to check for new orders in the background?

2013-03-05 Thread frocco
I tried your link https://github.com/pinax/django-notification
but it is not working.

is there anything wrong with my code to prevent the signal from working?

On Tuesday, March 5, 2013 9:18:04 AM UTC-5, Jaimin Patel wrote:
>
> Take a look at django-notifications app - 
> https://github.com/pinax/django-notification
>
> I think it should be able to help you.
>
> you can check the example of it on this SO thread - 
> http://stackoverflow.com/questions/1609775/how-do-i-display-notifications-from-django-notification
>
> On Tuesday, March 5, 2013 8:38:14 AM UTC-5, frocco wrote:
>>
>> Hello,
>>
>> I want to query the orders database every 5 minutes and alert admins that 
>> new orders have arrived.
>> Would I use signals for this?
>>
>> Anyone have an example?
>>
>> Thank you
>>
>

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




get_form in formwizard gives validation error

2013-03-05 Thread Rob
In a formwizard I want to use a custom query, based on previous choices. 
The form renders well, but when the step is submitted I get an "Select a 
valid choice. That choice is not one of the available choices." error

Here is the get_form part in my views.py (simplified):

def get_form(self, step=None, data=None, files=None):
form = super(BoekingWizard, self).get_form(step, data, files)
if step == 'step3':
form.fields['Activiteit'].queryset = Activiteit.objects.all()
   return form

Here is the part from my forms.py:

class BoekForm3(forms.Form):
Activiteit = forms.ModelChoiceField(queryset=Activiteit.objects.none(), 
widget=forms.RadioSelect, empty_label=None)

Anybody an idea about this?

Rob

-- 
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-05 Thread Rui Silva

Hi Subodh,

10k records isn't that much. Nonetheless you should test your 
application with high loads to assert if the database performance is an 
issue.


If the test results show that the database performance may be a problem, 
you should check if the tables you use are properly indexed and look for 
a caching mechanism.


Configuring cache in Django is fairly easy. I use Memcached as cache 
backend with Django. I have a database of about 6 Million users (mysql), 
and on each of the 3 frontends running Django, I have an instance of 
memcache running.



Rui Silva

On 03/04/2013 11:08 PM, Subodh Nijsure wrote:

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.




A generic 'search' framework for forms?

2013-03-05 Thread Subodh Nijsure
I have lot of forms in my django application and would like to present
a generic way for end user to do search query, is there a package out
there that allows one to construct such a thing?

Example I have a form that shows customers it has fields like
customer_name, customer_address , I have another form that shows
technicians information such as first_name, last_name, location.

I would like to add a "widget" at top of the customer form so that end
user can say, I want to search by name, type search string and all
entries that match that search string will show up. Same for
technician form I want them to be able to pick they want to search by
first_name or last_name and type the search string to narrow the
listing.

Thanks
-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: how to add prefix in generic_inlineformset_factory?

2013-03-05 Thread Tom Evans
On Tue, Mar 5, 2013 at 11:40 AM, Witold Greń  wrote:
> I need to create two formset (generic_inlineformset_factory). When i create
> formset in template used formset_create_company and formset_create_private,
> field names are the same.
>
> c['form_create_company'] = User1()
>
> c['form_create_private'] = User2()
>
> c['formset_create_company'] = generic_inlineformset_factory(SpecialData,
> form=SpecialDataForm, extra=1, max_num=2)
>
> c['formset_create_private'] = generic_inlineformset_factory(SpecialData,
> form=SpecialDataForm, extra=1, max_num=2)
>
>
> {{ form_create_company.name }} = created: ' id="id_core-specialdata-content_type-object_id-0-name" maxlength="200"
> name="core-specialdata-content_type-object_id-0-name" type="text">'
> {{ formset_create_private.name }} = created: ' id="id_core-specialdata-content_type-object_id-0-name" maxlength="200"
> name="core-specialdata-content_type-object_id-0-name" type="text">'
>
> I need:
>
> {{ form_create_company.name }} = created: ' id="id_my_name1-specialdata-content_type-object_id-0-name" maxlength="200"
> name="my_name1-specialdata-content_type-object_id-0-name" type="text">'
> {{ formset_create_private.name }} = created: ' id="id_my_name2-specialdata-content_type-object_id-0-name" maxlength="200"
> name="my_name2-specialdata-content_type-object_id-0-name" type="text">'
>
>

Ah, I see. generic_inline_formset returns a type, not an instance, so
I'm not sure how your "c['formset_create_company']", which is a type,
not an actual form instance, is used. However, the simple answer is
that a type derived from FormSet will take 'prefix' as an argument
during construction. So, wherever you are constructing the formset,
provide the prefix.

Eg:

SpecialDataInlineFormSet = generic_inlineformset_factory(SpecialData,
form=SpecialDataForm, extra=1, max_num=2)

c['formset_create_company'] = SpecialDataInlineFormSet(prefix='company')
c['formset_create_private'] = SpecialDataInlineFormSet(prefix='private')


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: how to add prefix in generic_inlineformset_factory?

2013-03-05 Thread Witold Greń
Thanks, django documentation that is what is missing ;)


W dniu wtorek, 5 marca 2013 10:20:36 UTC+1 użytkownik Witold Greń napisał:
>
> How to add prefix in generic_inlineformset_factory()? This is posible?

-- 
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-recaptcha validation problems

2013-03-05 Thread Xavier Pegenaute

Hi,

I am using django-recaptcha and I want to use it inside the registration 
form. In the website [1], inside the Field section says: "A ReCaptcha 
widget will be rendered with the field validating itself without any 
further action required from you". Actually seems is not validating 
anything. Anyone had similar experience?


Thanks.
- forms.py -
from registration.forms import RegistrationFormUniqueEmail
from captcha.fields import ReCaptchaField

class RecaptchaRegistrationForm(RegistrationFormUniqueEmail):
recaptcha = ReCaptchaField()
- forms.py -

- urls.py -
url(r'^accounts/register/$', register, { # Overwrite registration url
'backend': 'registration.backends.default.DefaultBackend',
'form_class': RecaptchaRegistrationForm,
}, name='registration_register'),

url(r'^accounts/', include('registration.backends.default.urls')),
- urls.py -

- registration_form.html -
{% extends "base.html" %}
{% block title %}Register for an account{% endblock %}
{% block container %}


{% csrf_token %}
{{ form }}




{% endblock %}
- registration_form.html -

- rendered code -

name='csrfmiddlewaretoken' value='blablaq' />
Username:class="required" id="id_username" maxlength="30" name="username" 
type="text" />
E-mail:class="required" id="id_email" maxlength="75" name="email" type="text" 
/>
Password:class="required" id="id_password1" name="password1" type="password" 
/>
Password 
(again):name="password2" type="password" />
for="id_recaptcha">Recaptcha:type="text/javascript">
var DjangoRecaptchaOptions = {
  "lang": "en"
};
if (typeof RecaptchaOptions !== 'object') {
RecaptchaOptions = DjangoRecaptchaOptions;
} else {
for (key in DjangoRecaptchaOptions) {
RecaptchaOptions[key] = DjangoRecaptchaOptions[key];
}
}

src="http://www.google.com/recaptcha/api/challenge?k=6blablaC&hl=en";>


  src="http://www.google.com/recaptcha/api/noscript?k=6blablaC&hl=en"; 
height="300" width="500" frameborder="0">

  
  value='manual_challenge' />






- rendered code -


The Exact version I am using are:
Django==1.5
django-recaptcha==0.0.6
django-registration==0.8
recaptcha-client==1.0.6


[1] - https://github.com/praekelt/django-recaptcha

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

On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee  wrote:

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

Thank you Russ, you've saved my day ! :)




-- 
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: Django inline formsets, force initial data to be saved.

On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee  wrote:

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

Jops, just tried

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

but I'm getting an AttributeError "'list' object has no attribute 'get'"
when i'm rendering the form.

http://dpaste.com/1013099/

What i've missed ?
Thanks again !




-- 
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: django-recaptcha validation problems


Hi,

Sniffing the connection, it connects to google but then always is 
sending a new captcha., how can I check if it is validating properly?


Thanks,
Xavi
On 03/05/2013 04:34 PM, Xavier Pegenaute wrote:

Hi,

I am using django-recaptcha and I want to use it inside the 
registration form. In the website [1], inside the Field section says: 
"A ReCaptcha widget will be rendered with the field validating itself 
without any further action required from you". Actually seems is not 
validating anything. Anyone had similar experience?


Thanks.
- forms.py -
from registration.forms import RegistrationFormUniqueEmail
from captcha.fields import ReCaptchaField

class RecaptchaRegistrationForm(RegistrationFormUniqueEmail):
recaptcha = ReCaptchaField()
- forms.py -

- urls.py -
url(r'^accounts/register/$', register, { # Overwrite registration url
'backend': 'registration.backends.default.DefaultBackend',
'form_class': RecaptchaRegistrationForm,
}, name='registration_register'),

url(r'^accounts/', include('registration.backends.default.urls')),
- urls.py -

- registration_form.html -
{% extends "base.html" %}
{% block title %}Register for an account{% endblock %}
{% block container %}


{% csrf_token %}
{{ form }}




{% endblock %}
- registration_form.html -

- rendered code -

name='csrfmiddlewaretoken' value='blablaq' />
Username:class="required" id="id_username" maxlength="30" name="username" 
type="text" />
E-mail:class="required" id="id_email" maxlength="75" name="email" type="text" 
/>
Password:class="required" id="id_password1" name="password1" type="password" 
/>
Password 
(again):name="password2" type="password" />
for="id_recaptcha">Recaptcha:type="text/javascript">
var DjangoRecaptchaOptions = {
  "lang": "en"
};
if (typeof RecaptchaOptions !== 'object') {
RecaptchaOptions = DjangoRecaptchaOptions;
} else {
for (key in DjangoRecaptchaOptions) {
RecaptchaOptions[key] = DjangoRecaptchaOptions[key];
}
}

src="http://www.google.com/recaptcha/api/challenge?k=6blablaC&hl=en";>


  src="http://www.google.com/recaptcha/api/noscript?k=6blablaC&hl=en"; 
height="300" width="500" frameborder="0">
  cols="40">
  value='manual_challenge' />






- rendered code -


The Exact version I am using are:
Django==1.5
django-recaptcha==0.0.6
django-registration==0.8
recaptcha-client==1.0.6


[1] - https://github.com/praekelt/django-recaptcha
--
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: raw_id_fields

I have the same problem, I want to show the real name instead the id.

Do you solve it?

Thank you very much

El miércoles, 30 de enero de 2013 17:20:06 UTC+1, rdollinger escribió:
>
> Hi everybody,
>
> I have a m2m relation where in my AdminForm I would use raw_id_fields instead 
> of the filter_horizontal option. For explanation I prefer the 
> raw_id_fields instead of the filter_horizontal option, because there 
> records are already categorized. So in the popup-window the user has the 
> ability to search and filter via category. 
> But there are two points that I can't figure out:
>
> - possibility to selecting more than one record in the popup window
> - showing the real names instead of the pk in the input_field
>
> Thanks in advanced for help
>
> bye
> Robert
>

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

I have the same problem, I want to show the real name instead the id.

Do you solve it?

Thank you very much

El miércoles, 30 de enero de 2013 17:20:06 UTC+1, rdollinger escribió:
>
> Hi everybody,
>
> I have a m2m relation where in my AdminForm I would use raw_id_fields instead 
> of the filter_horizontal option. For explanation I prefer the 
> raw_id_fields instead of the filter_horizontal option, because there 
> records are already categorized. So in the popup-window the user has the 
> ability to search and filter via category. 
> But there are two points that I can't figure out:
>
> - possibility to selecting more than one record in the popup window
> - showing the real names instead of the pk in the input_field
>
> Thanks in advanced for help
>
> bye
> Robert
>

-- 
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: A generic 'search' framework for forms?

Maybe this Django app can help you
http://haystacksearch.org/

It's basically a wrapper abobe a search backend.
I'd also like to recomend you http://www.elasticsearch.org/

Hope helps,
cheers.




On Tuesday, March 5, 2013 11:41:13 AM UTC-3, Subodh Nijsure wrote:
>
> I have lot of forms in my django application and would like to present 
> a generic way for end user to do search query, is there a package out 
> there that allows one to construct such a thing? 
>
> Example I have a form that shows customers it has fields like 
> customer_name, customer_address , I have another form that shows 
> technicians information such as first_name, last_name, location. 
>
> I would like to add a "widget" at top of the customer form so that end 
> user can say, I want to search by name, type search string and all 
> entries that match that search string will show up. Same for 
> technician form I want them to be able to pick they want to search by 
> first_name or last_name and type the search string to narrow the 
> listing. 
>
> Thanks 
> -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: How to pass a value from a Django View to a JQuery Slider bar.

Well, I definitly can't just throw a variable into the Javascript using the 
{{ }} tags. I tried it and it didn't work. I'm sure Shawn Milochik is 
correct about consuming the view with AJAX, however that is going to take 
sometime to learn and explore, as I am novice at this. It seems there 
should be an easy way for something so simple, I can pass a variable from a 
view to a template, but not from a view to a javascript file.

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

You could use some small 

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

On Tue, Mar 5, 2013 at 4:57 PM,  <7equivale...@gmail.com> wrote:
> Well, I definitly can't just throw a variable into the Javascript using the
> {{ }} tags. I tried it and it didn't work. I'm sure Shawn Milochik is
> correct about consuming the view with AJAX, however that is going to take
> sometime to learn and explore, as I am novice at this. It seems there should
> be an easy way for something so simple, I can pass a variable from a view to
> a template, but not from a view to a javascript file.
>

This is not true. You can render your javascript using a template if
you like, templates can be used to generate any textual format. A view
is simply a function that takes a request and produces a single
resource as a response.

However people don't normally dynamically generate their JS. This is
because it is not necessary, you simply include the data you want into
the HTML that the javascript will run against. You then use standard
JS methods to extract the data that you need and use it.

Eg, if you wanted to trigger an AJAX request each time someone clicked
a , you might do something like this:


  Hello World
  Wibble


Your JS file may have something like this:

$('ul li').click(function(ev) {
  $.getJSON( '{{ some-url }}', json_handler);
}

Obviously the "{{ some-url }}" would not work. Instead, the data can
be inserted in to the HTML element to which it refers:


  Hello World
  Wibble


and now the JS can be written to query that data:

$('ul li').click(function(ev) {
  $.getJSON(ev.target.data('json-uri'), json_handler);
}

tl;dr - if you need data in your javascript files, insert it into the
HTML doc and extract it when you need it.

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.




Splicing geometry by bounding box

Hey I am currently working on a geolocation based game that utilizes a 
geodjango application to manage querying, parsing, and server geographical 
data to our client. We are currently using PostGIS to store our OSM data. 
We are using the OSM tilename system throughout our project and some of our 
geometry spans across many tiles. I would like to reduce specific tile 
payloads by reducing the geometry as much as possible.

Ideally I would like to "splice" polygons & multipolygons by a bounding 
box, any suggestions?

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

On Tue, Mar 5, 2013 at 4:43 PM, Marc Aymerich  wrote:

>
>
> On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>>
>>
>> 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.
>>
>
> Jops, just tried
>
>
> class DirectIfaceInlineFormSet(BaseInlineFormSet):
> def __init__(self, *args, **kwargs):
> kwargs['data'] = [{ 'name': 'eth1', }, {'name': 'eth2'},]
> super(DirectIfaceInlineFormSet, self).__init__(*args, **kwargs)
>
> but I'm getting an AttributeError "'list' object has no attribute 'get'"
> when i'm rendering the form.
>


yeah, finally I did something like

class DirectIfaceInlineFormSet(BaseInlineFormSet):
def __init__(self, *args, **kwargs):
if not kwargs['instance'].pk:
kwargs['data'] = {
'direct_ifaces-TOTAL_FORMS': u'3',
'direct_ifaces-INITIAL_FORMS': u'0',
'direct_ifaces-MAX_NUM_FORMS': u'',
'direct_ifaces-0-name': u'eth0',
'direct_ifaces-1-name': u'eth1',
'direct_ifaces-2-name': u'eth2',}
else:
self.extra = 1
super(DirectIfaceInlineFormSet, self).__init__(*args, **kwargs)

that it works :)




-- 
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: How to pass a value from a Django View to a JQuery Slider bar.

Alright guys, thanks for the input, I need something a bit more specific to 
my case due to my ignorance on the subject at hand, so I am posting the 
code for my View, Template, and JQuery.  So, basically I want to take the 
slider1 object value in the View, and place it in the Javascript where 
value = 37 has been coded. 

// Here is my view 
//
def slider_page(request):
  
  slider1 = Slider.objects.get(sliderID=1)
  variables = RequestContext(request, {'slider1': slider1})
  return render_to_response('slider_page.html', variables)
  
/ Here is my Template 
// 
 
{% block external %}
  
{% endblock %}
  
{% block content %} 
  
  
Intensity:

   
  
  
{% endblock %}

// Here is my JQuery 
//

  $(function (){
$( "#slider_1" ).slider({
  range: "min",
  value: 37,
  min: 0,
  max: 100,
  slide: function( event, ui ) {
$( "#power" ).val(ui.value );
  }
});
$( "#power" ).val($( "#slider_1" ).slider( "value" ) );
return false;
  });

-- 
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: Request for comments on a new Open Source Paas platform for Django



On Tuesday, 5 March 2013 13:35:41 UTC, Dave Murphy wrote:
>
> On Tuesday, March 5, 2013 1:17:13 PM UTC, Michael wrote:
>>
>> Are there other better options that wouldn't force people to change their 
>> code to use the charm?
>>
>
> For the charm to be of sufficient value, it needs to be opinionated, 
> otherwise it's going to suffer from trying to work out-of-the-box for 
> everyone.
>

True but using environment variables only moves the problem somewhere else: 
it means that you still need to auto-generate the part of the startup 
script that sets the environment variables. Besides, as said above, it 
would force django app developers to explicitly use those environment 
variables and if they forget one of misspell it, the danger is that it 
would fail silently. Then the risk is that it's hard to debug because 
you're hunting setting values in two places: the django settings and the 
startup scripts that sets the environment variables.

So I'd much rather have the charm auto-generate part of the config in a 
sensible way and then tell people: if you use Juju, don't provide those 
settings in your config, the charm will do it.

Bruno

-- 
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 want to check for new orders in the background?

I got this working using signals

On Tuesday, March 5, 2013 9:28:31 AM UTC-5, frocco wrote:
>
> I tried your link https://github.com/pinax/django-notification
> but it is not working.
>
> is there anything wrong with my code to prevent the signal from working?
>
> On Tuesday, March 5, 2013 9:18:04 AM UTC-5, Jaimin Patel wrote:
>>
>> Take a look at django-notifications app - 
>> https://github.com/pinax/django-notification
>>
>> I think it should be able to help you.
>>
>> you can check the example of it on this SO thread - 
>> http://stackoverflow.com/questions/1609775/how-do-i-display-notifications-from-django-notification
>>
>> On Tuesday, March 5, 2013 8:38:14 AM UTC-5, frocco wrote:
>>>
>>> Hello,
>>>
>>> I want to query the orders database every 5 minutes and alert admins 
>>> that new orders have arrived.
>>> Would I use signals for this?
>>>
>>> Anyone have an example?
>>>
>>> Thank you
>>>
>>

-- 
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: Request for comments on a new Open Source Paas platform for Django

For what it's worth, "other PaaS solutions" solve this by letting people
call a python function from settings.py

I think it's a good solution.
On Mar 5, 2013 8:04 PM, "Bruno Girin"  wrote:

>
>
> On Tuesday, 5 March 2013 13:35:41 UTC, Dave Murphy wrote:
>>
>> On Tuesday, March 5, 2013 1:17:13 PM UTC, Michael wrote:
>>>
>>> Are there other better options that wouldn't force people to change
>>> their code to use the charm?
>>>
>>
>> For the charm to be of sufficient value, it needs to be opinionated,
>> otherwise it's going to suffer from trying to work out-of-the-box for
>> everyone.
>>
>
> True but using environment variables only moves the problem somewhere
> else: it means that you still need to auto-generate the part of the startup
> script that sets the environment variables. Besides, as said above, it
> would force django app developers to explicitly use those environment
> variables and if they forget one of misspell it, the danger is that it
> would fail silently. Then the risk is that it's hard to debug because
> you're hunting setting values in two places: the django settings and the
> startup scripts that sets the environment variables.
>
> So I'd much rather have the charm auto-generate part of the config in a
> sensible way and then tell people: if you use Juju, don't provide those
> settings in your config, the charm will do it.
>
> Bruno
>
> --
> 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/979lJojyxs0/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.
>
>
>

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

On Mon, Mar 4, 2013 at 12:01 PM, Bill Freeman  wrote:

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


I am making a generic view for showing a list of objects of the same kind,
the view takes the list of objects and a tuple with the attributes to be
shown.
Python/django fits my requirements but I am looking the most efficient way
to do it. The inner loop is expensive.

Regards

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




Re: Request for comments on a new Open Source Paas platform for Django

On Tuesday, March 5, 2013 7:03:36 PM UTC, Bruno Girin wrote:
>
> So I'd much rather have the charm auto-generate part of the config in a 
> sensible way and then tell people: if you use Juju, don't provide those 
> settings in your config, the charm will do it.
>

...and if they do? How is this any different to the code not handling 
environment variables correctly?

People are going to need to adapt their project to the charm no matter what 
approach you take.

-- 
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: Request for comments on a new Open Source Paas platform for Django



On Tuesday, March 5, 2013 7:56:37 PM UTC, Dave Murphy wrote:
>
> On Tuesday, March 5, 2013 7:03:36 PM UTC, Bruno Girin wrote:
>>
>> So I'd much rather have the charm auto-generate part of the config in a 
>> sensible way and then tell people: if you use Juju, don't provide those 
>> settings in your config, the charm will do it.
>>
>
> ...and if they do? How is this any different to the code not handling 
> environment variables correctly?
>
> People are going to need to adapt their project to the charm no matter 
> what approach you take.
>

True. My point here is that if you ask people to adapt their project to 
work in Juju, it's easier for them and less error prone to say "don't 
provide this bit" than say "provide this bit in this particular way".

I quite like Christopher's suggestion of calling a python function from 
settings.py too. 

-- 
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 payment gateway with subscription management

Hello,

We are evaluating different payment gateways for subscription management 
for one of the app which requires the subscription based model (monthly, 6 
months, year). 

I checked different packages available here 
- https://www.djangopackages.com/grids/g/payment-processing/

Though I am confuse which one I should be using, can someone recommend 
which one is actively maintained and most commonly used for subscription 
based model where users can signup for free and if they want they can 
subscribe later on. We don't required to store the credit card details and 
it can be taken care by the payment gateway.

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: Django payment gateway with subscription management

Stripe if you're in the us (am not sure which other countries they've
rolled out to).


On Tue, Mar 5, 2013 at 3:34 PM, Jaimin Patel  wrote:

> Hello,
>
> We are evaluating different payment gateways for subscription management
> for one of the app which requires the subscription based model (monthly, 6
> months, year).
>
> I checked different packages available here -
> https://www.djangopackages.com/grids/g/payment-processing/
>
> Though I am confuse which one I should be using, can someone recommend
> which one is actively maintained and most commonly used for subscription
> based model where users can signup for free and if they want they can
> subscribe later on. We don't required to store the credit card details and
> it can be taken care by the payment gateway.
>
> 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.
>
>
>



-- 
Mayukh Mukherjee
http://www.linkedin.com/in/mayukhmmukherjee

-- 
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 payment gateway with subscription management

Yes, we are USA based and I come across stripe. It seems very developer 
friendly. Is there any example on setting up recurring payments using 
stripe?

On Tuesday, March 5, 2013 3:47:06 PM UTC-5, Mayukh Mukherjee wrote:
>
> Stripe if you're in the us (am not sure which other countries they've 
> rolled out to). 
>
>
> On Tue, Mar 5, 2013 at 3:34 PM, Jaimin Patel 
> > wrote:
>
>> Hello,
>>
>> We are evaluating different payment gateways for subscription management 
>> for one of the app which requires the subscription based model (monthly, 6 
>> months, year). 
>>
>> I checked different packages available here - 
>> https://www.djangopackages.com/grids/g/payment-processing/
>>
>> Though I am confuse which one I should be using, can someone recommend 
>> which one is actively maintained and most commonly used for subscription 
>> based model where users can signup for free and if they want they can 
>> subscribe later on. We don't required to store the credit card details and 
>> it can be taken care by the payment gateway.
>>
>> 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.
>>  
>>  
>>
>
>
>
> -- 
> Mayukh Mukherjee
> http://www.linkedin.com/in/mayukhmmukherjee
>
>
>  

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




Extending the base file depending on User type

I want to extend the base template file into the child file depending
on the condition, like if the user is superuser or staff or active
user, the file to extended should ll be different.
For Eg :

{% if user.is_superuser %}
{% extends "base.html" %}
{% else if user.is_active %}
{% extends "base_client.html" %}
{% else %}
{% extends "base_noclient.html" %}


However this code doesn't work.
What should be done. Your help will be highly appreciated.
Thank you.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.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.




Re: Extending the base file depending on User type

Instead of extends, you could use the "include" directive.

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




Setting Django to not quote table names

Hello Django Users,

I have an app that uses Oracle and cx_Oracle for the db, and I've made the 
models from an existing schema with inspectdb.

The database schema also contains a number of sub-schemas, so they must be 
accessed with schema dot table name.  Looking at the SQL used for model 
access, I believe Django's automatic quoting of table names in the SQL is 
causing issues with table name lookup.

I can verify using cursor.execute in the shell, that if I leave off the 
quotes, the queries work fine.  Is there an easy way to disable table name 
quoting? (or other facility that gets around this? )

Cheers,
Steve

[snip]
  File 
"/home/sgithens/Envs/komen-django2/local/lib/python2.7/site-packages/django/db/backends/oracle/base.py",
 
line 717, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), 
sys.exc_info()[2])
  File 
"/home/sgithens/Envs/komen-django2/local/lib/python2.7/site-packages/django/db/backends/oracle/base.py",
 
line 710, in execute
return self.cursor.execute(query, self._param_generator(params))
DatabaseError: ORA-00942: table or view does not exist

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




models i18n

Hi guys,

I am developing a django application and between my requirements there
is being able to set the model fields into different languages.

For example:

class Employee(models.Model):
position = models.CharField()
# etc.

The employee position won't be the same in English and Spanish. Ideally,
when an user fills in the data for an employee using the admin, there
will be one tab for each language defined in the settings file.

Do you have any suggestion about how to deal with this issue?

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: Setting Django to not quote table names

I'm taking a look at this as someone pretty unfamiliar with the ORM.
Hopefully someone more knowledgeable will jump in.

However, in the meantime (if you're feeling adventurous), you could
look in django/db/backends/oracle/base.py and have a look at function
quote_name. A naive look at it makes me think you could just put
"return name" at the top and short-circuit it. Ideally we could find
an easy way to override it in a custom manager that you can use in
your models, but first let me know if a manual change to that file
causes the behavior you want.

No warranty! ^_^

-- 
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: models i18n


On Mar 5, 2013, at 10:31 PM, Roberto López López  wrote:

> Hi guys,
> 
> I am developing a django application and between my requirements there
> is being able to set the model fields into different languages.
> 
> For example:
> 
> class Employee(models.Model):
>position = models.CharField()
># etc.
> 
> The employee position won't be the same in English and Spanish. Ideally,
> when an user fills in the data for an employee using the admin, there
> will be one tab for each language defined in the settings file.
> 
> Do you have any suggestion about how to deal with this issue?

Django-modeltranslation: https://github.com/deschler/django-modeltranslation

Very nice and easy, I use it all the time, works like a charm. You can do the 
tabs with some custom CSS and JS in the Admin through a Media class like this:

class Media:
js = (
'modeltranslation/js/force_jquery.js',

'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js',
'modeltranslation/js/tabbed_translation_fields.js',
)
css = {
'screen': ('modeltranslation/css/tabbed_translation_fields.css',),
}

Johan

> 
> 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: Impossible? Django with NTLM SSO auth on windows?

Hmmm

the bad support (as you mention "it hasn't been updated in quite some time")
seems to be a major problem in this domain.

I just looked at (for apache)
http://mod-auth-sspi.sourceforge.net/docu/mod_ntlm/

Here they say mod_ntlm is obsolete and 
" mod_auth_sspi is the version of mod_ntlm for Apache-2.0"

but on the other side mod_auth_sspi seems to be dead too,
so actually I am still not sure if its possible,
if you don't want to use pure Microsoft technologies 
(like asp.net IIS server & other tools from ms)

I am looking ..

Bye

 anton


Andre Terra wrote:

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

Re: Setting Django to not quote table names

Hi Shawn!

Thanks for the clue.  I commented out the following in oracle/base.py 
DatabaseOperations.quote_name and can get some tables showing up in the 
admin view now. ( More issues of course, but I believe them to be separate. 
)

# if not name.startswith('"') and not name.endswith('"'):
# name = '"%s"' % util.truncate_name(name.upper(),
#self.max_name_length())

I'm guessing this may not be the final best way to work around it, but I 
can keep prototyping and hacking my app now.  Hopefully someone ORM 
experienced will chip in.

Until then, thanks much!  :)

Steve

On Tuesday, March 5, 2013 4:32:44 PM UTC-5, Shawn Milochik wrote:
>
> I'm taking a look at this as someone pretty unfamiliar with the ORM. 
> Hopefully someone more knowledgeable will jump in. 
>
> However, in the meantime (if you're feeling adventurous), you could 
> look in django/db/backends/oracle/base.py and have a look at function 
> quote_name. A naive look at it makes me think you could just put 
> "return name" at the top and short-circuit it. Ideally we could find 
> an easy way to override it in a custom manager that you can use in 
> your models, but first let me know if a manual change to that file 
> causes the behavior you want. 
>
> No warranty! ^_^ 
>

-- 
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: Setting Django to not quote table names

This works for me in Postgres as well. This script:

from django.contrib.auth.models import User
qs = User.objects.filter(username='smilochik')
print qs.query.sql_with_params()

returns this output:
('SELECT "auth_user"."id", "auth_user"."username",
"auth_user"."first_name", "auth_user"."last_name",
"auth_user"."email", "auth_user"."password", "auth_user"."is_staff",
"auth_user"."is_active", "auth_user"."is_superuser",
"auth_user"."last_login", "auth_user"."date_joined" FROM "auth_user"
WHERE "auth_user"."username" = %s ', ('smilochik',))

If I go into django/db/backends/postgresql_psycopg2/operations.py (I'm
using Postgres, not Oracle), and just have quote_name "return name"
then I get this:

('SELECT auth_user.id, auth_user.username, auth_user.first_name,
auth_user.last_name, auth_user.email, auth_user.password,
auth_user.is_staff, auth_user.is_active, auth_user.is_superuser,
auth_user.last_login, auth_user.date_joined FROM auth_user WHERE
auth_user.username = %s ', ('smilochik',))

I don't know if it's safe to do this. I'm assuming that, as long as
there are no spaces in your table or field names, it should work.

I did try to trace from the class containing this quote to the actual
database connection (from both directions), but I don't see how it can
be cleanly overridden. I think the modification you made is probably
the best bet. I would definitely like to hear what an ORM expert would
say.

-- 
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: Setting Django to not quote table names

Not an Oracle expert at all but maybe this SO answer explains some things?:

http://stackoverflow.com/questions/563090/oracle-what-exactly-do-quotation-marks-around-the-table-name-do


On Mar 5, 2013, at 11:12 PM, Shawn Milochik  wrote:

> This works for me in Postgres as well. This script:
> 
> from django.contrib.auth.models import User
> qs = User.objects.filter(username='smilochik')
> print qs.query.sql_with_params()
> 
> returns this output:
> ('SELECT "auth_user"."id", "auth_user"."username",
> "auth_user"."first_name", "auth_user"."last_name",
> "auth_user"."email", "auth_user"."password", "auth_user"."is_staff",
> "auth_user"."is_active", "auth_user"."is_superuser",
> "auth_user"."last_login", "auth_user"."date_joined" FROM "auth_user"
> WHERE "auth_user"."username" = %s ', ('smilochik',))
> 
> If I go into django/db/backends/postgresql_psycopg2/operations.py (I'm
> using Postgres, not Oracle), and just have quote_name "return name"
> then I get this:
> 
> ('SELECT auth_user.id, auth_user.username, auth_user.first_name,
> auth_user.last_name, auth_user.email, auth_user.password,
> auth_user.is_staff, auth_user.is_active, auth_user.is_superuser,
> auth_user.last_login, auth_user.date_joined FROM auth_user WHERE
> auth_user.username = %s ', ('smilochik',))
> 
> I don't know if it's safe to do this. I'm assuming that, as long as
> there are no spaces in your table or field names, it should work.
> 
> I did try to trace from the class containing this quote to the actual
> database connection (from both directions), but I don't see how it can
> be cleanly overridden. I think the modification you made is probably
> the best bet. I would definitely like to hear what an ORM expert would
> say.
> 
> -- 
> 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: Setting Django to not quote table names

On Tue, Mar 5, 2013 at 5:41 PM, Johan ter Beest  wrote:
> Not an Oracle expert at all but maybe this SO answer explains some things?:
>
> http://stackoverflow.com/questions/563090/oracle-what-exactly-do-quotation-marks-around-the-table-name-do
>

So if it's down to case-sensitivity then everything should be fine,
because all the queries are generated by the ORM and aren't going to
mix case.

Especially if the database was created with syncdb and not inspectdb,
because then everything should be formatted the same.

It would be nice if some stuff in Django was easier to override. I'm
reminded of this thought-provoking blog post by the author of Flask,
werkzeug, and Jinja2:
http://lucumr.pocoo.org/2013/2/13/moar-classes/

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




q: Account activation page

Dear All ...

I need something like django-registration, but currently my app use 2 
different completely seperated user tables :
1. The default auth.user
2. myproj.user table

The first table will only used for server administration, and the actual 
day-to-day operation will based on that myproj.user table.

Currently my app able to add user, send email .. but the is_active field 
still default 'true' since I don't have any account_activation solution 
that suite my need.

My question is, how to build a form-page (url, form, view etc etc) that 
will :
1. view a form with single field, let's call it act_key

2. when submit, will search on myproj.user for that act_key, and :
2.a if found set the is_active to True, send the user to my existing login 
page at http://localhost/loginhere
2.b if not found , re-display the form with clear data and warning

3. accessible by any one (no login required)

Sincerely
-bino-

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




reverse foreign key relationship usage

Hello all,

In Appendix B:Database API, it says "related_name (keyword) is particularly 
useful if a model has two foreign keys to the same second model." which is 
about 'related_name' keyword used reverse foreign key relationships. 
e.g. blog = ForeignKey(Blog, related_name='entries').

What does it mean? Where should I use related_name instead of simply 
reversing by "x_set" keyword.

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.