Re: empty request object

2016-02-27 Thread Larry Martell
Yes, you are absolutely correct. Thanks for directing me away from
that red herring. But it seems request.user no longer exists.

There is code that does this:

if request.user.is_authenticated():

which throws:

AttributeError: "'WSGIRequest' object has no attribute 'user'"

On Sat, Feb 27, 2016 at 5:48 PM, knbk  wrote:
> I was referring to the wrong release notes. The rights one can be found in
> the 1.8 release notes in the miscellaneous section[1]:
>
>> HttpRequest now has a simplified repr (e.g. > '/somepath/'>). This won’t change the behavior of
>> theSafeExceptionReporterFilter class.
>
>
> Printing the request in your debugger is nothing more than calling repr on
> the request and displaying the result. The conclusion is the same: the
> request is not empty, but the string representation of the request has
> changed. This is unrelated to whatever issue you're facing.
>
> [1] https://docs.djangoproject.com/en/1.9/releases/1.8/#miscellaneous
>
> On Saturday, February 27, 2016 at 11:21:18 PM UTC+1, larry@gmail.com
> wrote:
>>
>> On Sat, Feb 27, 2016 at 5:14 PM, knbk  wrote:
>> > The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not
>> > an
>> > accurate description of what is actually contained in the request, and I
>> > doubt it has anything to do with the actual issues you're facing.
>> >
>> > [1]
>> >
>> > https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting
>>
>> I am printing the request object from the debugger:
>>
>> (Pdb) request
>> 
>>
>> This is not in the debug page. I'm pretty sure it's empty as when I
>> call login(request) I get a blank page with a 200 back.
>>
>> >
>> > On Saturday, February 27, 2016 at 11:09:28 PM UTC+1, larry@gmail.com
>> > wrote:
>> >>
>> >> On Sat, Feb 27, 2016 at 5:02 PM, James Schneider
>> >>  wrote:
>> >> >
>> >> > On Feb 27, 2016 1:55 PM, "Larry Martell"  wrote:
>> >> >>
>> >> >> Anyone have any insights on this? Is there anything special I need
>> >> >> to
>> >> >> do get the request structure? The way this 1.9 site is now, it
>> >> >> doesn't
>> >> >> work at all because the request structure is not getting passed in.
>> >> >>
>> >> >
>> >> > I'd be most suspicious of middle ware not handling the request
>> >> > correctly.
>> >>
>> >> I tried removing all the middleware, but I got the same result. This
>> >> is the middleware that was in place:
>> >>
>> >> 'django.middleware.security.SecurityMiddleware',
>> >> 'django.contrib.sessions.middleware.SessionMiddleware',
>> >> 'django.middleware.common.CommonMiddleware',
>> >> 'django.middleware.csrf.CsrfViewMiddleware',
>> >> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> >> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>> >> 'django.contrib.messages.middleware.MessageMiddleware',
>> >> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> >> 'django.middleware.security.SecurityMiddleware',
>> >>
>> >>
>> >> > Have you tried moving to a fresh venv to ensure Django and other
>> >> > packages
>> >> > aren't damaged?
>> >> >
>> >> > Can you replicate the issue on a separate test server?
>> >>
>> >> No, I haven't tried either one yet. I guess I will have to do that,
>> >> but I really would like to just get this setup working.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY74FYRzT-DKkTT8g80vzx_y5p1T7VJWWwb8i%2B2FfMOr0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: empty request object

2016-02-27 Thread knbk
I was referring to the wrong release notes. The rights one can be found in 
the 1.8 release notes in the miscellaneous section[1]:

HttpRequest 
> 
>  now 
> has a simplified repr (e.g. ). This won’t 
> change the behavior of theSafeExceptionReporterFilter 
> 
>  class.


Printing the request in your debugger is nothing more than calling repr on 
the request and displaying the result. The conclusion is the same: the 
request is not empty, but the string representation of the request has 
changed. This is unrelated to whatever issue you're facing. 

[1] https://docs.djangoproject.com/en/1.9/releases/1.8/#miscellaneous

On Saturday, February 27, 2016 at 11:21:18 PM UTC+1, larry@gmail.com 
wrote:
>
> On Sat, Feb 27, 2016 at 5:14 PM, knbk > 
> wrote: 
> > The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not 
> an 
> > accurate description of what is actually contained in the request, and I 
> > doubt it has anything to do with the actual issues you're facing. 
> > 
> > [1] 
> > 
> https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting
>  
>
> I am printing the request object from the debugger: 
>
> (Pdb) request 
>  
>
> This is not in the debug page. I'm pretty sure it's empty as when I 
> call login(request) I get a blank page with a 200 back. 
>
> > 
> > On Saturday, February 27, 2016 at 11:09:28 PM UTC+1, larry@gmail.com 
> > wrote: 
> >> 
> >> On Sat, Feb 27, 2016 at 5:02 PM, James Schneider 
> >>  wrote: 
> >> > 
> >> > On Feb 27, 2016 1:55 PM, "Larry Martell"  
> wrote: 
> >> >> 
> >> >> Anyone have any insights on this? Is there anything special I need 
> to 
> >> >> do get the request structure? The way this 1.9 site is now, it 
> doesn't 
> >> >> work at all because the request structure is not getting passed in. 
> >> >> 
> >> > 
> >> > I'd be most suspicious of middle ware not handling the request 
> >> > correctly. 
> >> 
> >> I tried removing all the middleware, but I got the same result. This 
> >> is the middleware that was in place: 
> >> 
> >> 'django.middleware.security.SecurityMiddleware', 
> >> 'django.contrib.sessions.middleware.SessionMiddleware', 
> >> 'django.middleware.common.CommonMiddleware', 
> >> 'django.middleware.csrf.CsrfViewMiddleware', 
> >> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
> >> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
> >> 'django.contrib.messages.middleware.MessageMiddleware', 
> >> 'django.middleware.clickjacking.XFrameOptionsMiddleware', 
> >> 'django.middleware.security.SecurityMiddleware', 
> >> 
> >> 
> >> > Have you tried moving to a fresh venv to ensure Django and other 
> >> > packages 
> >> > aren't damaged? 
> >> > 
> >> > Can you replicate the issue on a separate test server? 
> >> 
> >> No, I haven't tried either one yet. I guess I will have to do that, 
> >> but I really would like to just get this setup working. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/890bb238-7980-4b12-bdf2-400379b31ee7%40googlegroups.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e31049c-82cc-4587-bb18-c06e683e65a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


form dynamic javascript input in django

2016-02-27 Thread xristos sarantis
i want to create html form with dynamic input javascript on django
but the javascript script not connect with the form
the code

{% csrf_token %}

Book
































Submit




$(document).ready(function() {
// Initialize the date picker for the original due date field
$('#dueDatePicker')
.datepicker({
format: '/mm/dd'
})
.on('changeDate', function(evt) {
// Revalidate the date field
$('#taskForm').formValidation('revalidateField', 
$('#dueDatePicker').find('[name="dueDate[]"]'));
});

$('#taskForm')
.formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
'task[]': {
// The task is placed inside a .col-xs-6 element
row: '.col-xs-6',
validators: {
notEmpty: {
message: 'The task is required'
}
}
},
'dueDate[]': {
// The due date is placed inside a .col-xs-4 element
row: '.col-xs-4',
validators: {
notEmpty: {
message: 'The due date is required'
},
date: {
format: '/MM/DD',
min: new Date(),
message: 'The due date is not valid'
}
}
}
}
})

.on('added.field.fv', function(e, data) {
if (data.field === 'dueDate[]') {
// The new due date field is just added
// Create a new date picker
data.element
.parent()
.datepicker({
format: '/mm/dd'
})
.on('changeDate', function(evt) {
// Revalidate the date field
$('#taskForm').formValidation('revalidateField', 
data.element);
});
}
})

// Add button click handler
.on('click', '.addButton', function() {
var $template = $('#taskTemplate'),
$clone= $template
.clone()
.removeClass('hide')
.removeAttr('id')
.insertBefore($template);

// Add new fields
// Note that we DO NOT need to pass the set of validators
// because the new field has the same name with the original one
// which its validators are already set
$('#taskForm')
.formValidation('addField', $clone.find('[name="task[]"]'))
.formValidation('addField', $clone.find('[name="dueDate[]"]'))
})

// Remove button click handler
.on('click', '.removeButton', function() {
var $row = $(this).closest('.form-group');

// Remove fields
$('#taskForm')
.formValidation('removeField', $row.find('[name="task[]"]'))
.formValidation('removeField', $row.find('[name="dueDate[]"]'));

// Remove element containing the fields
$row.remove();
});
});


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/14774758-d10a-4fa3-b8cc-5b26730ff23e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


javascript,html form and django

2016-02-27 Thread xristos sarantis
hello

i want ta create a html form using javascript dynamic input
but the javascript script not working,where is wrong ?

my code html form...


{% csrf_token %}

Book
































Submit





javascript


$(document).ready(function() {
var titleValidators = {
row: '.col-xs-4',   // The title is placed inside a 
element validators: { notEmpty: { message: 'The title is required' } } }, isbnValidators = { row: '.col-xs-4', validators: { notEmpty: { message: 'The ISBN is required' }, isbn: { message: 'The ISBN is not valid' } } }, priceValidators = { row: '.col-xs-2', validators: { notEmpty: { message: 'The price is required' }, numeric: { message: 'The price must be a numeric number' } } }, bookIndex = 0; $('#bookForm') .formValidation({ framework: 'bootstrap', icon: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { 'book[0].title': titleValidators, 'book[0].isbn': isbnValidators, 'book[0].price': priceValidators } }) // Add button click handler .on('click', '.addButton', function() { bookIndex++; var $template = $('#bookTemplate'), $clone= $template .clone() .removeClass('hide') .removeAttr('id') .attr('data-book-index', bookIndex) .insertBefore($template); // Update the name attributes $clone .find('[name="title"]').attr('name', 'book[' + bookIndex + '].title').end() .find('[name="isbn"]').attr('name', 'book[' + bookIndex + '].isbn').end() .find('[name="price"]').attr('name', 'book[' + bookIndex + '].price').end(); // Add new fields // Note that we also pass the validator rules for new field as the third parameter $('#bookForm') .formValidation('addField', 'book[' + bookIndex + '].title', titleValidators) .formValidation('addField', 'book[' + bookIndex + '].isbn', isbnValidators) .formValidation('addField', 'book[' + bookIndex + '].price', priceValidators); }) // Remove button click handler .on('click', '.removeButton', function() { var $row = $(this).parents('.form-group'), index = $row.attr('data-book-index'); // Remove fields $('#bookForm') .formValidation('removeField', $row.find('[name="book[' + index + '].title"]')) .formValidation('removeField', $row.find('[name="book[' + index + '].isbn"]')) .formValidation('removeField', $row.find('[name="book[' + index + '].price"]')); // Remove element containing the fields $row.remove(); });}); -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a541281f-31b9-4b08-9f29-b39d010d13a8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Re: empty request object

2016-02-27 Thread Larry Martell
On Sat, Feb 27, 2016 at 5:14 PM, knbk  wrote:
> The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not an
> accurate description of what is actually contained in the request, and I
> doubt it has anything to do with the actual issues you're facing.
>
> [1]
> https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting

I am printing the request object from the debugger:

(Pdb) request


This is not in the debug page. I'm pretty sure it's empty as when I
call login(request) I get a blank page with a 200 back.

>
> On Saturday, February 27, 2016 at 11:09:28 PM UTC+1, larry@gmail.com
> wrote:
>>
>> On Sat, Feb 27, 2016 at 5:02 PM, James Schneider
>>  wrote:
>> >
>> > On Feb 27, 2016 1:55 PM, "Larry Martell"  wrote:
>> >>
>> >> Anyone have any insights on this? Is there anything special I need to
>> >> do get the request structure? The way this 1.9 site is now, it doesn't
>> >> work at all because the request structure is not getting passed in.
>> >>
>> >
>> > I'd be most suspicious of middle ware not handling the request
>> > correctly.
>>
>> I tried removing all the middleware, but I got the same result. This
>> is the middleware that was in place:
>>
>> 'django.middleware.security.SecurityMiddleware',
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> 'django.middleware.security.SecurityMiddleware',
>>
>>
>> > Have you tried moving to a fresh venv to ensure Django and other
>> > packages
>> > aren't damaged?
>> >
>> > Can you replicate the issue on a separate test server?
>>
>> No, I haven't tried either one yet. I guess I will have to do that,
>> but I really would like to just get this setup working.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/890bb238-7980-4b12-bdf2-400379b31ee7%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY69Sr5aY2fCkOJ-Qa_ffWe1RTg-MwtFPpZm_VSx7FQsiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: empty request object

2016-02-27 Thread knbk
The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not an 
accurate description of what is actually contained in the request, and I 
doubt it has anything to do with the actual issues you're facing. 

[1] 
https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting

On Saturday, February 27, 2016 at 11:09:28 PM UTC+1, larry@gmail.com 
wrote:
>
> On Sat, Feb 27, 2016 at 5:02 PM, James Schneider 
> > wrote: 
> > 
> > On Feb 27, 2016 1:55 PM, "Larry Martell"  > wrote: 
> >> 
> >> Anyone have any insights on this? Is there anything special I need to 
> >> do get the request structure? The way this 1.9 site is now, it doesn't 
> >> work at all because the request structure is not getting passed in. 
> >> 
> > 
> > I'd be most suspicious of middle ware not handling the request 
> correctly. 
>
> I tried removing all the middleware, but I got the same result. This 
> is the middleware that was in place: 
>
> 'django.middleware.security.SecurityMiddleware', 
> 'django.contrib.sessions.middleware.SessionMiddleware', 
> 'django.middleware.common.CommonMiddleware', 
> 'django.middleware.csrf.CsrfViewMiddleware', 
> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
> 'django.contrib.messages.middleware.MessageMiddleware', 
> 'django.middleware.clickjacking.XFrameOptionsMiddleware', 
> 'django.middleware.security.SecurityMiddleware', 
>
>
> > Have you tried moving to a fresh venv to ensure Django and other 
> packages 
> > aren't damaged? 
> > 
> > Can you replicate the issue on a separate test server? 
>
> No, I haven't tried either one yet. I guess I will have to do that, 
> but I really would like to just get this setup working. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/890bb238-7980-4b12-bdf2-400379b31ee7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: empty request object

2016-02-27 Thread Larry Martell
On Sat, Feb 27, 2016 at 5:02 PM, James Schneider
 wrote:
>
> On Feb 27, 2016 1:55 PM, "Larry Martell"  wrote:
>>
>> Anyone have any insights on this? Is there anything special I need to
>> do get the request structure? The way this 1.9 site is now, it doesn't
>> work at all because the request structure is not getting passed in.
>>
>
> I'd be most suspicious of middle ware not handling the request correctly.

I tried removing all the middleware, but I got the same result. This
is the middleware that was in place:

'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',


> Have you tried moving to a fresh venv to ensure Django and other packages
> aren't damaged?
>
> Can you replicate the issue on a separate test server?

No, I haven't tried either one yet. I guess I will have to do that,
but I really would like to just get this setup working.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY6TO4odbJW%2BDpGnsKg%3DuiR3j69vYUTNuPrto1Hsu74Rcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: empty request object

2016-02-27 Thread James Schneider
On Feb 27, 2016 1:55 PM, "Larry Martell"  wrote:
>
> Anyone have any insights on this? Is there anything special I need to
> do get the request structure? The way this 1.9 site is now, it doesn't
> work at all because the request structure is not getting passed in.
>

I'd be most suspicious of middle ware not handling the request correctly.

Have you tried moving to a fresh venv to ensure Django and other packages
aren't damaged?

Can you replicate the issue on a separate test server?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXkpmsxMQop800Hrq2PsG766MX0kNc7ry7kLEcgfMMUEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: empty request object

2016-02-27 Thread Larry Martell
Anyone have any insights on this? Is there anything special I need to
do get the request structure? The way this 1.9 site is now, it doesn't
work at all because the request structure is not getting passed in.

On Fri, Feb 26, 2016 at 10:09 PM, Larry Martell  wrote:
> I just integrated a broken django setup, 1.9, python 2.7, nginx,
> uWSGI, RHEL 6. First thing I observed, the views are not receiving
> anything in the request object, e.g.:
>
> (Pdb) print request
> 
>
> Other django systems I've worked with I always get something, e.g.:
>
> (Pdb) print request
>  path:/,
> GET:,
> POST:,
> COOKIES:{'csrftoken': 'ieefjZZJjeif993i4nfmnkZZKJ',
>  'messages': 
> '2f148ec0f66f94740a8ff273dd544b554d28c96c$[["__json_message",0,20,"The
> tool \\"U7316\\" was added successfully."],["__json_message",0,20,"The
> tool \\"U7321\\" was added successfully."],["__json_message",0,20,"The
> tool \\"SEMA116\\" was added
> successfully."],["__json_message",0,20,"The tool \\"U7324\\" was added
> successfully."],["__json_message",0,20,"The tool \\"U7324\\" was
> changed successfully."],["__json_message",0,20,"The tool \\"SEMA116\\"
> was changed successfully."],["__json_message",0,20,"The tool
> \\"U7331\\" was added successfully."],["__json_message",0,20,"The tool
> \\"SEMA207\\" was added successfully."]]',
>  'sessionid': 'xg254b6ki5m981n8oko4n88jnqsj0m1y'},
> META:{'Apple_PubSub_Socket_Render': '/tmp/launch-FIgPyl/Render',
> .
> .
> .
>
> I've never seen this before. What could be causing this? Where would I
> being to look?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY7PdxT%3DF3g21LzEyMQ2qAuAB8EjRV9bi5Q5JAo-T6TUeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use selenium automated testing in django projects

2016-02-27 Thread Dan Tagg
Harry Percival is very good
http://www.obeythetestinggoat.com

Not sure if he covers Excel

Dan
On 27 Feb 2016 13:22, "Vikneswaran S J"  wrote:

> I need to use selenium automated testing for django application with input
> from excel sheet. How to use use this feature? any idea?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0868a7b8-652a-40c5-b80f-d56159ad15af%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPZHCY60busYmHGENCo1u2%3DbsSDjvb7-3EP9K3ZogD1PoOETtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Session recycling during login times out

2016-02-27 Thread Stodge
The title is misleading; it should probably be "Session recycling stalls 
during login".

I also noticed that logout stalls.

On Saturday, February 27, 2016 at 3:12:08 PM UTC-5, Stodge wrote:
>
> I'm trying to diagnose a problem where noone can login to my django site. 
> The login attempt times out as NGINX (proxy) gives up waiting for Apache to 
> respond. There are no errors in the logs anywhere. I copied the Django code 
> into my app to debug:
>
> def this_real_login(request, user):
>> """
>> Persist a user id and a backend in the request. This way a user 
>> doesn't
>> have to reauthenticate on every request. Note that data set during
>> the anonymous session is retained when the user logs in.
>> """
>> if user is None:
>> user = request.user
>> # TODO: It would be nice to support different login methods, like 
>> signed cookies.
>> if SESSION_KEY in request.session:
>> if request.session[SESSION_KEY] != user.pk:
>> # To avoid reusing another user's session, create a new, empty
>> # session if the existing session corresponds to a different
>> # authenticated user.
>> print("DEBUG: Flushing session")
>> request.session.flush()
>> print("DEBUG: Flushed session")
>> else:
>> print("DEBUG: Cycling session")
>> request.session.cycle_key()
>> print("DEBUG: Cycled session")
>> request.session[SESSION_KEY] = user.pk
>> request.session[BACKEND_SESSION_KEY] = user.backend
>> if hasattr(request, 'user'):
>> request.user = user
>> print("DEBUG: Rotating token")
>> rotate_token(request)
>> print("DEBUG: Rotated token")
>
>
> It appears to stall inside:
>
>  request.session.cycle_key()
>
> Does anyone have any ideas why this might be? I'm scouring this code but I 
> can't see anything amiss.
>
> Thanks
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bbc36dd-b467-4390-bf4a-4847896ebb6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Session recycling during login times out

2016-02-27 Thread Stodge
I'm trying to diagnose a problem where noone can login to my django site. 
The login attempt times out as NGINX (proxy) gives up waiting for Apache to 
respond. There are no errors in the logs anywhere. I copied the Django code 
into my app to debug:

def this_real_login(request, user):
> """
> Persist a user id and a backend in the request. This way a user doesn't
> have to reauthenticate on every request. Note that data set during
> the anonymous session is retained when the user logs in.
> """
> if user is None:
> user = request.user
> # TODO: It would be nice to support different login methods, like 
> signed cookies.
> if SESSION_KEY in request.session:
> if request.session[SESSION_KEY] != user.pk:
> # To avoid reusing another user's session, create a new, empty
> # session if the existing session corresponds to a different
> # authenticated user.
> print("DEBUG: Flushing session")
> request.session.flush()
> print("DEBUG: Flushed session")
> else:
> print("DEBUG: Cycling session")
> request.session.cycle_key()
> print("DEBUG: Cycled session")
> request.session[SESSION_KEY] = user.pk
> request.session[BACKEND_SESSION_KEY] = user.backend
> if hasattr(request, 'user'):
> request.user = user
> print("DEBUG: Rotating token")
> rotate_token(request)
> print("DEBUG: Rotated token")


It appears to stall inside:

 request.session.cycle_key()

Does anyone have any ideas why this might be? I'm scouring this code but I 
can't see anything amiss.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f969cfe-9528-4935-a3ef-008b9e4433c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2016-02-27 Thread James Schneider
On Feb 27, 2016 11:49 AM, "Mike Kipling"  wrote:
>
> I am working through the Django tutorial Writing your first Django app,
part 1.
> I am using Windows 10, python 3.5.1 and Django 1.9.2 .
>
> In the Write your first view section:
> after writing the polls/views.py and polls/urls.py files,
> and modifying the manage/urls.py file,
> and starting the server,
>
> When I go to http://localhost:8000/polls/ in the browser I get the
following error:
>
> Page not found (404)
> Request Method:
> GET
> Request URL:
> http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
patterns, in this order:
>
> ^admin/
>
> The current URL, polls/, didn't match any of these.
>

It doesn't appear that you've included your apps urls.py correctly using an
include() in your project urls.py.

Can you post both of your urls.py files?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWixxatHfJ2736W9S8k8jCsgaF1DSu3j1AcTdDRZtbEMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Error running Django tutorial

2016-02-27 Thread Mike Kipling
I am working through the Django tutorial *Writing your first Django app, 
part 1.*
I am using Windows 10, python 3.5.1 and Django 1.9.2 .
 
In the *Write your first view* section:  
after writing the polls/views.py and polls/urls.py files, 
and modifying the manage/urls.py file, 
and starting the server,
 
When I go to http://localhost:8000/polls/ in the browser I get the 
following error:

Page not found (404) 
Request Method: GET 
Request URL: http://localhost:8000/polls/

Using the URLconf defined in mysite.urls, Django tried these URL patterns, 
in this order:

   1. ^admin/

The current URL, polls/, didn't match any of these.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/adde5d06-3663-48d7-b359-c1b984b91ffc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Default Site

2016-02-27 Thread Sergiy Khohlov
This is task for apache not for django.
G
26 лют. 2016 23:06  пише:
> no
> Hi,
>
>
> Shouldn’t django.contrib.sites.models.SiteManager.get_current() first
check the given request to determine the current site and then look at the
SITE_ID setting?
>
>
> I would like to have multiple Sites and choose the current site based on
the context of the request, but fall back to the configured SITE_ID setting
if there doesn’t happen to be a request available.
>
>
> Is this a bug or am I missing something?
>
>
> Thanks,
>
>
> - Doug
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/fe79eaa4-a276-423d-bdb8-bda0759977b2%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJMrn-oMxD%3DQ57bpbw6%3DTOhz39tVgLEv5bE0vpb9VBbd1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Provide way to add an item during "Selecting a ForeignKey"

2016-02-27 Thread guettli
 

I use django-select2  for easy 
ForeignKey picking. Works nice.


But how can I add a new item in the ForeignKey table?


I would like to have a big [+] button and then a dialog should open.


AFAIK django-select2 does not help here. Is there a different library which 
can help here?


The result should look like this "create user" example: 
https://jqueryui.com/dialog/#modal-form


I don't care how the pop-up works. 


Via ajax, browser pop-up, or like in django admin, ... 


It should work and be re-usable. I don't want to invent this common pattern 
again and again.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb9f73b4-dec1-42bd-b3a3-81ecfe044bd7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use selenium automated testing in django projects

2016-02-27 Thread Vikneswaran S J
I need to use selenium automated testing for django application with input 
from excel sheet. How to use use this feature? any idea?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0868a7b8-652a-40c5-b80f-d56159ad15af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: errors while trying to add extra context (detailview, __getitem__)

2016-02-27 Thread James Schneider
On Fri, Feb 26, 2016 at 6:04 PM, Malik Rumi  wrote:

> JAMES wrote:  >>> Can you post the entire section for your urls.py, as
> well as the entire traceback? Nothing is immediately jumping out at me. Do
> you get this error when you start the Django server, or when you visit the
> page that matches this URL?
>
> *This error comes when I try to start the server.*
>
> *I am starting the traceback here because at first I had it as a free
> standing module and not inside views.py, but i thought they said a view is
> a callable and so can be anywhere and be named anything?*
>
>  File "/home/malikarumi/Projects/cannon/jamf/essell/urls.py", line 14, in
> 
> url(r'code/', CodeDetail.as_view(template_name='code_family_detail')),
> AttributeError: 'module' object has no attribute 'as_view'
>
> *Why? It is clearly subclassed from list view. I got it straight from the
> docs*
>
> https://docs.djangoproject.com/en/1.9/topics/class-based-views/mixins/
>
> *Then I put it in views.py. Now I see an unhandled exception, but I don't
> know what it means or what to do about it.*
>
>  File "/home/malikarumi/Projects/cannon/jamf/essell/urls.py", line 9, in
> 
> from essell.views import CodeDetail
> ImportError: cannot import name CodeDetail
> Unhandled exception in thread started by  0x7f85a2b7e230>
>

Did you catch the ImportError here? Everything else is going to tumble
until that gets fixed.

I noticed that you use both CodeDetail and CodeDetailView. Near as I can
tell, they are both supposed to be the same (or one was created as part of
the troubleshooting process here).

I would highly, highly recommend that you standardize on one or the other
(my preference is the latter). It seems like you may be dealing with two
different views and getting the names crossed.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV5HiWBwsoHQB_2qgxhPBoa5RNJUJWK_PhY3J-Br2ZSAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: errors while trying to add extra context (detailview, __getitem__)

2016-02-27 Thread James Schneider
>
> > urlpatterns = patterns(['',
> > url(r'^$', TemplateView.as_view(template_name='library.html')),
> > url(r'code/',
> CodeDetail.as_view(template_name='code_family_detail')),
>
> You've got CodeDetail instead of CodeDetailView, is that correct? That's
> not the class that you posted earlier.
>

Additionally, "detail" URL's typically contain a PK or a slug match,
because you need to know which object you want to find the details on. The
last URL you have listed here is more akin to a typical ListView.

Additionally to my addition, you are also lacking a $ at the end of the
regex, which means that your other views that do contain the (?P)
match will never hit, since 'code/' will match those URL's first before
ever reaching your true detail view. Probably not what you want.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThvUA_oryfkFtccM_LfTVo445cmKRoJb0XeHGD8wtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: errors while trying to add extra context (detailview, __getitem__)

2016-02-27 Thread James Schneider
On Fri, Feb 26, 2016 at 6:38 PM, Malik Rumi  wrote:

> *OK, so maybeMAYBE I've got this figured out. The problem is here:*
>
> https://docs.djangoproject.com/en/1.9/ref/urls/#django.conf.urls.url
>
>
> *I knew this, but note the examples still use the parens()*
>
>
> https://docs.djangoproject.com/en/1.9/ref/urls/#patterns
>
>
> *but that's what patterns is. It is a function. So it should have the
> parens. The problem is not the parens, but patterns() itself.*
>
> HOWEVER, I still have issues, if there are any night owls or people on the
> other side of the world who can help:
>
> error msg:
>
> Generic detail view CodeDetail must be called with either an object pk or a 
> slug.
>
> but I copied this *straight out of the docs! *All I did was changed the
> app names! See
> https://docs.djangoproject.com/en/1.9/topics/class-based-views/mixins/
>
> "We’ll rely on the default implementation of get_object() to fetch the
> correct Publisher object. However, we need to explicitly pass a queryset 
> argument
> because otherwise the default implementation of get_object() would call
> get_queryset() which we have overridden to return Book objects instead of
> Publisher ones. "
>
>
SingleObjectMixin looks for URL kwargs named 'pk' or 'slug' by default.
There's been a fair bit of cross-talk about which URL's are actually the
problem, but you only have one that would work for the view you are trying
to call: url(r'^code/(?P[\w-]+)/$', CodeDetailView.as_view(),
name='family'),

At this point I can't tell which URL you are talking about, so I don't know
if you are executing/matching the right one. The error would indicate that
you are matching just r'code/' without the (?P), so the view has no
way to look up the correct object to return.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX4s_nfs7DqbMRwtyprqM%3D7NkaGKXA1i59-Hq37WiE7Ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.