Re: Disable HTTP Referer checking

2011-09-28 Thread sspross
On Sep 28, 5:19 pm, Tom Evans  wrote:
> On Wed, Sep 28, 2011 at 4:03 PM, sspross  wrote:
> > hi tom
>
> > thanks for your reply, but
>
> > i'm don't want to disable a whole view, just disabling the http
> > referer checking in https.
>
> > silvan
>
Thanks Tom, I will take a closer look at this!

Silvan

> Oh I see - my bad.
>
> There's no way to disable this check, looking at the source code.
>
> The CSRF middleware will automatically accept a request, regardless of
> the referrer/CSRF tokens provided, if the request has the attribute
> '_dont_enforce_csrf_checks' set to True.
> This is meant to be for the test suite to skip CSRF checks (I think),
> but you could abuse it, eg by adding some middleware which checks that
> the call is valid and adding that attribute if you think the request
> is genuine.
>
> 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: Helping someone move from Joomla to Django

2011-09-28 Thread Derek
On Sep 28, 9:58 am, Kevin  wrote:
> Hello,
>
>   I have a friend who is doing website design, not any backend
> programming tasks.  He actually would like me to do the backend
> coding.  The unfortunate case is that he is currently using Joomla,
> which I know almost nothing about, and the apps/plugins for it are not
> reusable in other website frameworks, not even other PHP frameworks,
> icky!  I really enjoy Django because if you create a reusable app, and
> say use Pinax, it will most likely work as well in say Django-CMS or
> another CMS build on top of Django and Python.
>
>   This question is really for anyone who has previously used Joomla
> and knows how the editor works for web designers and content
> managers.  I have seen and used it's site manager only a few times.  I
> took a look at both Pinax and Django-CMS.  After looking at Django-
> CMS, it has a similar feel to that of Joomla with in page editing and
> is overall very simple for a content manager/web designer.  It's also
> very straight forward and supports a lot right out of the box.
>
>   My current task with my friend is to create a music player, I have
> been working with jPlayer recently and finding out how I can integrate
> it with Joomla, haven't took too much time yet.  I'm quiet happy about
> that choice now, since Django-CMS actually has a plugin just for this
> player.
>
>   How would you recommend I go about this task of moving my friend
> over to a Django/Python based system over a Joomla/PHP based system?
> How easy will it be to say convert a Joomla template to a Django
> compatible one?  This will be another issue, is template management.
> Since there is really no standard for website templates, every CMS/
> framework uses it's own system.  I believe Joomla's templates even
> embed PHP code directly into the template itself, another icky.
>
>   I am going to pitch the idea and use the jPlayer plugin for Django-
> CMS as a sweet spot.  I'm also tempted on copying over all the
> existing content to a Django-CMS site to show him how it will look and
> feel.
>
>   He is requesting some other interesting features, which apparently
> someone else is working on implementing, and it's actually taking this
> other person a few days, or maybe weeks to add.  Where I know I can
> implement it in Django in a matter of hours.  If the other person is a
> PHP programmer, me pitching this idea may scare the other person.  PHP
> programmers are sometimes very proud and are hard to turn.  I, myself
> used to be like this, that is until I found myself getting byte by a
> huge Python, it's venom changed my life entirely.  I saw the light.
>
>   What is everyone elses opinions on development in Django verses a
> rival CMS such as Joomla?  Just looking at how the Joomla source tree
> is scares me from even looking at how to code anything in it.  After
> using Django for awhile, I like how nicely everything is organized.

First up, I am not a PHP/Joomla programmer... but some of my good
friends are/were PHP-junkies!

I really think you have mostly answered your own questions here.  It's
your own experience, and your ability to compare both tools/systems,
that gives you the insight you need.  For example, you say "it's
actually taking this other person a few days, or maybe weeks to add.
Where I know I can  implement it in Django in a matter of hours."  So,
do it.  'A few lines of solid code is worth a thousand powerpoint
presentations.'  If your friend currently believes PHP is "the best",
you won't convert him by saying "Django is better" (this is not how
programmers think...).  What you can do is say "wouldn't it be cool to
try something new for a change ... but you can always go back to PHP
later?"  Challenge (or work with) him to try and do the template
conversion, for example - diving in is the best way to learn, and you
may even end up with an article to sell to an online magazine, or at
least a blog post or two to impress your fellows.  Working with him
allows you to easily answer all the small issues that always pop-up
when trying to learn an unfamiliar tool/system, and helps ensure that
these are not road-blocks on the path to "enlightenment".

My 2c!
Derek

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



modelformset partial save and AttributeErrors

2011-09-28 Thread Michael Wayne Goodman
Hi, I'm getting the following error when I try to assign a value to a
model attribute in a modelformset:

AttributeError at /number/
'WSGIRequest' object has no attribute 'qsession'

which occurs in the following snippet:

numbers = formset.save(commit=False)
for number in numbers:
number.qsession = request.qsession
number.save()

If I dir(number) I can see qsession as an attribute, which is
puzzling. I'm really bad at this stuff, so I'll put all the relevant
code below. Any help appreciated.

Here are the models:

class QuestionnaireSession(models.Model):
user = models.ForeignKey(User,blank=True,null=True)
name = models.CharField(max_length=100,blank=True,null=True)

class Number(models.Model):
qsession = models.ForeignKey(QuestionnaireSession)
name = models.CharField(max_length=100)
supertype = models.ForeignKey('self',blank=True,null=True)

And the formset:

NumberFormSet = modelformset_factory(Number, exclude=('qsession',))

And the relevant views.py code:

def get_qsession(request):
if 'qsession' not in request.session:
qsession = QuestionnaireSession()
qsession.save()
request.session['qsession'] = qsession
else:
qsession = request.session['qsession']
return qsession

def number(request):
qsession = get_qsession(request)
queryset = Number.objects.filter(qsession=qsession)
if request.method == 'POST': # form was submitted
formset = NumberFormSet(request.POST, queryset=queryset)
if formset.is_valid():
numbers = formset.save(commit=False)
for number in numbers:
number.qsession = request.qsession
number.save()
return HttpResponseRedirect('/top/')
else:
formset = NumberFormSet(queryset=queryset)
return render_to_response('questionnaire/questionnaire.html',
  {'numberformset': formset},
 
context_instance=RequestContext(request))

Thank you

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

2011-09-28 Thread Sam Walters
I second this. Not something you would implement in django. Would
handle that with the web server front end. Eg: i used to get requests
to phpmyadmin login url requests (i assume thats because that software
is a security issue). So i got nginx to return a minimal 404 message
instead of the full 404 page.


On Thu, Sep 29, 2011 at 1:50 PM, Kurtis Mullins
 wrote:
> Hey, I don't think I'll be able to help you much with figuring this out in
> Django-land. I do have one suggestion though. You could manually block these
> using your front-end server (Nginx, Apache, etc...) so that way it doesn't
> even reach Django. Not only would this be a hypothetically easy fix, you'd
> save yourself some server load as well.
>
> On Wed, Sep 28, 2011 at 2:01 PM, shacker  wrote:
>>
>> Our Django sites get literally hundreds of bogus 404 requests per day. For
>> example:
>>
>> Referrer: http://domain.edu/
>> Requested URL: /signup/
>> User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)
>> IP address: 168.9.86.2
>>
>> The "referrer" line is a lie because nowhere on our site do we point to
>> "/signup" . I've given up trying to figure out how these things are
>> generated or how to block them. But I would like to limit the number of
>> daily emails to just the actual/legit 404s. So I started
>> using IGNORABLE_404_URLS, per:
>>
>> https://docs.djangoproject.com/en/dev/howto/error-reporting/#errors
>>
>> IGNORABLE_404_URLS = (
>>    re.compile(r'\.(php|cgi)$'),
>>     re.compile(r'^/forums'),
>>     re.compile(r'^/signup'),
>>     re.compile(r'/src/'),
>>     re.compile(r'/pdf/'),
>> )
>>
>> Unfortunately this seems to have no effect. Shouldn't the regex pattern
>> there catch the bogus request domain.edu/signup ? Or is this not working
>> because the way the requests are being submitted somehow bypasses Django's
>> ability to catch it as an error? I'm just not clear what's going on here.
>>
>> Thanks.
>>
>> --
>> 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/-/7xxDzuRZue4J.
>> 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.
>

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

2011-09-28 Thread Kurtis Mullins
Hey, I don't think I'll be able to help you much with figuring this out in
Django-land. I do have one suggestion though. You could manually block these
using your front-end server (Nginx, Apache, etc...) so that way it doesn't
even reach Django. Not only would this be a hypothetically easy fix, you'd
save yourself some server load as well.

On Wed, Sep 28, 2011 at 2:01 PM, shacker  wrote:

> Our Django sites get literally hundreds of bogus 404 requests per day. For
> example:
>
> Referrer: http://domain.edu/ 
> Requested URL: /signup/
> User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)
> IP address: 168.9.86.2
>
> The "referrer" line is a lie because nowhere on our site do we point to
> "/signup" . I've given up trying to figure out how these things are
> generated or how to block them. But I would like to limit the number of
> daily emails to just the actual/legit 404s. So I started
> using IGNORABLE_404_URLS, per:
>
> https://docs.djangoproject.com/en/dev/howto/error-reporting/#errors
>
> IGNORABLE_404_URLS = (
>re.compile(r'\.(php|cgi)$'),
> re.compile(r'^/forums'),
> re.compile(r'^/signup'),
> re.compile(r'/src/'),
> re.compile(r'/pdf/'),
> )
>
> Unfortunately this seems to have no effect. Shouldn't the regex pattern
> there catch the bogus request domain.edu/signup ? Or is this not working
> because the way the requests are being submitted somehow bypasses Django's
> ability to catch it as an error? I'm just not clear what's going on here.
>
> Thanks.
>
> --
> 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/-/7xxDzuRZue4J.
> 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.



Create singular instance with ManyToManyField input as ids

2011-09-28 Thread Knack
Hi guys,

I need to create Django model instances from raw data, which comes
from a dict. Example model:


class Worker(models.Model):
name = models.CharField()

class Project(models.Model):
name = models.CharField()
subject = models.CharField()
workers = models.ManyToManyField('Worker')


Data arrives at the Server as raw data, e.g.


worker_1 = {"pk": 1, "name": "Joe"}
worker_2 = {"pk": 2, "name": "Julia"}
worker_3 = {"pk": 3, "name": "Jacob"}

proj_1 =  {"pk": 4, "name": "My first Django", "subject": "Manage
Staff", "workers": [1, 2]}
proj_2 =  {"pk": 5, "name": "Something else", "subject": "About
cooking", "workers": [1, 3]}


Data can arrive in "non logical" order from the client. E.g.


proj_1 =  {"pk": 4, "name": "My first Django", "subject": "Manage
Staff", "workers": [1, 2]}
worker_2 = {"pk": 2, "name": "Julia"}
...


My idea was to use sweet syntax like this to create the models:


worker_1_inst = Worker(**worker_1)
proj_1_inst = Project(**proj_1)


But Django needs proper instances as foreign fields. For a simple
foreign key I guess I could access the id-fields with appending "_id"
to write the reference as id. But what can I do in the case of m2n? To
resolve the the references in the raw data prior creating Django
instances seems to become totally messy.

Damn, I'm really stuck (and embarrased about the error in reasoning.)

Thanks a lot in advance.

Jan

-- 
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: problem with middle - correctly formatted 2

2011-09-28 Thread jenia ivlev
You need to call "TemplateResponse" in your views for
"process_template_response" to be called in your middleware.
So in you view, instead of doing:
return render(request,'some template' , {'context':context})
You do:
 return TemplateResponse.

Thanks.
jenia

On Sep 28, 6:25 pm, jenia ivlev  wrote:
> Hello:
>
> I have defined a middleware class. and i have added it to the
> middleware_classes attribute in setting. When a request comes in, the
> middleware class gets created (the debugger catches the code when the
> breakpoint is on the class CommonFiilter(): line)
>
> Now i expect the function  def process_template_response(self,
> request, response): to get called. I have debug point on the inside of
> the function and the debugger never traps the execution. The debugger,
> though, traps the execution at the line where the function name and
> parameters are defined.
> This is the class:
>
> class CommonFilter(): DEBUGGER BREAKS HERE
>     def process_template_response(self, request, response): DEBUGGER
> BREAKS HERE
>         if response.template_name=='store/index2.html': NOT HERE(or
> after this line)
>             catnames=getCategories()
>
> response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
>         return response
>
> Hello:
>
> I have defined a middleware class. and i have added it to the
> middleware_classes attribute in setting. When a request comes in, the
> middleware class gets created (the debugger catches the code when the
> breakpoint is on the class CommonFiilter(): line)
>
> Now i expect the function  def process_template_response(self,
> request, response): to get called. I have debug point on the inside of
> the function and the debugger never traps the execution. The debugger,
> though, traps the execution at the line where the function name and
> parameters are defined.
> This is the class:
>
> class CommonFilter(): DEBUGGER BREAKS HERE
>     def process_template_response(self, request, response): DEBUGGER
> BREAKS HERE
>         if response.template_name=='store/index2.html': NOT HERE(or
> after this line)
>             catnames=getCategories()
>
> response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
>         return response
>
> Also tried this:
>
> class CommonFilter(): DEBUGGER BREAKS HERE
>     def process_template_response(self, request, response): DEBUGGER
> BREAKS HERE
>         if response.template_name=='store/index2.html': NOT HERE(or
> after here)
>             catnames=getCategories()
>             response.context_data['catnames']=catnames
>
> response.context_data['user']=request.GET.get(key='user',default=None)
>         return response
>
> Just in case, this is the setting MIDDLEWWARE_CLASSES variable:
>
>     MIDDLEWARE_CLASSES = (
>                       'store.models.CommonFilter',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
>     )
>
> store is an app in this project and ofcourse CommonFilter is defined
> in models.py.
>
> Why is the function process_template_response function not being
> executed?
>
> Thanks for your time and kind concern.


Sorry for the

-- 
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: You -- yes, you -- should contribute to Django.

2011-09-28 Thread Kurtis
Out of curiosity, is this a good place to start?
https://code.djangoproject.com/query?status=!closed&easy=1

On Sep 28, 10:33 pm, Kurtis Mullins  wrote:
> Thanks Shawn. And nice speech! I didn't realize there were so many open
> tickets -- especially any as trivial as that. I'll try to do my part. Like
> you said, it's a great way to learn more about Django anyways.
>
> On Wed, Sep 28, 2011 at 1:53 PM, Cal Leeming [Simplicity Media Ltd] <
>
>
>
>
>
>
>
> cal.leem...@simplicitymedialtd.co.uk> wrote:
> > There seems like there's quite a few good talks in this video, will put
> > some time aside tonight and watch :) Lightning talks are such a good idea -
> > wish I had used the same concept on my last talks :L
>
> > On Wed, Sep 28, 2011 at 6:49 PM, Cal Leeming [Simplicity Media Ltd] <
> > cal.leem...@simplicitymedialtd.co.uk> wrote:
>
> >> Well said, Shawn!
>
> >> On Wed, Sep 28, 2011 at 6:10 PM, Shawn Milochik wrote:
>
> >>> This is my lightning talk, given at DjangoCon US 2011.
>
> >>> If you're on this list and have never submitted a patch to the Django
> >>> project because you think you aren't "good enough" yet, please watch
> >>> this.
>
> >>> Skip to about 11:45, and watch for about four minutes.
> >>>http://blip.tv/djangocon/lightning-talks-thurs-am-5582168
>
> >>> Thanks,
> >>> Shawn
>
> >>> --
> >>> 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.

-- 
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: You -- yes, you -- should contribute to Django.

2011-09-28 Thread Kurtis Mullins
Thanks Shawn. And nice speech! I didn't realize there were so many open
tickets -- especially any as trivial as that. I'll try to do my part. Like
you said, it's a great way to learn more about Django anyways.

On Wed, Sep 28, 2011 at 1:53 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> There seems like there's quite a few good talks in this video, will put
> some time aside tonight and watch :) Lightning talks are such a good idea -
> wish I had used the same concept on my last talks :L
>
>
> On Wed, Sep 28, 2011 at 6:49 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Well said, Shawn!
>>
>>
>> On Wed, Sep 28, 2011 at 6:10 PM, Shawn Milochik wrote:
>>
>>> This is my lightning talk, given at DjangoCon US 2011.
>>>
>>> If you're on this list and have never submitted a patch to the Django
>>> project because you think you aren't "good enough" yet, please watch
>>> this.
>>>
>>> Skip to about 11:45, and watch for about four minutes.
>>> http://blip.tv/djangocon/lightning-talks-thurs-am-5582168
>>>
>>> Thanks,
>>> Shawn
>>>
>>> --
>>> 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.
>

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



problem with middle - correctly formatted 2

2011-09-28 Thread jenia ivlev
Hello:

I have defined a middleware class. and i have added it to the
middleware_classes attribute in setting. When a request comes in, the
middleware class gets created (the debugger catches the code when the
breakpoint is on the class CommonFiilter(): line)

Now i expect the function  def process_template_response(self,
request, response): to get called. I have debug point on the inside of
the function and the debugger never traps the execution. The debugger,
though, traps the execution at the line where the function name and
parameters are defined.
This is the class:

class CommonFilter(): DEBUGGER BREAKS HERE
def process_template_response(self, request, response): DEBUGGER
BREAKS HERE
if response.template_name=='store/index2.html': NOT HERE(or
after this line)
catnames=getCategories()
 
response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
return response

Hello:

I have defined a middleware class. and i have added it to the
middleware_classes attribute in setting. When a request comes in, the
middleware class gets created (the debugger catches the code when the
breakpoint is on the class CommonFiilter(): line)

Now i expect the function  def process_template_response(self,
request, response): to get called. I have debug point on the inside of
the function and the debugger never traps the execution. The debugger,
though, traps the execution at the line where the function name and
parameters are defined.
This is the class:

class CommonFilter(): DEBUGGER BREAKS HERE
def process_template_response(self, request, response): DEBUGGER
BREAKS HERE
if response.template_name=='store/index2.html': NOT HERE(or
after this line)
catnames=getCategories()
 
response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
return response

Also tried this:

class CommonFilter(): DEBUGGER BREAKS HERE
def process_template_response(self, request, response): DEBUGGER
BREAKS HERE
if response.template_name=='store/index2.html': NOT HERE(or
after here)
catnames=getCategories()
response.context_data['catnames']=catnames
 
response.context_data['user']=request.GET.get(key='user',default=None)
return response

Just in case, this is the setting MIDDLEWWARE_CLASSES variable:

MIDDLEWARE_CLASSES = (
  'store.models.CommonFilter',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

store is an app in this project and ofcourse CommonFilter is defined
in models.py.

Why is the function process_template_response function not being
executed?

Thanks for your time and kind concern.

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



problem with middleware - correctly formatted

2011-09-28 Thread jenia ivlev
Hello:

This is the second version of my question. I reformatted it.

I have defined a middleware class. and i have added it to the
middleware_classes attribute in setting. When a request comes in, the
middleware class gets created (the debugger catches the code when the
breakpoint is on the class CommonFiilter(): line)

Now i expect the function  def process_template_response(self,
request, response): to get called. I have debug point on the inside of
the function and the debugger never traps the execution. The debugger,
though, traps the execution at the line where the function name and
parameters are defined.
This is the class:

class CommonFilter():#< debugger breaks here
def process_template_response(self, request, response): #<---
debugger breaks here
if response.template_name=='store/index2.html': #<--- NOT
HERE(or after this line)
catnames=getCategories()
 
response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
return response

Also tried this:

class CommonFilter():#< debugger breaks here
def process_template_response(self, request, response):#<
debugger breaks here
if response.template_name=='store/index2.html':#<--- NOT
HERE(or after here)
catnames=getCategories()
response.context_data['catnames']=catnames
 
response.context_data['user']=request.GET.get(key='user',default=None)
return response

Just in case, this is the setting MIDDLEWWARE_CLASSES variable:

MIDDLEWARE_CLASSES = (
  'store.models.CommonFilter',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

store is an app in this project and ofcourse CommonFilter is defined
in models.py.

Why is the function process_template_response function not being
executed?

Thanks for your time and kind concern.

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



problem with middleware

2011-09-28 Thread jenia ivlev
Hello:

I have defined a middleware class. and i have added it to the
middleware_classes attribute in setting. When a request comes in, the
middleware class gets created (the debugger catches the code when the
breakpoint is on the class CommonFiilter(): line)

Now i expect the function  def process_template_response(self,
request, response): to get called. I have debug point on the inside of
the function and the debugger never traps the execution. The debugger,
though, traps the execution at the line where the function name and
parameters are defined.
This is the class:

class CommonFilter():#< debugger breaks here
def process_template_response(self, request, response): #<---
debugger breaks here
if response.template_name=='store/index2.html': #<--- NOT HERE
(or after this line)
catnames=getCategories()
 
response.context_data.update({'catnames':catnames,'user':request.GET.get(key='user',default=None)})
return response

Also tried this:

class CommonFilter():#< debugger breaks here
def process_template_response(self, request, response):#<
debugger breaks here
if response.template_name=='store/index2.html':#<--- NOT HERE
(or after here)
catnames=getCategories()
response.context_data['catnames']=catnames
 
response.context_data['user']=request.GET.get(key='user',default=None)
return response

Just in case, this is the setting MIDDLEWWARE_CLASSES variable:

MIDDLEWARE_CLASSES = (
  'store.models.CommonFilter',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

store is an app in this project and ofcourse CommonFilter is defined
in models.py.

Why is the function process_template_response function not being
executed?

Thanks for your time and kind concern.

-- 
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: Problem on user profile

2011-09-28 Thread jenia ivlev
Thanks but it wasnt this. I was tired and didnt see some gross
mistakes.
Thanks for your help though

On Sep 28, 6:01 am, Thomas Orozco  wrote:
> You might be importing your models.py file multiple time, thus registering
> the signals multiple times.
>
> You should look into the signals documentation - you can avoid duplicate
> signal handlers and this is covered there.
> Le 28 sept. 2011 14:44, "Lingfeng Xiong"  a écrit :

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

2011-09-28 Thread shacker
 

Our Django sites get literally hundreds of bogus 404 requests per day. For 
example:

Referrer: http://domain.edu/ 
Requested URL: /signup/
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;)
IP address: 168.9.86.2

The "referrer" line is a lie because nowhere on our site do we point to 
"/signup" . I've given up trying to figure out how these things are 
generated or how to block them. But I would like to limit the number of 
daily emails to just the actual/legit 404s. So I started 
using IGNORABLE_404_URLS, per:

https://docs.djangoproject.com/en/dev/howto/error-reporting/#errors

IGNORABLE_404_URLS = (
   re.compile(r'\.(php|cgi)$'),
re.compile(r'^/forums'),
re.compile(r'^/signup'),
re.compile(r'/src/'),
re.compile(r'/pdf/'),
)

Unfortunately this seems to have no effect. Shouldn't the regex pattern 
there catch the bogus request domain.edu/signup ? Or is this not working 
because the way the requests are being submitted somehow bypasses Django's 
ability to catch it as an error? I'm just not clear what's going on here.

Thanks.

-- 
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/-/7xxDzuRZue4J.
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: You -- yes, you -- should contribute to Django.

2011-09-28 Thread Cal Leeming [Simplicity Media Ltd]
There seems like there's quite a few good talks in this video, will put some
time aside tonight and watch :) Lightning talks are such a good idea - wish
I had used the same concept on my last talks :L

On Wed, Sep 28, 2011 at 6:49 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Well said, Shawn!
>
>
> On Wed, Sep 28, 2011 at 6:10 PM, Shawn Milochik wrote:
>
>> This is my lightning talk, given at DjangoCon US 2011.
>>
>> If you're on this list and have never submitted a patch to the Django
>> project because you think you aren't "good enough" yet, please watch
>> this.
>>
>> Skip to about 11:45, and watch for about four minutes.
>> http://blip.tv/djangocon/lightning-talks-thurs-am-5582168
>>
>> Thanks,
>> Shawn
>>
>> --
>> 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: You -- yes, you -- should contribute to Django.

2011-09-28 Thread Cal Leeming [Simplicity Media Ltd]
Well said, Shawn!

On Wed, Sep 28, 2011 at 6:10 PM, Shawn Milochik  wrote:

> This is my lightning talk, given at DjangoCon US 2011.
>
> If you're on this list and have never submitted a patch to the Django
> project because you think you aren't "good enough" yet, please watch
> this.
>
> Skip to about 11:45, and watch for about four minutes.
> http://blip.tv/djangocon/lightning-talks-thurs-am-5582168
>
> Thanks,
> Shawn
>
> --
> 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.



You -- yes, you -- should contribute to Django.

2011-09-28 Thread Shawn Milochik
This is my lightning talk, given at DjangoCon US 2011.

If you're on this list and have never submitted a patch to the Django
project because you think you aren't "good enough" yet, please watch
this.

Skip to about 11:45, and watch for about four minutes.
http://blip.tv/djangocon/lightning-talks-thurs-am-5582168

Thanks,
Shawn

-- 
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: Disable HTTP Referer checking

2011-09-28 Thread Tom Evans
On Wed, Sep 28, 2011 at 4:03 PM, sspross  wrote:
> hi tom
>
> thanks for your reply, but
>
> i'm don't want to disable a whole view, just disabling the http
> referer checking in https.
>
> silvan
>

Oh I see - my bad.

There's no way to disable this check, looking at the source code.

The CSRF middleware will automatically accept a request, regardless of
the referrer/CSRF tokens provided, if the request has the attribute
'_dont_enforce_csrf_checks' set to True.
This is meant to be for the test suite to skip CSRF checks (I think),
but you could abuse it, eg by adding some middleware which checks that
the call is valid and adding that attribute if you think the request
is genuine.

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: Disable HTTP Referer checking

2011-09-28 Thread sspross
hi tom

thanks for your reply, but

i'm don't want to disable a whole view, just disabling the http
referer checking in https.

silvan

On Sep 28, 4:56 pm, Tom Evans  wrote:
> On Wed, Sep 28, 2011 at 3:45 PM, sspross  wrote:
> > hi
>
> > is it possible to deactivate the http referer checking in the Cross
> > Site Request Forgery protection?
>
> >https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>
> > a flash application sends my django app a form and in flash we can't
> > set an Referer Header. So in case of HTTPS it fails.
>
> > regards,
> > silvan
>
> On the page you linked to:
>
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#csrf-protecti...
>
> HTH
>
> 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: Disable HTTP Referer checking

2011-09-28 Thread Tom Evans
On Wed, Sep 28, 2011 at 3:45 PM, sspross  wrote:
> hi
>
> is it possible to deactivate the http referer checking in the Cross
> Site Request Forgery protection?
>
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/
>
> a flash application sends my django app a form and in flash we can't
> set an Referer Header. So in case of HTTPS it fails.
>
> regards,
> silvan
>

On the page you linked to:

https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#csrf-protection-should-be-disabled-for-just-a-few-views

HTH

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.



Disable HTTP Referer checking

2011-09-28 Thread sspross
hi

is it possible to deactivate the http referer checking in the Cross
Site Request Forgery protection?

https://docs.djangoproject.com/en/dev/ref/contrib/csrf/

a flash application sends my django app a form and in flash we can't
set an Referer Header. So in case of HTTPS it fails.

regards,
silvan

-- 
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: Community Wiki/CMS app

2011-09-28 Thread Thomas Guettler


Am 28.09.2011 10:08, schrieb Kevin:
> I will recommend using Pinax for this particular type of site.
> 
> http://pinaxproject.com/
> 
> I am not sure if Pinax has an included Mailing list app, but there
> should be one available at djangopackages.com
> 
> If Pinax is a little too much, try out Django-cms:  
> https://www.django-cms.org/

Have you every used Pinax? I looked at the mailing list  Maybe I am wrong, 
but I can't see a healthy community there.

Same here: nearly no code changes in the last weeks: 
https://github.com/pinax/pinax/commits/master/

  Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
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: Best practices to create multiple users profiles using Auth

2011-09-28 Thread Santiago Basulto
Thank you Ryan. I'll read it. Seems interesting.

On Sep 27, 10:30 am, ryan west  wrote:
> I actually just wrote a blog post about why I think extending
> contrib.auth.models.User is a better solution to using a OneToOneField
> (or a ForeignKey), you can find it here:
>
> http://ryanwest.info/blog/2011/django-tip-5-extending-contrib-auth-mo...
>
> Please let me know what you think.
>
> Regards,
>
> Ryan
>
> On Sep 27, 5:13 am, SantiagoBasulto
> wrote:
>
>
>
>
>
>
>
> > Hello friends,
>
> > i'm new with django. I've something to ask you.
>
> > I'm building a website similar to eBay where i've different "kinds" of
> > users. These are: CustomerUser and SellerUser. Both of them has
> > different data to be saved.
>
> > While reading docs and django book i noted the UserProfile
> > "trick" (https://docs.djangoproject.com/en/1.3/topics/auth/#storing-
> > additional-information-about-users) to store additional info about my
> > users. The problem is that i've two different users, not just one.
>
> > I'm wondering what would be the best choice. I've think that i could
> > use some inheritance, keeping the UserProfile strategy.
>
> > class UserProfile(models.Model):
> >     # some common data
> >     user = models.OneToOneField(User)
>
> > class Seller(UserProfile):
> >     #specific Seller data
>
> > class Customer(UserProfile):
> >     #specific Customer data
>
> > I tried to make that work, but i coulnd. I ran into several errors.
>
> > After that i thought i could include oneToOne info in the UserProfile,
> > similiar to:
>
> > class UserProfile(models.Model):
> >     is_seller = models.BooleanField()
> >     is_customer = models.BooleanField()
> >     seller_info = models.OneToOneField(SellerInfo)
> >     customer_info = models.OneToOneField(CustomerInfo)
> >     user = models.OneToOneField(User)
>
> > class SellerInfo(models.Model):
> >     #specific Seller data
>
> > class CustomerInfo(models.Model):
> >     #specific Customer data
>
> > I think this should work, but also think that would be a "weird and
> > ugly" solution.
>
> > Have you expirienced this kind of problem? Can you help me with some
> > idea please?
>
> > Thank you very much!

-- 
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: Subclassing the ForeignKey field type

2011-09-28 Thread Tobia Conforto
Konk wrote:
> As for what you are doing, I don't think subclassing ForeignKeys is
> the way to go. Currently they defer most of the work to their target
> fields, you might try to do something similar with the features you're
> trying to add.

Problem solved: I just didn't have to put __metaclass__ = SubfieldBase in my 
ForeignKey subclass.

Tobia

-- 
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/-/3W6EurP3RwsJ.
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: psycopg2 pickling error

2011-09-28 Thread Andre Terra
Thanks for providing this feedback, Tom. I read your original question but I
wasn't sure of the answer, so it's good to know how you worked it out!

Best regards,
AT

On Wed, Sep 28, 2011 at 4:51 AM, tom  wrote:

> Hello,
>
> I have solved the problem with the support from newrelic, the issue was
> related to the configuration of wsgi. I have 3 VHosts for the application. I
> switched from wsgi embedded mode to daemon mode. Additionally I have added
> these two lines for each VHost:
>
> WSGIDaemonProcess www.agileamp.com user=user group=group processes=2
> threads=15 display-name=%{GROUP}
> WSGIProcessGroup www.agileamp.com
>
> Best regards, Tom
>
> --
> 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/-/Q6WENc5zBYMJ.
>
> 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: Problem on user profile

2011-09-28 Thread Thomas Orozco
You might be importing your models.py file multiple time, thus registering
the signals multiple times.

You should look into the signals documentation - you can avoid duplicate
signal handlers and this is covered there.
Le 28 sept. 2011 14:44, "Lingfeng Xiong"  a écrit :

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



Problem on user profile

2011-09-28 Thread Lingfeng Xiong
hi there,
I wanna build a user portal for my website. When a user log in, it can
modify it's profile in this portal. I have already followed "https://
docs.djangoproject.com/en/1.3/topics/auth/" and created a class named
UserProfile with "AUTH_PROFILE_MODULE = '.UserProfile' in
settings.py. I also added
[code]
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user = instance)

post_save.connect(create_user_profile, sender = user)
[/code]
at the end of models.py.
But this script cannot work well. When I add a user in admin site, a
error would raise with
[code]
IntegrityError at /admin/auth/user/add/

column User_id is not unique

Request Method: POST
Request URL:http://localhost:8000/admin/auth/user/add/
Django Version: 1.3.1
Exception Type: IntegrityError
Exception Value:

column User_id is not unique

Exception Location: /home/bear/work/django/djangoenv/lib/python2.7/
site-packages/Django-1.3.1-py2.7.egg/django/db/backends/sqlite3/
base.py in execute, line 234
Python Executable:  /home/bear/work/django/djangoenv/bin/python
Python Version: 2.7.2
Python Path:

['/home/bear/work/django/ciscoaaa',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/
distribute-0.6.15-py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/pip-1.0-
py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/
Django-1.3.1-py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7',
 '/home/bear/work/django/djangoenv/lib/python2.7/plat-linux2',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-tk',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-old',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages']

Server time:Wed, 28 Sep 2011 20:16:02 +0800
[/code]


BTW: I wanna make a user portal which allow users to modify their
profiles by themselves. Can I use Admin Site to do this? Or I have to
write a brand-new web page for this? 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.



Facebook csrf middleware problem

2011-09-28 Thread Amit Sethi
Hi all , I am writing that shall be a facebook canvas app as well as a
standard app at the same time. Now for the time being I am just
working with removing csrf from my middleware classes but does anyone
know about a project that handles this more effectively such that i
can use csrf middleware for my standard app and exempts it when
request comes from facebook

-- 
A-M-I-T S|S

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



FOSS VOIP Framework compatible with DJango?

2011-09-28 Thread Alec Taylor
Good afternoon,

Do you know of a FOSS VOIP Framework compatible with DJango?

Currently the only one I've found is Plivo.

Basically I'm building a social-network, and want people to be able to
call eachother, even to the extend of making and recording conference
calls, all through a web-interface (Java or Flash).

Thanks for all suggestions,

Alec Taylor

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



Getting testing to report multiple tests per-assertion vs. per test-method

2011-09-28 Thread Tim Chase
Is there an easy way to get Django's test framework to report on 
the number of assertions performed instead of the number of 
test-methods called?  I have things like


   def test_date_fenceposts(self):
 date_result_tuples_to_test = (
   (date(2011,4,1), 35),
   ... #however many test dates I need for fencepost checks
   )
 for date, result in date_result_tuples_to_test:
   self.assertEqual(process(date), result)

However when I "./manage.py test" this, I only get one test 
result, but I'd like to know that this actually tested 
len(date_result_tuples_to_test) assertions.


Any way to get the desired output?

-tkc



--
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: Media wiki

2011-09-28 Thread Kevin
You can see a list of all available Django wiki software here:

http://www.djangopackages.com/grids/g/wikis/

Also note that Pinax also comes with a wiki App you can use as well,
plus many other features.

On Sep 28, 6:17 am, Anoop Thomas Mathew  wrote:
> Hi,
>
> If you want a basic wiki, you can tryhttp://uswaretech.com/demo/djikiki/
> Its not maintained well now, still, this might be enough to start with.
>
> Thanks,
> Anoop
>
> atm
> ___
> Life is short, Live it hard.
>
> On 28 September 2011 14:20, Kirupashankar Sampath 
> wrote:
>
>
>
>
>
>
>
> > I am relatively new to django..I am trying to think of ways to
> > implement mediawiki concepts in a django wikipage...any ideas of
> > how to approach..
>
> > --
> > 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: password_reset_form_save() got an unexpected keyword argument 'request'

2011-09-28 Thread Karen Tracey
On Mon, Sep 26, 2011 at 7:31 PM, Ben O'Day  wrote:

> I recently upgraded to Django 1.3 (from 1.2) and noticed that our
> password reset functionality isn't working.  I do have the templates
> customized, but am using the default view/form files for this.
> Looking at the django.contrib.auth.views file, I can't see the issue
> either (the parameters in the opt dict seem to match the expected
> params on the form, etc)
>
> here is my urls.py config...
> [snip]
>
> here is the error...any ideas?
>
> Request Method: POST
> Request URL:http://127.0.0.1:8000/password_reset/
> Django Version: 1.3 SVN-16907
>

So based on this info you are using the latest (or thereabouts) 1.3.X
branch, not 1.3 release, right?


> Exception Type: TypeError
> Exception Value:
>
> password_reset_form_save() got an unexpected keyword argument
> 'request'
>

password_reset_form_save() doesn't exist in stock Django code, so this looks
a bit odd.

Exception Location: c:\projects\dasn\django\django\contrib\auth
> \views.py in password_reset, line 155
>

This line is:
https://code.djangoproject.com/browser/django/branches/releases/1.3.X/django/contrib/auth/views.py#L155

form.save(**opts)

The message you would get there if opts had an unexpected keyword argument
is:

save() got an unexpected keyword argument 'request'

It looks to me like you have something custom in the Django code -- where is
that password_reset_form_save function coming from? (It also doesn't appear
that passing request to the password reset form is new in 1.3.)

Karen
-- 
http://tracey.org/kmt/

-- 
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: Media wiki

2011-09-28 Thread Anoop Thomas Mathew
Hi,

If you want a basic wiki, you can try http://uswaretech.com/demo/djikiki/
Its not maintained well now, still, this might be enough to start with.

Thanks,
Anoop

atm
___
Life is short, Live it hard.




On 28 September 2011 14:20, Kirupashankar Sampath wrote:

> I am relatively new to django..I am trying to think of ways to
> implement mediawiki concepts in a django wikipage...any ideas of
> how to approach..
>
> --
> 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.



Media wiki

2011-09-28 Thread Kirupashankar Sampath
I am relatively new to django..I am trying to think of ways to
implement mediawiki concepts in a django wikipage...any ideas of
how to approach..

-- 
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: Extracting the database name from an object

2011-09-28 Thread Cal Leeming [Simplicity Media Ltd]
Lol - that makes more sense :)

Thanks for the clarification Tom!

On Wed, Sep 28, 2011 at 10:31 AM, Tom Evans wrote:

> On Tue, Sep 27, 2011 at 8:21 PM, Andre Terra  wrote:
> > It doesn't hurt to remind him that methods that begin with _ are
> considered
> > unstable API and are subject to change/removal without previous notice.
> >
> >
> > Cheers,
> > AT
> >
>
> However, that API is documented in a release, and so is now subject to
> deprecation/POLA rules, so feel free to use it until you start seeing
> PendingDeprecationWarning.
>
> https://docs.djangoproject.com/en/1.3/topics/db/multi-db/#an-example
>
> 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: Extracting the database name from an object

2011-09-28 Thread Tom Evans
On Tue, Sep 27, 2011 at 8:21 PM, Andre Terra  wrote:
> It doesn't hurt to remind him that methods that begin with _ are considered
> unstable API and are subject to change/removal without previous notice.
>
>
> Cheers,
> AT
>

However, that API is documented in a release, and so is now subject to
deprecation/POLA rules, so feel free to use it until you start seeing
PendingDeprecationWarning.

https://docs.djangoproject.com/en/1.3/topics/db/multi-db/#an-example

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: Community Wiki/CMS app

2011-09-28 Thread Kevin
I will recommend using Pinax for this particular type of site.

http://pinaxproject.com/

I am not sure if Pinax has an included Mailing list app, but there
should be one available at djangopackages.com

If Pinax is a little too much, try out Django-cms:  https://www.django-cms.org/

Django-CMS even has a nice demo site where you can try out all the
main features that come with it out of the box.

For your Mailing list app, check out Colibri:
http://labs.freehackers.org/projects/colibri/wiki

Both Pinax and Django-CMS have nice documentation for installation and
testing.  Deploying is like any other Django project.

On Sep 28, 1:59 am, Thomas Guettler  wrote:
> Hi,
>
> a group of intelligent, but non computer-nerd people, asked me for help. They 
> want to build a community page:
>
>  - simple homepage/wiki
>  - news
>  - members with login
>  - mailing list
>
> I develop with django daily. Since I don't want to reinvent the wheel,
> I search django app which can handle most of this.
>
> I have seen the comparison grids onhttp://djangopackages.com/but I am unsure, 
> and don't
> have much time for the decision.
>
> Any feedback welcome,
>
>   Thomas Güttler
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de

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



Helping someone move from Joomla to Django

2011-09-28 Thread Kevin
Hello,

  I have a friend who is doing website design, not any backend
programming tasks.  He actually would like me to do the backend
coding.  The unfortunate case is that he is currently using Joomla,
which I know almost nothing about, and the apps/plugins for it are not
reusable in other website frameworks, not even other PHP frameworks,
icky!  I really enjoy Django because if you create a reusable app, and
say use Pinax, it will most likely work as well in say Django-CMS or
another CMS build on top of Django and Python.

  This question is really for anyone who has previously used Joomla
and knows how the editor works for web designers and content
managers.  I have seen and used it's site manager only a few times.  I
took a look at both Pinax and Django-CMS.  After looking at Django-
CMS, it has a similar feel to that of Joomla with in page editing and
is overall very simple for a content manager/web designer.  It's also
very straight forward and supports a lot right out of the box.

  My current task with my friend is to create a music player, I have
been working with jPlayer recently and finding out how I can integrate
it with Joomla, haven't took too much time yet.  I'm quiet happy about
that choice now, since Django-CMS actually has a plugin just for this
player.

  How would you recommend I go about this task of moving my friend
over to a Django/Python based system over a Joomla/PHP based system?
How easy will it be to say convert a Joomla template to a Django
compatible one?  This will be another issue, is template management.
Since there is really no standard for website templates, every CMS/
framework uses it's own system.  I believe Joomla's templates even
embed PHP code directly into the template itself, another icky.

  I am going to pitch the idea and use the jPlayer plugin for Django-
CMS as a sweet spot.  I'm also tempted on copying over all the
existing content to a Django-CMS site to show him how it will look and
feel.

  He is requesting some other interesting features, which apparently
someone else is working on implementing, and it's actually taking this
other person a few days, or maybe weeks to add.  Where I know I can
implement it in Django in a matter of hours.  If the other person is a
PHP programmer, me pitching this idea may scare the other person.  PHP
programmers are sometimes very proud and are hard to turn.  I, myself
used to be like this, that is until I found myself getting byte by a
huge Python, it's venom changed my life entirely.  I saw the light.

  What is everyone elses opinions on development in Django verses a
rival CMS such as Joomla?  Just looking at how the Joomla source tree
is scares me from even looking at how to code anything in it.  After
using Django for awhile, I like how nicely everything is organized.

-- 
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: psycopg2 pickling error

2011-09-28 Thread tom
Hello,

I have solved the problem with the support from newrelic, the issue was 
related to the configuration of wsgi. I have 3 VHosts for the application. I 
switched from wsgi embedded mode to daemon mode. Additionally I have added 
these two lines for each VHost:

WSGIDaemonProcess www.agileamp.com user=user group=group processes=2 
threads=15 display-name=%{GROUP}
WSGIProcessGroup www.agileamp.com

Best regards, Tom

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