django oauth2 create user with encrypted password

2015-04-30 Thread Shekar Tippur
Hello, I am trying to create user using django-oauth-toolkit module. I am follwing instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html I am able to create a user using basic curl curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMn

Django oauth2 password encrypt

2015-04-30 Thread Shekar Tippur
Hello, I am following instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html I am having trouble with creating a user with encrypted password. I am able to create a user with the call curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvc

Django oauth2 encrypt password

2015-04-30 Thread Shekar Tippur
Hello, I am following instructions under https://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html I am having trouble with creating a user with encrypted password. I am able to create a user with the call curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvc

'type' object is not iterable when I use any decorators

2015-05-03 Thread Shekar Tippur
Hello, Here is a decorator that I am trying ot use to restrict access to the class to only super users: Can someone please point me to what could be wrong. If I take the decorator, I am able to get thro but it is not restricted to only super users. @user_passes_test(lambda u: u.is_superuser) c

inspectdb on different Oracle schemas

2015-05-06 Thread Shekar Tippur
Hello, Is there a way to run inspactdb on different schemas? I have around 3 schemas and when I run inspectdb, I get details from just 1 schema. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.oracle', 'NAME': '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 1

Re: 'type' object is not iterable when I use any decorators

2015-05-06 Thread Shekar Tippur
ttp://www.django-rest-framework.org/api-guide/permissions/ > > Use that instead I think > > On Sun, May 3, 2015 at 2:35 PM, Shekar Tippur > wrote: > >> Hello, >> >> Here is a decorator that I am trying ot use to restrict access to the >> class to only supe

django handling requests - getting CSRF verification failed. Request aborted.

2015-05-28 Thread Shekar Tippur
Hello, I am trying to post a request via curl. I get a CSRF verification failed message. Here is the entry in my urls.py url(r'^setProfile/', AddToUserProfile), class AddToUserProfile(generics.ListAPIView): queryset = UserPrefs.objects.all() serializer_class = UserPrefSerializer cla

Re: django handling requests - getting CSRF verification failed. Request aborted.

2015-05-28 Thread Shekar Tippur
Larry, I think I needed to append as_view() to the url. url(r'^setProfile/', AddToUserProfile.as_view()), I will try the other curl option as well. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop recei

Django post response method post not allowed

2015-05-28 Thread Shekar Tippur
Hello, I am trying to post a request via curl. curl -H "Authorization: Bearer $usertoken" -X POST -d '{"username":"foo1","object":"XYZ","prefs":"likes"}' http://${endpoint}/setProfile/ Here is the entry in my urls.py url(r'^setProfile/', AddToUserProfile), class AddToUserProfile(generics.

Gjango - debugging argument of type <> is not iterable

2015-05-29 Thread Shekar Tippur
Hello, Acurl post request is throwing this error: Request Method:POSTRequest URL:http://127.0.0.1:8000/setProfile/Django Version:1.8Exception Type:TypeErrorException Value: argument of type 'ReadOnlyField' is not iterable Exception Location:/Library/Frameworks/Python.framework/Versions/3.4/l

Re: Gjango - debugging argument of type <> is not iterable

2015-05-29 Thread Shekar Tippur
type is error, case modules call > of django is incorrect > > 在 2015年5月29日星期五 UTC+8下午4:43:29,Shekar Tippur写道: >> >> >> Hello, >> >> Acurl post request is throwing this error: >> >> Request Method:POSTRequest URL:http://127.0.0.1:8000/setProfile/Django

Re: Gjango - debugging argument of type <> is not iterable

2015-05-29 Thread Shekar Tippur
If I change this to class Meta: *owner = serializers.ReadOnlyField(source='owner.username')* model = UserPrefs fields = ('owner', 'name', 'value') depth = 1 I get a error: {"value":["This field is required."]} -- You received this message because you are su

django - class based view store post data

2015-05-30 Thread Shekar Tippur
Hello, I am trying to use class based view to post data. I have come across a weird issue. It is not saving data in the backend. I get an error: Expected view AddToUserProfile to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the vie

Re: django - class based view store post data

2015-05-31 Thread Shekar Tippur
> > James, > > Thanks for responding. I have changed the view to: class AddToUserProfile(generics.CreateAPIView): permission_classes = (permissions.IsAuthenticatedOrReadOnly,IsOwnerOrReadOnly) queryset = UserPrefs.objects.all() serializer_class = UserPrefSerializer lookup_field

Re: django - class based view store post data

2015-05-31 Thread Shekar Tippur
> > James, > Thanks for the response. I followed your instructions and took out the overriding of post and get methods. However, as I am testing the app using curl, I ended up with CSRF verification failed. Request aborted. - Shekar -- You received this message because you are subscribed to

dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Hello, I am trying to save post data and I get a error. I am trying to use enum field. prefs' is an invalid keyword argument for this function Request Method:POSTRequest URL:http://127.0.0.1:8000/setPrefs/Django Version:1.8.2Exception Type:TypeError Here is my model class UserPrefs(models.Mo

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is the trace: Traceback: File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Library/Frameworks/Pytho

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Just to add, if I use a curl request curl -H "Authorization: Bearer $usertoken" -H "Content-Type: application/json" -X POST -d '{"user":"foo1","stock":"XYZ","prefs":"Likes"}' http://${endpoint}/addPrefs I get a error: {"prefs":["\"Likes\" is not a valid choice."]} If I use curl -H "Authori

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, I have commented save in model code. I have also changed the prefs field to be char(20) for now. I still get 'prefs' is an invalid keyword argument for this function - Shekar -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsu

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is my serializer class UserPrefSerializer(serializers.ModelSerializer): #user = serializers.ReadOnlyField(source='owner.username') def create(self, validated_data): print ("Validated data") print (validated_data) #return Screens.objects.create(**validated_data)

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, You are right. I am able to get past that issue. The next stumbling block is with null value in column "address_id" violates not-null constraint DETAIL: Failing row contains (10, Likes, null, null). Here is my curl curl -H "Authorization: Bearer $usertoken" -H "Content-Type: applicati

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
Here is my view. request.data has the 2 fields I am passing however serializer.validated_data has only prefs. class AddToUserProfile(generics.CreateAPIView): permission_classes = (permissions.IsAuthenticatedOrReadOnly,IsOwnerOrReadOnly) serializer_class = UserPrefSerializer querys

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James. address table already has a record of name xyz. Request object has a address value of address: xyz. As I am initializing serialize with request.data, why is it that I don't see it in validated_data? Do I need to add address_id to validated_data in my view? -- You received this message

Re: dhango class based views - Saving post data

2015-06-02 Thread Shekar Tippur
James, I was able to get thro with the save operation. It was quite a bit of learning. Meta section on the model existed but I was not populating validated_data properly. I was under the assumption that when I did serializer=UserPrefSerializer(data=request.data) seriazer object will be popu

Re: dhango class based views - Saving post data

2015-06-03 Thread Shekar Tippur
> > James, > My apologies. stock_id came in as a artefact of a bad copy/paste. The only deviation from what you have said is that the api call comes with a address string and not a id. But your solution works perfectly well as well. Here are the right ones: serializer=UserPrefSerializer(data=r

Re: dhango class based views - Saving post data

2015-06-03 Thread Shekar Tippur
gt; curl -H "Authorization: Bearer $usertoken" -H "Content-Type: > application/json" -X POST -d '{"address":"XYZ","prefs":"Likes"}' > http://${endpoint}/addPrefs > > Putting in an invalid address or prefs value s

Django rest framework and endpoints to use

2015-06-08 Thread Shekar Tippur
Hello, I am trying to use OAuthSwift to get authenticated to my app running using rest framework. I am following instruction from https://django-oauth-toolkit.readthedocs.org/en/0.3.2/tutorial/rest_framework_integration.html . Can you please indicate what URL I should be using to get myself va

neo4django - error cannot import name 'transactional'

2015-06-11 Thread Shekar Tippur
Hello, I am trying to use neo4django. I am at the getting started stage in the document: https://neo4django.readthedocs.org/en/latest/getting-started.html I am getting an error when I run it - cannot import name 'transactional' Wondering if someone can shed some light on this. I am using djan

Re: neo4django - error cannot import name 'transactional'

2015-06-11 Thread Shekar Tippur
Found he answer. Looks like neo4django is not supported in hte latest version of django. Infact development has stopped for a while on this plugin. Looked to be very promising. - S On Thursday, 11 June 2015 10:50:46 UTC-7, Shekar Tippur wrote: > > > Hello, > > I am trying to us

py2neo - how to get a node

2015-06-12 Thread Shekar Tippur
Hello, I am trying to use py2neo (http://py2neo.org/2.0/ext/ogm.html). I am having trouble looking up a node. Here is my code: lookupname="Shekar" Shekar=store.load_indexed('Person','Name','Shekar',Person) This returns a list. I want the complete object so that I can use in a relationship

django Object not iterable error

2015-06-15 Thread Shekar Tippur
Hello, This maybe a generic question. How do I troubleshoot something like this. The stacktrace is not really helpful as it does not point to the code that is causing this issue. TypeError at /product/ 'function' object is not iterable Request Method:POSTRequest URL:http://127.0.0.1:8000/p

Re: django Object not iterable error

2015-06-15 Thread Shekar Tippur
James, Is this what you mean? - Shekar > Environment:Request Method: POSTRequest URL: > http://127.0.0.1:8000/product/Django Version: 1.8.2Python Version: > 3.4.3Installed Applications:('django.contrib.admin', 'django.contrib.auth', > 'django.contrib.contenttypes', 'django.contrib.sessions'

Re: django Object not iterable error

2015-06-15 Thread Shekar Tippur
Here my urls.py urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^product/$', productviews, productviews.ProductList.as_view()), url(r'^product/(?P[0-9]+)$', productviews.ProductDetail.as_view()), ] *productviews.py* from product.models import Product from product.s

Re: django Object not iterable error

2015-06-15 Thread Shekar Tippur
> > Thank you! Thank you! Thank you! Sometimes I miss the most obvious things. Thanks again. - Shekar -- 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 djang

django oauth2 flow

2015-06-23 Thread Shekar Tippur
Hello, I would like some help with django oauth2 flow. I have created an app: *redirect_uri http://127.0.0.1:8000/accounts/login/ * *client_type public* *authorization_grant_type is authorization code* *name test* I have a client id and a secret. I want to

Re: django oauth2 flow

2015-06-25 Thread Shekar Tippur
Any updates on this please? I am stuck with this issue for quite a while now. -- 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...@googlegr

django dynamic serializers

2015-07-09 Thread Shekar Tippur
Hello, I have a source of data that can have a dynamic json structure. Is there a way to dynamically create models based on this? - Shekar -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails

Re: django dynamic serializers

2015-07-09 Thread Shekar Tippur
tied directly to the database schema, and I doubt you want to modify > your database schema dynamically based on incoming data. > > -James > > On Thu, Jul 9, 2015 at 1:20 PM, Shekar Tippur > wrote: > > Hello, > > > > I have a source of data t

Django foreign key in SlugRelatedField

2015-08-17 Thread Shekar Tippur
Hello, I am trying to create a form that takes input needed for parent child tables. I am unable to create records via post call. It is a simple parent child relationship. I want to be able to create the parent if it does not exist and create a child right after. I guess I am not able to unders

DRF and self join

2015-08-20 Thread Shekar Tippur
Hello, I am looking for a model/serializer/view for a self join. I can have nested paernt child relationship. The one I am trying: model: class ParentChild(models.Model): parent=models.CharField(max_length=100, blank=False, default='', unique =True) child=models.ForeignKey('self', bl

Re: DRF and self join

2015-08-23 Thread Shekar Tippur
is probably the hard part though. > > -James > On Aug 20, 2015 9:12 PM, "Shekar Tippur" > > wrote: > >> Hello, >> >> I am looking for a model/serializer/view for a self join. I can have >> nested paernt child relationship. >> >> The one

django-rest-framework-recursive view not returning ID

2015-08-23 Thread Shekar Tippur
Hello, I am using https://github.com/heywbj/django-rest-framework-recursive and it works great. I seem to have a small issue with it. When I try a GET operation on it, I dont seem to get the ID in the result. I want ID to be part of the result so that I can filter further on parent_id. Mo

Re: django-rest-framework-recursive view not returning ID

2015-08-23 Thread Shekar Tippur
James, My bad. Sorry an obvious mistake from my side. Yes, I had forgotten ID in the serializer field. - Shekar > > -- 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 ema

Recursive model queries

2015-08-26 Thread Shekar Tippur
Hello, I am trying to use https://github.com/heywbj/django-rest-framework-recursive I need to be able to run query on a recursive model that gives the name of the parent and child My model class RecursiveModel(models.Model): stage_title = models.CharField(max_length=255, unique=True) p

Django oauth2 extend auth.user result in errors

2015-09-23 Thread Shekar Tippur
I am sorry if this is a duplicate. I did post the same on Django REST Framework. I was not sure where I should post this. I am trying to add some custom fields to oauth2. I am using python 3.4 and django 1.8. I am having varying errors. But with the combination I got below, the error I get is

Re: Django oauth2 extend auth.user result in errors

2015-09-23 Thread Shekar Tippur
I have tried to follow https://docs.djangoproject.com/en/1.8/topics/auth/customizing/#a-full-example and i get an error: django.contrib.admin.sites.AlreadyRegistered: The model CustomUser is already registered -- You received this message because you are subscribed to the Google Groups "Dja

django rest framework - access token user

2015-10-01 Thread Shekar Tippur
Hello, I am trying to get the user name from a token request. Here is what I have so far: from rest_framework.authtoken.models import Token class getTokenl(generics.RetrieveDestroyAPIView): permission_classes = [permissions.IsAuthenticated, TokenHasReadWriteScope] queryset = Parcel.obj

django oauth and andriod authentication

2015-11-09 Thread Shekar Tippur
Hello, I am trying to get an android app authenticated via django oauth2. I am using https://github.com/wuman/android-oauth-client for generating the request Here is the generated uri http://localhost:8000/o/token/?client_id=rXBixkjnYvZf78HUm8Jw17fR2awHgV5nqGHfTAaE&redirect_uri=http://localhos

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 "Con

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

2015-11-29 Thread Shekar Tippur
My bad. This was due to the permissions I had set on my class based view. I took out the tokenauthentication and it now works well. - Shekar -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emai

django cursor fetchall change datetime.datetime and decimal stamp

2015-12-23 Thread Shekar Tippur
Hello, I am trying to use cursor to execute a sql and convert the results to a dictionary def dictfetchall(cursor): "Return all rows from a cursor as a dict" columns = [col[0] for col in cursor.description] return [ dict(zip(columns, row)) for row in cursor.fetchall()

Re: django cursor fetchall change datetime.datetime and decimal stamp

2015-12-23 Thread Shekar Tippur
> > I got it to work .. > def dictfetchall(cursor): "Returns all rows from a cursor as a dict" fieldnames = [name[0] for name in cursor.description] result = [] for row in cursor.fetchall(): rowset = [] for field in zip(fieldnames, row): L=list(field)

django 1.9 - application does not

2015-12-23 Thread Shekar Tippur
Hello, I have a application on my laptop and I am trying to move it to AWS. I have installed django 1.9 on aws server under a virtualhost and scp'd all my local files to aws server. Under the virtualhost, when I try to run the server, I get an error. $ python3.4 manage.py runserver 0.0.0.0:800

Re: django 1.9 - application does not

2015-12-24 Thread Shekar Tippur
Tim, I tried with --nothreading and I get the same error. $ python3.4 manage.py runserver --nothreading 0.0.0.0:8000 Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/ctippur/db/db_virtual/local/lib/python3.4/site-packa

Re: django 1.9 - application does not

2015-12-24 Thread Shekar Tippur
$ pip freeze Django==1.9 django-bootstrap3==6.2.2 django-debug-toolbar==1.4 django-rest-swagger==0.3.4 djangorestframework==3.3.2 djangorestframework-recursive==0.1.1 jsonpickle==0.9.2 PyYAML==3.11 requests==2.9.1 sqlparse==0.1.18 -- You received this message because you are subscrib

Re: django 1.9 - application does not

2015-12-24 Thread Shekar Tippur
Just for testing, I downgraded django to 1.8.4 # pip-3.4 install Django==1.8.4 You are using pip version 6.1.1, however version 7.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Collecting Django==1.8.4 Downloading Django-1.8.4-py2.py3-none-any.wh

Django linking static content to dynamic content

2016-01-27 Thread Shekar Tippur
Hello, I have implemented authentication via django allauth. I am trying to link UI which is loosely coupled with django. I am able to get to the index page by all other static content throes a 404 error. Appreciate any help on this. I have gone thro https://docs.djangoproject.com/en/1.8/howto/s

Re: Django linking static content to dynamic content

2016-01-27 Thread Shekar Tippur
James, Thanks for responding. This is just my development env. I have tried running collectstatic as well. I have included static file helpers. STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ] pr