Re: Unresolved references error in Pycharm Community edition

2015-11-28 Thread aftnix

On শুক্রবার 27 নভে 2015 03:04 অপরাহ্ণ, Sneha R wrote:

Hi,

I am new to Pycharm and I am trying to run a Django project in Pycharm
Community edition 5.0.1 but there are few import errors saying
''Unresolved reference'" . I am using Python 2.7. How do I solve this
error ?

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


Obviously you would first at least try to run the project from command 
line using "python manage.py runserver" before doing anything with an 
IDE. IDE's are never good choice for django development IMHO


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


Re: Correct way to do async forms

2015-11-28 Thread Abu Ashraf Masnun
Hi, 

If you want to do it async, you need to use JavaScript to make ajax 
requests. And you need an endpoint that would respond to your ajax request. 
You can use the same django view to both serve the html and handle the JS 
request. However, that might make the business logic more complex. I would 
usually have a separate view for it. 

Regards,
Masnun



On Saturday, November 28, 2015 at 7:08:02 AM UTC+6, Jonty Needham wrote:
>
> Hi,
> I need to do a file upload in django where if the file fails appropriate 
> checks then an error is raised back to the user without 500ing the page.
>
> I've got a form that does what I want, however it returns the error in a 
> new page, but I want it returned in place. So I need an async call. What's 
> the correct easy to do all this? I've seen a method on line where I need to 
> write another view to take care of the form data but that seems ugly. It 
> seems like there should be a better easy in django.
>
> Thanks in advance.
> Jonty
>

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


Re: Unresolved references error in Pycharm Community edition

2015-11-28 Thread Dan Tagg
Agreed, but it is very good to use virualenv, a requirements file and then
set the PyCharm project interpreter to your virtualenv one, then PyCharm
picks up all the imports and can alert you if you're importing something
wrongly or if you want to view the declaration of a function. I also really
like django cookiecutter. https://github.com/pydanny/cookiecutter-django

Dan



On 28 November 2015 at 11:33, aftnix  wrote:

> On শুক্রবার 27 নভে 2015 03:04 অপরাহ্ণ, Sneha R wrote:
>
>> Hi,
>>
>> I am new to Pycharm and I am trying to run a Django project in Pycharm
>> Community edition 5.0.1 but there are few import errors saying
>> ''Unresolved reference'" . I am using Python 2.7. How do I solve this
>> error ?
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users+unsubscr...@googlegroups.com
>> .
>> To post to this group, send email to django-users@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>>
>> https://groups.google.com/d/msgid/django-users/52667e5d-998a-4b49-b3c9-b8c4d3842133%40googlegroups.com
>> <
>> https://groups.google.com/d/msgid/django-users/52667e5d-998a-4b49-b3c9-b8c4d3842133%40googlegroups.com?utm_medium=email&utm_source=footer
>> >.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Obviously you would first at least try to run the project from command
> line using "python manage.py runserver" before doing anything with an IDE.
> IDE's are never good choice for django development IMHO
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/565990F2.2030603%40gmail.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Wildman and Herring Limited, Registered Office: 52 Great Eastern Street,
London, EC2A 3EP, Company no: 05766374

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


Django rest framework - error 'TokenAuthentication' object has no attribute 'has_permission

2015-11-28 Thread Shekar Tippur


Hello,

I am trying to use oauth2 provider as described 
in 
http://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html#step-1-minimal-setup

'TokenAuthentication' object has no attribute 'has_permission.

Curl - curl -H "Authorization: Bearer $access_token" -H "Content-Type: 
application/json" -d '{"address": "afdsgsgsd", "another_address": 
"afedtgertretre"}'  -X POST http://localhost:8000/test

Here is my settings.py:


MIDDLEWARE_CLASSES = (
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'oauth2_provider.middleware.OAuth2TokenMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.security.SecurityMiddleware',
)


REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',

)
}


and my urls.py


url(r'^test', Test.as_view() , name='Test'),


Error I am getting:


Request Method:POSTRequest URL:http://localhost:8000/testDjango 
Version:1.8.6Exception Type:AttributeErrorException Value:

'TokenAuthentication' object has no attribute 'has_permission'

Exception 
Location:/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/rest_framework/views.py
 
in check_permissions, line 318Python Executable:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4Python 
Version:3.4.3Python Path:

['/Users/ctippur/PycharmProjects/dropboat',
 '/Users/ctippur/PycharmProjects/dropboat',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload',
 
'/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages']



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