[no subject]

2012-02-29 Thread pp do
http://itsrealworld.com/wp-content/plugins/podpress/optional_files/wp1.5_2.0/wp-admin/grtkds.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



subprocess

2012-02-29 Thread dummyman dummyman
Hi ,

i am using django  s view function to invoke py*thon script* to run in
background.
now i want to pass command line args to the script

here is wat i did

subprocess.Popen([sys.executable,"script_name","command_args1"])

i got the error

execv requires arg 2 to be a string

please help me

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



view the code in .vmdk .vmx files

2012-02-29 Thread kalyani ram
I am now migrating from one version to another. the vendors have given
my just 3 files with .vmdk and .vmx extension. however i installed
vmware and finished the setup though, i wanted to view the code of my
new version. any idea how to view the code of the product in vmware?
Thanks in advance.





Regards,
Kalyani

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Tabularinline in CreateView ?????????????

2012-02-29 Thread Lestak
Hi all:

My ask is here: http://dpaste.com/709735/

Thanks...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Filtering model searches by a property (as opposed to a field)

2012-02-29 Thread Tom
Thank you very much for that Javier.

After flailing around with raw SQL for a while I realised that Django
has conveniently provided a powerful set of field lookups that I did
not know about.

I have ended up doing this, which is a million times simpler than what
I was previously attempting:


...
date = datetime.date.today()
day_of_the_week = date.weekday()
last_date_in_week = date + datetime.timedelta(days = 7 -
day_of_the_week)
week = Todo.objects.filter(owner__id =
user.id).filter(due_date__lte=last_date_in_week).filter(due_date__gt=date)
...


This gives me 'todo' objects from tomorrow until the end of the week,
which is what I want.

On Mar 1, 3:35 am, Javier Guerra Giraldez  wrote:
> On Wed, Feb 29, 2012 at 3:16 PM, Tom  wrote:
> > Is it not possible to filter based on a property?
>
> queries are compiled to SQL to be sent and processed at the database;
> properties are Python code, the database knows nothing about them.
> that's why the compiler only allows you to use database fields on a
> filter
>
> > What is the correct method for doing this?
>
> the generic answer is to do it in Python, something like:
>
> result = [ record in queryset if record.property == value ]
>
> but this can be very inefficient, and nowhere as flexible as Django's 
> querysets.
>
> much better is to translate the criteria into something the database
> can process.  In this case, find the beginning and end of the current
> week and use a range filter.
>
> --
> Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Filtering model searches by a property (as opposed to a field)

2012-02-29 Thread Javier Guerra Giraldez
On Wed, Feb 29, 2012 at 3:16 PM, Tom  wrote:
> Is it not possible to filter based on a property?

queries are compiled to SQL to be sent and processed at the database;
properties are Python code, the database knows nothing about them.
that's why the compiler only allows you to use database fields on a
filter


> What is the correct method for doing this?

the generic answer is to do it in Python, something like:

result = [ record in queryset if record.property == value ]

but this can be very inefficient, and nowhere as flexible as Django's querysets.

much better is to translate the criteria into something the database
can process.  In this case, find the beginning and end of the current
week and use a range filter.


-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: using django templates to generate and replace a file

2012-02-29 Thread Kurtis Mullins
Hey,

I just thought I'd give you a quick reply. First, you can save the rendered
output of a template using this:

https://docs.djangoproject.com/en/1.3/ref/templates/api/#rendering-a-context

Then, take that String and write over that 'users.cfg' file. For example,

http://docs.python.org/tutorial/inputoutput.html

Hopefully that helps a little bit. I'm not sure if I understand the problem
right but I figured I'd give it a shot.

Good luck!
- Kurtis

On Wed, Feb 29, 2012 at 4:27 PM, Paul Bunker wrote:

> Hi Django Users,
>
> I'd like to use the django template system to generate a file
> 'users.cfg' that gets read some dispatching software. Is it possible
> to get django  to generate this file and replace the existing one?
>
> Thanks
> -Paul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Keeping filters when adding in the admin interface

2012-02-29 Thread Marc Aymerich
On Wed, Feb 29, 2012 at 10:55 PM, Marc Aymerich  wrote:
> On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez  wrote:
>> Hello, if I have the following Model:
>>
>> class A:
>>    name
>>
>> class B:
>>    name
>>    a = models.ForeignKey(A)
>>
>> class C:
>>    name
>>    b = models.ForeignKey(B)
>>
>> And let's suppose that in the Admin Site I have a Filter in the C list
>> that refers to the A model. Is there a way to keep that filter when I
>> am going to add a new C object and use it to filter the combobox of
>> the b filed so that it will only show the b objects that are related
>> to the A model in the filter?
>> For example:
>> If the filter I choose points to the id=1 in the A model, the combobox
>> for the b field when I add a C object only has to show the B objects
>> that has a = 1
>>
>
> If I understand you righ, it's a bit triky stuff, you have to do two things:
> 1)  Define a custom add_form and override their __init__ method with
> something like:
>  self.fields['b'].queryset = self.fields['b'].queryset.filter(a=a_pk)
> 2)  Provides the current value of your filter (a_pk) to the defined form on 1)
>  I think this can be done overriding modeladmin.get_form() method
> since request is one of their args, so you can extract the value of
> the filter on the http referer url and provide it to the form that
> this method creates.
>

More specifically:

def get_form(self, request, *args **kwargs):
form = super(YourModelAdmin, self).get_form(request, *args, **kwargs)
a_pk = get_a_pk_from_http_referer(request)
form.a_pk = a_pk
return form

def __init__(self, *args, **kwargs):
   super(YourModelForm, self).__init__(*args, **kwargs)
   self.fields['b'].queryset = self.fields['b'].queryset.filter(a=self.a_pk)

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Daniel Roseman
On Wednesday, 29 February 2012 20:03:21 UTC, Django_for_SB wrote:
>
> Hi Anoop,
>
> Thank you for the kind reply, I've tried that already. Here are the 3 
> variations that I've attempted so far within settings.py in TEMPLATE_DIRS:
>
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/index.html'
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/'
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/'
>
>
> They all yield the same error unfortunately. I'm coding this on a Windows 
> Vista system, fyi.
>
> Best,
>
> SB
>
> On Wed, Feb 29, 2012 at 11:48 AM, Anoop Thomas Mathew wrote:
>
>> You have to give template directories, not template names in the 
>> settings.py.
>> Thanks,
>> Anoop
>> atm
>> ___
>> Life is short, Live it hard.
>>
>>
You also need to separate the different strings with commas. Otherwise 
Python will automatically concatenate them, as they are within parentheses.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mDeB71nwRSUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Keeping filters when adding in the admin interface

2012-02-29 Thread Marc Aymerich
On Wed, Feb 29, 2012 at 8:22 PM, Mauro Sánchez  wrote:
> Hello, if I have the following Model:
>
> class A:
>    name
>
> class B:
>    name
>    a = models.ForeignKey(A)
>
> class C:
>    name
>    b = models.ForeignKey(B)
>
> And let's suppose that in the Admin Site I have a Filter in the C list
> that refers to the A model. Is there a way to keep that filter when I
> am going to add a new C object and use it to filter the combobox of
> the b filed so that it will only show the b objects that are related
> to the A model in the filter?
> For example:
> If the filter I choose points to the id=1 in the A model, the combobox
> for the b field when I add a C object only has to show the B objects
> that has a = 1
>

If I understand you righ, it's a bit triky stuff, you have to do two things:
1)  Define a custom add_form and override their __init__ method with
something like:
 self.fields['b'].queryset = self.fields['b'].queryset.filter(a=a_pk)
2)  Provides the current value of your filter (a_pk) to the defined form on 1)
 I think this can be done overriding modeladmin.get_form() method
since request is one of their args, so you can extract the value of
the filter on the http referer url and provide it to the form that
this method creates.


-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unicode lists and form submissions

2012-02-29 Thread Mario Gudelj
Found an answer here
http://stackoverflow.com/questions/9210117/attributeerror-str-object-has-no-attribute-n-when-using-dateutil

Thanks guys.

On 1 March 2012 00:30, Mario Gudelj  wrote:

> Hi djangoers,
>
> I've ran into an issue I'm not sure how to handle.
>
> I have a form with 7 checkboxes representing 7 days of the week. I want to
> collect the submitted days and use them in rrule to generate some dates.
>
> The form field looks like this:
>
> weekly_interval = forms.MultipleChoiceField(label='Repeat on:',
> choices=EventSeries.weekly_interval,widget=forms.CheckboxSelectMultiple,
> required=False)
>
> The choices are generated from this:
>
> weekly_interval = (
> (rrule.SU, 'Sun'),
> (rrule.MO, 'Mon'),
> (rrule.TU, 'Tue'),
> (rrule.WE, 'Wed'),
> (rrule.TH, 'Thu'),
> (rrule.FR, 'Fri'),
> (rrule.SA, 'Sat')
> )
>
> So, the form renders and everything is fine, but once I submit the form,
> the data is in incorrect format and I'm not sure how to fix it.
>
> This is how I'm collecting the interval:
>
> interval=form.cleaned_data['weekly_interval']
>
> Then I'm using it in this line:
>
> start_dates = list(rrule.rrule(rrule.WEEKLY, count=self.recurrences,
> byweekday=self.interval, dtstart=self.start_datetime))
>
> My problem is in this byweekday=self.interval
>
> If I test this form console with the following it works fine
>
> start_dates = list(rrule.rrule(rrule.WEEKLY, count=a_s.recurrences,
> byweekday=(rrule.MO,rrule.TU), dtstart=appt.start_time))
>
> But when I look at the interval submitted from the form using pdb it looks
> like this [u'WE', u'TH', u'SA']
>
> I suspect that I need to convert this from unicode to objects. Does anyone
> know the best approach? And what it would be?
>
> Thanks a million!
>
> -m
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



using django templates to generate and replace a file

2012-02-29 Thread Paul Bunker
Hi Django Users,

I'd like to use the django template system to generate a file
'users.cfg' that gets read some dispatching software. Is it possible
to get django  to generate this file and replace the existing one?

Thanks
-Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



jython django install - django import error

2012-02-29 Thread andzsinszan
Hi,
I have problems installing django for jyhton.
I followed instructions on the django / django-jython site, but can't
import django from jython.

Jython 2.5.3b1
django_jython-1.3.0b2

### INSTALLATION
# after
#  - installing jython
#  - adding JYTHON_DIR/bin to path:
> jython pip install django-jython

...installs fine


### USE
> jython
Jython 2.5.3b1 (2.5:5fa0a5810b25, Feb 22 2012, 12:39:02)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.

>>> import doj
>>> import django
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named django

***
importing 'doj' works fine though. But there is no 'django'.
I tried to put pyhon's django to JYTHONPATH:
/usr/local/lib/python2.7/dist-packages/django

Still no luck.

Do I miss something?
Otherwise django on python seems to work fine.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Filtering model searches by a property (as opposed to a field)

2012-02-29 Thread Tom
Hi all,

I have the following model:


class Todo(models.Model):
name = models.CharField(max_length=200)
due_date = models.DateTimeField()
location = models.CharField(max_length=200)
type = models.CharField(max_length=4, choices=TODO_TYPES)
owner = models.ForeignKey(User, verbose_name='owner')
done = models.BooleanField(default=False)
def _get_due_week(self):
return int(self.due_date.strftime("%W"))
due_week = property(_get_due_week)
def __unicode__(self):
return self.name


and this search code:


...
user = request.user
this_week = int(date.strftime("%W"))
this_weeks_todos =
Todo.objects.filter(owner__id=user.id).filter(due_week=this_week)
...


But I get:

"Cannot resolve keyword 'due_week' into field. Choices are: done,
due_date, id, location, name, owner, type"

Is it not possible to filter based on a property?

What is the correct method for doing this?

Thanks in advance for your help.

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Sandro Dutra
Try:
'C:\Python27\my_Djando_projects\mysite\My_Templates\polls\index.html'
'C:\Python27\my_Djando_projects\mysite\My_Templates\polls\'
'C:\Python27\my_Djando_projects\mysite\My_Templates\'

Or:
abspath = lambda *p: os.path.abspath(os.path.join(*p))
PROJECT_ROOT = abspath(os.path.dirname(__file__))
(...)
TEMPLATE_DIRS = (abspath(PROJECT_ROOT, "My_Templates"),)




2012/2/29 Sami Balbaky 

> Hi Anoop,
>
> Thank you for the kind reply, I've tried that already. Here are the 3
> variations that I've attempted so far within settings.py in TEMPLATE_DIRS:
>
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/index.html'
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/'
> 'C:/Python27/my_Djando_projects/mysite/My_Templates/'
>
>
> They all yield the same error unfortunately. I'm coding this on a Windows
> Vista system, fyi.
>
> Best,
>
> SB
>
>
> On Wed, Feb 29, 2012 at 11:48 AM, Anoop Thomas Mathew wrote:
>
>> You have to give template directories, not template names in the
>> settings.py.
>> Thanks,
>> Anoop
>> atm
>> ___
>> Life is short, Live it hard.
>>
>>
>>
>>
>>
>> On 1 March 2012 01:16, Django_for_SB  wrote:
>>
>>> Hello All,
>>>
>>> I'm going through the tutorial on djangoproject.com, and can't seem to
>>> hurdle over this section that reads "Write views that actually do
>>> something"
>>>
>>> Here's the code I have so far, which is directly copied from the
>>> tutorial or prescribed by the tutorial:
>>>
>>> views.py:
>>> "from django.template import Context, loader
>>> from polls.models import Poll
>>> from django.http import HttpResponse
>>>
>>> def index(request):
>>>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>>>t = loader.get_template('polls/index.html')
>>>c = Context({
>>>'latest_poll_list': latest_poll_list,
>>>})
>>>return HttpResponse(t.render(c))"
>>>
>>>
>>>
>>> settings.py:
>>> "...
>>> TEMPLATE_DIRS = (
>>># Put strings here, like "/home/html/django_templates" or "C:/www/
>>> django/templates".
>>># Always use forward slashes, even on Windows.
>>># Don't forget to use absolute paths, not relative paths.
>>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>>> base_site.html'
>>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>>> index.html'
>>>'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
>>> index.html'
>>> )
>>> ..."
>>>
>>>
>>> index.html:
>>> "{% if latest_poll_list %}
>>>
>>>{% for poll in latest_poll_list %}
>>>{{ poll.question }}>> li>
>>>{% endfor %}
>>>
>>> {% else %}
>>>No polls are available.
>>> {% endif %}
>>> "
>>>
>>>
>>>
>>>
>>> I keep getting the same error, which reads:
>>>
>>>
>>> TemplateDoesNotExist at /polls/
>>>
>>> polls/index.html
>>>
>>> Request Method: GET
>>> Request URL:http://localhost:8000/polls/
>>> Django Version: 1.3.1
>>> Exception Type: TemplateDoesNotExist
>>> Exception Value:
>>>
>>> polls/index.html
>>>
>>> Exception Location: C:\Python27\lib\site-packages\django\template
>>> \loader.py in find_template, line 138
>>> Python Executable:  C:\Python27\python.exe
>>> Python Version: 2.7.2
>>> Python Path:
>>>
>>> ['C:\\Python27\\my_Djando_projects\\mysite',
>>>  'C:\\Windows\\system32\\python27.zip',
>>>  'C:\\Python27\\DLLs',
>>>  'C:\\Python27\\lib',
>>>  'C:\\Python27\\lib\\plat-win',
>>>  'C:\\Python27\\lib\\lib-tk',
>>>  'C:\\Python27',
>>>  'C:\\Python27\\lib\\site-packages']
>>>
>>> Server time:Wed, 29 Feb 2012 11:32:54 -0800
>>> Template-loader postmortem
>>>
>>> Django tried loading these templates, in this order:
>>>
>>> Using loader django.template.loaders.filesystem.Loader:
>>> c:\python27\my_djando_projects\mysite\my_templates\admin
>>> \base_site.html
>>> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
>>> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
>>> \polls\index.html (File does not exist)
>>> Using loader django.template.loaders.app_directories.Loader:
>>> c:\python27\lib\site-packages\django\contrib\admin\templates\polls
>>> \index.html (File does not exist)
>>>
>>>
>>>
>>>
>>> What on earth am I doing wrong here? I've so many different variations
>>> of my settings.py, views.py, and index.html. Any help would be much
>>> appreciated.
>>>
>>>
>>> Thanks,
>>>
>>> SB
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to 

Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Sami Balbaky
Hi Anoop,

Thank you for the kind reply, I've tried that already. Here are the 3
variations that I've attempted so far within settings.py in TEMPLATE_DIRS:

'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/index.html'
'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/'
'C:/Python27/my_Djando_projects/mysite/My_Templates/'


They all yield the same error unfortunately. I'm coding this on a Windows
Vista system, fyi.

Best,

SB

On Wed, Feb 29, 2012 at 11:48 AM, Anoop Thomas Mathew wrote:

> You have to give template directories, not template names in the
> settings.py.
> Thanks,
> Anoop
> atm
> ___
> Life is short, Live it hard.
>
>
>
>
>
> On 1 March 2012 01:16, Django_for_SB  wrote:
>
>> Hello All,
>>
>> I'm going through the tutorial on djangoproject.com, and can't seem to
>> hurdle over this section that reads "Write views that actually do
>> something"
>>
>> Here's the code I have so far, which is directly copied from the
>> tutorial or prescribed by the tutorial:
>>
>> views.py:
>> "from django.template import Context, loader
>> from polls.models import Poll
>> from django.http import HttpResponse
>>
>> def index(request):
>>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>>t = loader.get_template('polls/index.html')
>>c = Context({
>>'latest_poll_list': latest_poll_list,
>>})
>>return HttpResponse(t.render(c))"
>>
>>
>>
>> settings.py:
>> "...
>> TEMPLATE_DIRS = (
>># Put strings here, like "/home/html/django_templates" or "C:/www/
>> django/templates".
>># Always use forward slashes, even on Windows.
>># Don't forget to use absolute paths, not relative paths.
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> base_site.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
>> index.html'
>>'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
>> index.html'
>> )
>> ..."
>>
>>
>> index.html:
>> "{% if latest_poll_list %}
>>
>>{% for poll in latest_poll_list %}
>>{{ poll.question }}> li>
>>{% endfor %}
>>
>> {% else %}
>>No polls are available.
>> {% endif %}
>> "
>>
>>
>>
>>
>> I keep getting the same error, which reads:
>>
>>
>> TemplateDoesNotExist at /polls/
>>
>> polls/index.html
>>
>> Request Method: GET
>> Request URL:http://localhost:8000/polls/
>> Django Version: 1.3.1
>> Exception Type: TemplateDoesNotExist
>> Exception Value:
>>
>> polls/index.html
>>
>> Exception Location: C:\Python27\lib\site-packages\django\template
>> \loader.py in find_template, line 138
>> Python Executable:  C:\Python27\python.exe
>> Python Version: 2.7.2
>> Python Path:
>>
>> ['C:\\Python27\\my_Djando_projects\\mysite',
>>  'C:\\Windows\\system32\\python27.zip',
>>  'C:\\Python27\\DLLs',
>>  'C:\\Python27\\lib',
>>  'C:\\Python27\\lib\\plat-win',
>>  'C:\\Python27\\lib\\lib-tk',
>>  'C:\\Python27',
>>  'C:\\Python27\\lib\\site-packages']
>>
>> Server time:Wed, 29 Feb 2012 11:32:54 -0800
>> Template-loader postmortem
>>
>> Django tried loading these templates, in this order:
>>
>> Using loader django.template.loaders.filesystem.Loader:
>> c:\python27\my_djando_projects\mysite\my_templates\admin
>> \base_site.html
>> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
>> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
>> \polls\index.html (File does not exist)
>> Using loader django.template.loaders.app_directories.Loader:
>> c:\python27\lib\site-packages\django\contrib\admin\templates\polls
>> \index.html (File does not exist)
>>
>>
>>
>>
>> What on earth am I doing wrong here? I've so many different variations
>> of my settings.py, views.py, and index.html. Any help would be much
>> appreciated.
>>
>>
>> Thanks,
>>
>> SB
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Sami Balbaky
System Engineer - Ultrawave Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 

Re: Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Anoop Thomas Mathew
You have to give template directories, not template names in the
settings.py.
Thanks,
Anoop
atm
___
Life is short, Live it hard.




On 1 March 2012 01:16, Django_for_SB  wrote:

> Hello All,
>
> I'm going through the tutorial on djangoproject.com, and can't seem to
> hurdle over this section that reads "Write views that actually do
> something"
>
> Here's the code I have so far, which is directly copied from the
> tutorial or prescribed by the tutorial:
>
> views.py:
> "from django.template import Context, loader
> from polls.models import Poll
> from django.http import HttpResponse
>
> def index(request):
>latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
>t = loader.get_template('polls/index.html')
>c = Context({
>'latest_poll_list': latest_poll_list,
>})
>return HttpResponse(t.render(c))"
>
>
>
> settings.py:
> "...
> TEMPLATE_DIRS = (
># Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
># Always use forward slashes, even on Windows.
># Don't forget to use absolute paths, not relative paths.
>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
> base_site.html'
>'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
> index.html'
>'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
> index.html'
> )
> ..."
>
>
> index.html:
> "{% if latest_poll_list %}
>
>{% for poll in latest_poll_list %}
>{{ poll.question }} li>
>{% endfor %}
>
> {% else %}
>No polls are available.
> {% endif %}
> "
>
>
>
>
> I keep getting the same error, which reads:
>
>
> TemplateDoesNotExist at /polls/
>
> polls/index.html
>
> Request Method: GET
> Request URL:http://localhost:8000/polls/
> Django Version: 1.3.1
> Exception Type: TemplateDoesNotExist
> Exception Value:
>
> polls/index.html
>
> Exception Location: C:\Python27\lib\site-packages\django\template
> \loader.py in find_template, line 138
> Python Executable:  C:\Python27\python.exe
> Python Version: 2.7.2
> Python Path:
>
> ['C:\\Python27\\my_Djando_projects\\mysite',
>  'C:\\Windows\\system32\\python27.zip',
>  'C:\\Python27\\DLLs',
>  'C:\\Python27\\lib',
>  'C:\\Python27\\lib\\plat-win',
>  'C:\\Python27\\lib\\lib-tk',
>  'C:\\Python27',
>  'C:\\Python27\\lib\\site-packages']
>
> Server time:Wed, 29 Feb 2012 11:32:54 -0800
> Template-loader postmortem
>
> Django tried loading these templates, in this order:
>
> Using loader django.template.loaders.filesystem.Loader:
> c:\python27\my_djando_projects\mysite\my_templates\admin
> \base_site.html
> c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
> c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
> \polls\index.html (File does not exist)
> Using loader django.template.loaders.app_directories.Loader:
> c:\python27\lib\site-packages\django\contrib\admin\templates\polls
> \index.html (File does not exist)
>
>
>
>
> What on earth am I doing wrong here? I've so many different variations
> of my settings.py, views.py, and index.html. Any help would be much
> appreciated.
>
>
> Thanks,
>
> SB
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Error on Tutorial Part 3 - https://docs.djangoproject.com/en/1.3/intro/tutorial03/

2012-02-29 Thread Django_for_SB
Hello All,

I'm going through the tutorial on djangoproject.com, and can't seem to
hurdle over this section that reads "Write views that actually do
something"

Here's the code I have so far, which is directly copied from the
tutorial or prescribed by the tutorial:

views.py:
"from django.template import Context, loader
from polls.models import Poll
from django.http import HttpResponse

def index(request):
latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
t = loader.get_template('polls/index.html')
c = Context({
'latest_poll_list': latest_poll_list,
})
return HttpResponse(t.render(c))"



settings.py:
"...
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
base_site.html'
'C:/Python27/my_Djando_projects/mysite/My_Templates/admin/
index.html'
'C:/Python27/my_Djando_projects/mysite/My_Templates/polls/
index.html'
)
..."


index.html:
"{% if latest_poll_list %}

{% for poll in latest_poll_list %}
{{ poll.question }}
{% endfor %}

{% else %}
No polls are available.
{% endif %}
"




I keep getting the same error, which reads:


TemplateDoesNotExist at /polls/

polls/index.html

Request Method: GET
Request URL:http://localhost:8000/polls/
Django Version: 1.3.1
Exception Type: TemplateDoesNotExist
Exception Value:

polls/index.html

Exception Location: C:\Python27\lib\site-packages\django\template
\loader.py in find_template, line 138
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.2
Python Path:

['C:\\Python27\\my_Djando_projects\\mysite',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']

Server time:Wed, 29 Feb 2012 11:32:54 -0800
Template-loader postmortem

Django tried loading these templates, in this order:

Using loader django.template.loaders.filesystem.Loader:
c:\python27\my_djando_projects\mysite\my_templates\admin
\base_site.html
c:\python27\my_djando_projects\mysite\my_templates\admin\index.html
c:\python27\my_djando_projects\mysite\my_templates\polls\index.html
\polls\index.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
c:\python27\lib\site-packages\django\contrib\admin\templates\polls
\index.html (File does not exist)




What on earth am I doing wrong here? I've so many different variations
of my settings.py, views.py, and index.html. Any help would be much
appreciated.


Thanks,

SB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Keeping filters when adding in the admin interface

2012-02-29 Thread Mauro Sánchez
Hello, if I have the following Model:

class A:
name

class B:
name
a = models.ForeignKey(A)

class C:
name
b = models.ForeignKey(B)

And let's suppose that in the Admin Site I have a Filter in the C list
that refers to the A model. Is there a way to keep that filter when I
am going to add a new C object and use it to filter the combobox of
the b filed so that it will only show the b objects that are related
to the A model in the filter?
For example:
If the filter I choose points to the id=1 in the A model, the combobox
for the b field when I add a C object only has to show the B objects
that has a = 1

Is there a way to do this?
Thanks a lot for the help.
Greetings.
Mauro.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Kev Dwyer
furby wrote:

> Caught it.  Haha.  What a funny bug.  From models.py:
> 
> 196 d = dt.datetime.today()
> 197 expires = d.replace(year=d.year+1)
> 
> There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!
> 
> On Feb 29, 9:50 am, Tom Evans  wrote:
>> On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
>> > The guy I built this for does not want to pay me to maintain it, so
>> > it's still on .96.  And yet when something breaks randomly he wonders
>> > why.  Debug enabled today for debugging.  There is no dev
>> > environment.  Only production for this.
>>
>> Customer is always right. Plus, job for life ;)
>>
>>
>>
>> > Here's the urlconf.  I've literally commented out every urlpattern
>> > expect the top one on line 4.  Still breaks:
>>
>> > 1 from django.conf.urls.defaults import *
>> > 2 from permitprint.app.models import *
>> > 3 urlpatterns = patterns('django.views.generic.simple',
>> > 4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
>> > 5 """
>>
>> Hmmpf. One of the things improved since 0.96 is that error reporting
>> of this kind has improved. There is an import error coming from one of
>> the imports in the urlconf, and that is why it cannot import the
>> urlconf. Is there any date handling code in the top level of the
>> permitprint.app.models?
>>
>> Cheers
>>
>> Tom
> 
Perhaps not entirely coincidentally, Michael Foord blogged about this today:

http://www.voidspace.org.uk/python/weblog/arch_d7_2012_02_25.shtml#e1235

Cheers,

Kev

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DateField - format in Django 1.3.1

2012-02-29 Thread Xavier Pegenaute
Hi,

I saw there was some problems in the format which is rendered,
validated and stored using a DateField in a form, and in a model. Are
they still unresolved in 1.3.1 versio?, it's not working for me 

My form:
 32 class EventForm(forms.Form):
 33 name =
forms.CharField(label=_('name'),max_length=100,required=True)
 34 startDate = forms.DateField(input_formats=['%d/%m/
%Y'],label=_('startDate'),
required=False,initial=datetime.date.today)
 35 endDate = forms.DateField(input_formats=['%d/%m/
%Y'],label=_('endDate'),
required=False,initial=datetime.date.today)


My model:
34 class Event(models.Model):
35 eventID = models.AutoField(primary_key=True)
36 name = models.CharField(max_length=100,null=False,blank=False)
38 startDate = models.DateField('%d/%m/
%Y',null=True,blank=False,default=date.today)
39 endDate = models.DateField('%d/%m/
%Y',null=True,blank=False,default=date.today)

And the POST message:
POST:,

The render is properly drawn.

Tanks a lot,
Xavi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Loading multi-line SQL as part of syncdb

2012-02-29 Thread Christophe Pettus
The problem is: This doesn't work, as is well-known, because the current code 
breaks sql/.sql files into lines, and that fails if the SQL 
statement is multiline.

The fix is generally noted to be, to quote mtredinnick on bug #3214:

> If you want to pass in complex SQL, catch the post-syncdb signal and work 
> directly with a django.db.backend.cursor. You will know precisely what 
> database you're talking to and can use the appropriate syntax and calling 
> mechanisms.

Except the documentation of the post_syncdb signal says:

> It is important that handlers of this signal perform idempotent changes (e.g. 
> no database alterations) as this may cause the flush management command to 
> fail if it also ran during the syncdb command.

So, either the documentation is overstating the case, or the proposed solution 
is wrong.  Any guidance as to the right way to apply multi-line SQL during 
syncdb?

Best,
--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: facebook login problem

2012-02-29 Thread Vignesh Sunder
This might help you in managing the session. I had a similar problem a
year ago and used the following snippet:

http://djangosnippets.org/snippets/2065/

Cheers!

On Wed, Feb 29, 2012 at 5:29 PM, dummyman dummyman  wrote:
> Hi , i am using django framework at the back end
>
> I have used facebook s social plugin login for authentication
>
> 
>     
>       My Facebook Login Page
>     
>     
>       
>       http://connect.facebook.net/en_US/all.js";>
>       
>          FB.init({
>             appId:'My_app_id', cookie:true,
>             status:true, xfbml:true
>          });
>       
>       Login with Facebook
>     
>  
>
> I have replaced app_id with appropriate app id
>
> login button appears but when i click on the login button, a  window pops up
> and fb s signin form appears. wen i enter my email and pass it says "error
> occured.Please try again later"
> my app id is correct  and i want to proceed further on maintaining the
> session information about the logged in user. Please suggest me suitable
> reference for this and please help me in finding the error in fb  login
> button
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Andre Terra
use something like >>> d + datetime.timedelta(days=365)

http://docs.python.org/library/datetime.html#timedelta-objects


Cheers,
AT

On Wed, Feb 29, 2012 at 12:59 PM, furby  wrote:

> Caught it.  Haha.  What a funny bug.  From models.py:
>
> 196 d = dt.datetime.today()
> 197 expires = d.replace(year=d.year+1)
>
> There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!
>
> On Feb 29, 9:50 am, Tom Evans  wrote:
> > On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> > > The guy I built this for does not want to pay me to maintain it, so
> > > it's still on .96.  And yet when something breaks randomly he wonders
> > > why.  Debug enabled today for debugging.  There is no dev
> > > environment.  Only production for this.
> >
> > Customer is always right. Plus, job for life ;)
> >
> >
> >
> > > Here's the urlconf.  I've literally commented out every urlpattern
> > > expect the top one on line 4.  Still breaks:
> >
> > >  1 from django.conf.urls.defaults import *
> > >  2 from permitprint.app.models import *
> > >  3 urlpatterns = patterns('django.views.generic.simple',
> > >  4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
> > >  5 """
> >
> > Hmmpf. One of the things improved since 0.96 is that error reporting
> > of this kind has improved. There is an import error coming from one of
> > the imports in the urlconf, and that is why it cannot import the
> > urlconf. Is there any date handling code in the top level of the
> > permitprint.app.models?
> >
> > Cheers
> >
> > Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
Caught it.  Haha.  What a funny bug.  From models.py:

196 d = dt.datetime.today()
197 expires = d.replace(year=d.year+1)

There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!

On Feb 29, 9:50 am, Tom Evans  wrote:
> On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> > The guy I built this for does not want to pay me to maintain it, so
> > it's still on .96.  And yet when something breaks randomly he wonders
> > why.  Debug enabled today for debugging.  There is no dev
> > environment.  Only production for this.
>
> Customer is always right. Plus, job for life ;)
>
>
>
> > Here's the urlconf.  I've literally commented out every urlpattern
> > expect the top one on line 4.  Still breaks:
>
> >  1 from django.conf.urls.defaults import *
> >  2 from permitprint.app.models import *
> >  3 urlpatterns = patterns('django.views.generic.simple',
> >  4     (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
> >  5 """
>
> Hmmpf. One of the things improved since 0.96 is that error reporting
> of this kind has improved. There is an import error coming from one of
> the imports in the urlconf, and that is why it cannot import the
> urlconf. Is there any date handling code in the top level of the
> permitprint.app.models?
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> The guy I built this for does not want to pay me to maintain it, so
> it's still on .96.  And yet when something breaks randomly he wonders
> why.  Debug enabled today for debugging.  There is no dev
> environment.  Only production for this.

Customer is always right. Plus, job for life ;)

>
> Here's the urlconf.  I've literally commented out every urlpattern
> expect the top one on line 4.  Still breaks:
>
>  1 from django.conf.urls.defaults import *
>  2 from permitprint.app.models import *
>  3 urlpatterns = patterns('django.views.generic.simple',
>  4     (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
>  5 """

Hmmpf. One of the things improved since 0.96 is that error reporting
of this kind has improved. There is an import error coming from one of
the imports in the urlconf, and that is why it cannot import the
urlconf. Is there any date handling code in the top level of the
permitprint.app.models?

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
The guy I built this for does not want to pay me to maintain it, so
it's still on .96.  And yet when something breaks randomly he wonders
why.  Debug enabled today for debugging.  There is no dev
environment.  Only production for this.

Here's the urlconf.  I've literally commented out every urlpattern
expect the top one on line 4.  Still breaks:

  1 from django.conf.urls.defaults import *
  2 from permitprint.app.models import *
  3 urlpatterns = patterns('django.views.generic.simple',
  4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
  5 """
  6 (r'^contact/?$', 'direct_to_template', {'template':
'contact.html'}),
  7 (r'^services/?$', 'direct_to_template', {'template':
'services.html'}),
  8 (r'^cancel/?$', 'direct_to_template', {'template':
'cancel.html'}),
  9
 10 # Uncomment this for admin:
 11 """
 12 )
 13 """
 14 urlpatterns = patterns('',
 15 (r'^register/(?P\w+)/?$',
'permitprint.app.views.register'),
 16 (r'^register/?$', 'permitprint.app.views.register'),
 17 (r'^success/?$', 'permitprint.app.views.success'),
 18 (r'^cancel/?$', 'permitprint.app.views.cancel'),
 19 (r'^success-login/?$', 'permitprint.app.views.success_login'),
 20 (r'^verify/?$', 'permitprint.app.views.verify'),
 21 (r'^cancel-order-permits/?$',
'permitprint.app.views.cancel_order_permits'),
 22 (r'^success-order-permits/?$',
'permitprint.app.views.success_order_permits'),
 23 (r'^review-order-permits/?$',
'permitprint.app.views.review_order_permits'),
 24 (r'^admin/app/parkingpermit/$',
'permitprint.app.admin.views.main.change_list',
{'app_label':'app','model_name':'ParkingPermit'}),
 25 (r'^admin/app/userprofile/$',
'permitprint.app.admin.views.main.change_list',
{'app_label':'app','model_name':'UserProfile'}),
 26 (r'^admin/app/orderpermits/$',
'permitprint.app.views.order_permits'),
 27 (r'^admin/', include('permitprint.admin_urls')),
 28 )
 29 urlpatterns += patterns('django.views.generic.list_detail',
 30 (r'^products/?$', 'object_list', product_list ),
 31 (r'^products/(?P\w+)/?$', 'object_detail',
product_detail ),
 32 (r'^links/?$', 'object_list', link_list ),
 33 )
 34 """


On Feb 29, 9:22 am, Tom Evans  wrote:
> On Wed, Feb 29, 2012 at 3:09 PM, furby  wrote:
> > A site I built several years ago is breaking randomly today due to the
> > extra leap year day.  Any help on this would be appreciated.  I can't
> > track it down.
>
> > Traceback (most recent call last):
> > File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
> > get_response
> >  68. callback, callback_args, callback_kwargs =
> > resolver.resolve(request.path)
> > File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> > resolve
> >  160. for pattern in self.urlconf_module.urlpatterns:
> > File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> > _get_urlconf_module
> >  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
> > %s" % (self.urlconf_name, e)
>
> >  ImproperlyConfigured at /admin/
> >  Error while importing URLconf 'permitprint.urls': day is out of
> > range for month
>
> So, it is going wrong because something that is in your urlconf causes
> an exception, and so the urlconf cannot be imported. You need to show
> the code from your urlconf.
>
> Two other unrelated things:
>
> 1) You're running with DEBUG=True on a production site! Don't do that!
> 2) You seem to be using Django 0.96! Django 1.4 is about to be
> released, there are 'several' bugs fixed in between those two
> versions. Perhaps even something that causes this problem!
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



facebook login problem

2012-02-29 Thread dummyman dummyman
Hi , i am using django framework at the back end

I have used facebook s social plugin login for authentication



  My Facebook Login Page


  
  http://connect.facebook.net/en_US/all.js";>
  
 FB.init({
appId:'My_app_id', cookie:true,
status:true, xfbml:true
 });
  
  Login with Facebook

 

I have replaced app_id with appropriate app id

login button appears but when i click on the login button, a  window pops
up and fb s signin form appears. wen i enter my email and pass it says
"error occured.Please try again later"
my app id is correct  and i want to proceed further on maintaining the
session information about the logged in user. Please suggest me suitable
reference for this and please help me in finding the error in fb  login
button

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 3:09 PM, furby  wrote:
> A site I built several years ago is breaking randomly today due to the
> extra leap year day.  Any help on this would be appreciated.  I can't
> track it down.
>
> Traceback (most recent call last):
> File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
> get_response
>  68. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)
> File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> resolve
>  160. for pattern in self.urlconf_module.urlpatterns:
> File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> _get_urlconf_module
>  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
> %s" % (self.urlconf_name, e)
>
>  ImproperlyConfigured at /admin/
>  Error while importing URLconf 'permitprint.urls': day is out of
> range for month
>

So, it is going wrong because something that is in your urlconf causes
an exception, and so the urlconf cannot be imported. You need to show
the code from your urlconf.

Two other unrelated things:

1) You're running with DEBUG=True on a production site! Don't do that!
2) You seem to be using Django 0.96! Django 1.4 is about to be
released, there are 'several' bugs fixed in between those two
versions. Perhaps even something that causes this problem!

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
A site I built several years ago is breaking randomly today due to the
extra leap year day.  Any help on this would be appreciated.  I can't
track it down.

Traceback (most recent call last):
File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
get_response
  68. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
resolve
  160. for pattern in self.urlconf_module.urlpatterns:
File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
_get_urlconf_module
  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
%s" % (self.urlconf_name, e)

  ImproperlyConfigured at /admin/
  Error while importing URLconf 'permitprint.urls': day is out of
range for month

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
Excuse my brainfart moment.. sets and dicts are not ordered!

On Wed, Feb 29, 2012 at 11:32 AM, Tom Evans wrote:

> On Wed, Feb 29, 2012 at 1:46 PM, Andre Terra  wrote:
> > I may be misunderstanding something, but for one reason lists are not
> > ordered, so you'd never know which item to get, agreed?
> >
>
> Lists are ordered, I think you are confusing something :)
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: User actions logging app

2012-02-29 Thread akaariai
The log entry model above is very much like what is used in the Admin.
You might want to investigate that model, too, for logging who-did-
what. It can be found from django.contrib.admin.models.

The reason why I use my own is that I usually have some extra columns
related to the audit trail handling.

 - Anssi

On Feb 29, 3:12 pm, Mario Gudelj  wrote:
> Wow. Legend! That's so much Annsi.
>
> On 29 February 2012 18:00, Babatunde Akinyanmi  wrote:
>
>
>
>
>
>
>
> > Yes, they definitely will.
>
> > On 2/28/12, akaariai  wrote:
> > > On Feb 28, 11:35 pm, Mario Gudelj  wrote:
> > >> Hi list,
>
> > >> I was wandering if someone could recomend an easy django app for logging
> > >> user actions performed on models. I'd like to log changes logged in
> > users
> > >> make around the app.
>
> > > I think there are some apps out there. The first question however is
> > > do you want to log "user a changed object b" or do you need an audit
> > > trail also, that is do you need to have the information of user a
> > > changed object b's field c from value "foo" to value "bar".
>
> > > I really am not the one to tell you which app is the correct one. I
> > > usually have a small create_log_entry() method for creating entries
> > > for modifications, and database triggers for the audit trail. The
> > > create_log_entry is often the right way to go, as more often than not
> > > I want to set all changes to the "main" record. That is, if somebody
> > > changes an article's attachment, it is the article that needs to have
> > > the changed log entry, not the attachment.
>
> > > The log entry model is something like this:
> > > class LogEntry(object):
> > >     to_pk = models.IntegerField() #lets assume you are working only
> > > with integer primary keys
> > >     to_type = models.CharField(max_length=40, choices=(('article',
> > > 'Article'), ...))
> > >     mod_type = choices "INSERT/UPDATE/DELETE"
> > >     who = FK(user)
> > >     what = models.TextField() # A "comment" for the edit
> > >     when = models.DateTimeField()
> > >     @classmethod
> > >     def create_log_entry(cls, to_obj, edit_type, user, what_done):
> > >           ...
>
> > > Combined with database-level triggers you can get a good audit trail.
> > > I have some scripts to ease maintain the DB triggers for PostgreSQL
> > > when using Django. I hope I will have some time to polish them for
> > > release, I believe they could be some use for the community.
>
> > >  - Anssi
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Sent from my mobile device
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 1:46 PM, Andre Terra  wrote:
> I may be misunderstanding something, but for one reason lists are not
> ordered, so you'd never know which item to get, agreed?
>

Lists are ordered, I think you are confusing something :)

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Jquery/ajax + django

2012-02-29 Thread Stanwin Siow
Hello,

I've gotten this json object back from django.

I was wondering how do we use ajax/jquery to retrieve just the words that are 
highlighted?

I'm stumped.


{"new_list":{"blue": {"sub_datetime": "2012-02-29 22:14:44", "exp_datetime": 
"2012-03-07 22:14:44", "keyword": "blue"}, "teleport": {"sub_datetime": 
"2012-02-29 22:09:26", "exp_datetime": "2012-03-07 22:09:26", "keyword": 
"teleport"}, "blink182": {"sub_datetime": "2012-02-29 22:12:40", 
"exp_datetime": "2012-03-07 22:12:40", "keyword": "blink182"}, "a1": 
{"sub_datetime": "2012-02-29 22:13:31", "exp_datetime": "2012-03-07 22:13:31", 
"keyword": "a1"}, "jolie": {"sub_datetime": "2012-02-29 22:08:46", 
"exp_datetime": "2012-03-07 22:08:46", "keyword": "jolie"}, "santa claus": 
{"sub_datetime": "2012-02-29 22:14:13", "exp_datetime": "2012-03-07 22:14:13", 
"keyword": "santa claus"}}}


Here are the methods i've tried:

function updateKeywords(e) { e.preventDefault();
 var keyword_form = 
jQuery(e.target);
 alert("Yay Jquery 
is working!!!");
$.ajax({
url : 
keyword_form.attr('action'),
type : 
keyword_form.attr('method'),
data : 
keyword_form.serialize(),

dataType : 'json',
success 
: function(response) {alert("JSON Data: " + response.new_list.keyword);

},
});
}



});




Unfortunately, when i put the above, it returns an undefined json data.

When i just put response.new_list, it returns the whole chunk.

Do appreciate any help.



Best Regards,

Stanwin Siow



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
On Wed, Feb 29, 2012 at 5:46 AM, Szabo, Patrick (LNG-VIE) <
patrick.sz...@lexisnexis.at> wrote:

> Should I not get  lists ?
>
> ** **
>
> i.e:
>
> ** **
>
> [Monatsreport]
>
> [2,29,42]
>


I may be misunderstanding something, but for one reason lists are not
ordered, so you'd never know which item to get, agreed?


Cheers,
AT

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Unicode lists and form submissions

2012-02-29 Thread Mario Gudelj
Hi djangoers,

I've ran into an issue I'm not sure how to handle.

I have a form with 7 checkboxes representing 7 days of the week. I want to
collect the submitted days and use them in rrule to generate some dates.

The form field looks like this:

weekly_interval = forms.MultipleChoiceField(label='Repeat on:',
choices=EventSeries.weekly_interval,widget=forms.CheckboxSelectMultiple,
required=False)

The choices are generated from this:

weekly_interval = (
(rrule.SU, 'Sun'),
(rrule.MO, 'Mon'),
(rrule.TU, 'Tue'),
(rrule.WE, 'Wed'),
(rrule.TH, 'Thu'),
(rrule.FR, 'Fri'),
(rrule.SA, 'Sat')
)

So, the form renders and everything is fine, but once I submit the form,
the data is in incorrect format and I'm not sure how to fix it.

This is how I'm collecting the interval:

interval=form.cleaned_data['weekly_interval']

Then I'm using it in this line:

start_dates = list(rrule.rrule(rrule.WEEKLY, count=self.recurrences,
byweekday=self.interval, dtstart=self.start_datetime))

My problem is in this byweekday=self.interval

If I test this form console with the following it works fine

start_dates = list(rrule.rrule(rrule.WEEKLY, count=a_s.recurrences,
byweekday=(rrule.MO,rrule.TU), dtstart=appt.start_time))

But when I look at the interval submitted from the form using pdb it looks
like this [u'WE', u'TH', u'SA']

I suspect that I need to convert this from unicode to objects. Does anyone
know the best approach? And what it would be?

Thanks a million!

-m

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: User actions logging app

2012-02-29 Thread Mario Gudelj
Wow. Legend! That's so much Annsi.

On 29 February 2012 18:00, Babatunde Akinyanmi  wrote:

> Yes, they definitely will.
>
> On 2/28/12, akaariai  wrote:
> > On Feb 28, 11:35 pm, Mario Gudelj  wrote:
> >> Hi list,
> >>
> >> I was wandering if someone could recomend an easy django app for logging
> >> user actions performed on models. I'd like to log changes logged in
> users
> >> make around the app.
> >
> > I think there are some apps out there. The first question however is
> > do you want to log "user a changed object b" or do you need an audit
> > trail also, that is do you need to have the information of user a
> > changed object b's field c from value "foo" to value "bar".
> >
> > I really am not the one to tell you which app is the correct one. I
> > usually have a small create_log_entry() method for creating entries
> > for modifications, and database triggers for the audit trail. The
> > create_log_entry is often the right way to go, as more often than not
> > I want to set all changes to the "main" record. That is, if somebody
> > changes an article's attachment, it is the article that needs to have
> > the changed log entry, not the attachment.
> >
> > The log entry model is something like this:
> > class LogEntry(object):
> > to_pk = models.IntegerField() #lets assume you are working only
> > with integer primary keys
> > to_type = models.CharField(max_length=40, choices=(('article',
> > 'Article'), ...))
> > mod_type = choices "INSERT/UPDATE/DELETE"
> > who = FK(user)
> > what = models.TextField() # A "comment" for the edit
> > when = models.DateTimeField()
> > @classmethod
> > def create_log_entry(cls, to_obj, edit_type, user, what_done):
> >   ...
> >
> > Combined with database-level triggers you can get a good audit trail.
> > I have some scripts to ease maintain the DB triggers for PostgreSQL
> > when using Django. I hope I will have some time to polish them for
> > release, I believe they could be some use for the community.
> >
> >  - Anssi
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Learning Django: DjangoProject Poll application

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 6:07 AM, WuWoot  wrote:
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> I'm using the Djangostack (Python 2.7.2+; Django 1.3.1-1) from Bitnami
> ran on Ubuntu 11.10 with PostgreSQL 9.1.2
>

You're doing the dev/trunk tutorial but have django 1.3 installed.

Either use the django 1.3 tutorial, or install the beta of the next
release. If you are a beginner, stick to released software.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is it able to nest block in a conditional tag in the template of Django 1.3?

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 7:20 AM, Patto  wrote:
> Here is my need:
>
> {% if request.user.is_csr %}
>       {% block csr_block %}
>
>
>
> {% endif %}
>

No. Inside child templates, most nodes outside of blocks are ignored.
You can do this instead:

{% block csr_block %}
{% if request.user.is_csr %}
...
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Learning Django: DjangoProject Poll application

2012-02-29 Thread Denis Darii
try to use DjangoStack 1.4b1-0 instead of 1.3.1-1

On Wed, Feb 29, 2012 at 7:07 AM, WuWoot  wrote:

> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> I'm using the Djangostack (Python 2.7.2+; Django 1.3.1-1) from Bitnami
> ran on Ubuntu 11.10 with PostgreSQL 9.1.2
>
> Sorry for my newbie question.
>
> I got to the portion where it asks me to import timezone from the
> django.utils module but all I manage to receive is:
>
> >>> from django.utils import timezone
> Traceback (most recent call last):
>  File "", line 1, in 
> ImportError: cannot import name timezone
>
> If I cannot do the above, I cannot get to the next line in the shell:
>
> >>> p = Poll(question="What's new?", pub_date=timezone.now())
>
>
> Anybody ever encounter this issue? I've attempted to look for a
> timezone setting in my settings.py and the only setting I can modify
> seems to be the location. A preliminary Google search and
> StackOverflow search turned up nothing. Your help is greatly
> appreciated. Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Is it able to nest block in a conditional tag in the template of Django 1.3?

2012-02-29 Thread Patto
Here is my need:

{% if request.user.is_csr %}
  {% block csr_block %}



{% endif %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/GwJ0AOf-DYYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Learning Django: DjangoProject Poll application

2012-02-29 Thread WuWoot
https://docs.djangoproject.com/en/dev/intro/tutorial01/

I'm using the Djangostack (Python 2.7.2+; Django 1.3.1-1) from Bitnami
ran on Ubuntu 11.10 with PostgreSQL 9.1.2

Sorry for my newbie question.

I got to the portion where it asks me to import timezone from the
django.utils module but all I manage to receive is:

>>> from django.utils import timezone
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name timezone

If I cannot do the above, I cannot get to the next line in the shell:

>>> p = Poll(question="What's new?", pub_date=timezone.now())


Anybody ever encounter this issue? I've attempted to look for a
timezone setting in my settings.py and the only setting I can modify
seems to be the location. A preliminary Google search and
StackOverflow search turned up nothing. Your help is greatly
appreciated. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Martin J. Laubach
Also, having a form to parse and validate the POST data is really the way 
to go. Even if you never actually show the form to the user, for example in 
an AJAX callback, deferring all that responsibility and just use 
"form.is_valid()" and "form.cleaned_data" is a lot better than doing 
parameter validation in the view.
>
> mjl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/g5Ln_-KcCYkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AW: Post data Query Dict - Why not a list ?

2012-02-29 Thread Szabo, Patrick (LNG-VIE)
Exactly what i was looking for...thx a lot!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Masklinn
Gesendet: Mittwoch, 29. Februar 2012 10:03
An: django-users@googlegroups.com
Betreff: Re: Post data Query Dict - Why not a list ?

On 2012-02-29, at 09:46 , Szabo, Patrick (LNG-VIE) wrote:
> Hi, 
> 
> If i do 
> 
> for key in request.POST.keys():
> 
> print request.POST[key]
> 
> Over this (which is the result of print request.Post):
> 
>  u'29', u'42']}>
> 
> I get:
> 
> Monatsreport
> 
> 42
> 
> Should I not get  lists ?

No, multidicts generally conform to the dict interface (mapping a
key to a value) as it's the most useful way to interact with POSTDATA
(or GETDATA for that matter): people will generally map a single value
to each key and having to unpack that value all the time is a pain.

If you want to get all values for the key, as the documentation
indicates[0] you should use the `getlist` method.

[0] 
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict.getlist

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Masklinn
On 2012-02-29, at 09:46 , Szabo, Patrick (LNG-VIE) wrote:
> Hi, 
> 
> If i do 
> 
> for key in request.POST.keys():
> 
> print request.POST[key]
> 
> Over this (which is the result of print request.Post):
> 
>  u'29', u'42']}>
> 
> I get:
> 
> Monatsreport
> 
> 42
> 
> Should I not get  lists ?

No, multidicts generally conform to the dict interface (mapping a
key to a value) as it's the most useful way to interact with POSTDATA
(or GETDATA for that matter): people will generally map a single value
to each key and having to unpack that value all the time is a pain.

If you want to get all values for the key, as the documentation
indicates[0] you should use the `getlist` method.

[0] 
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict.getlist

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Post data Query Dict - Why not a list ?

2012-02-29 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

If i do 

 

for key in request.POST.keys():

print request.POST[key]

 

Over this (which is the result of print request.Post):

 



 

I get:

 

Monatsreport

42

 

Should I not get  lists ?

 

i.e:

 

[Monatsreport]

[2,29,42]

 

I need those other information from  'my_choice_field' how do I get them
?

 

Help would be much appreciated.

 

Best regards

 


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.