hi, while trying to delete the datas from the datastore it shows the error...
BadArgumentError at /employee/removeall/ Expected an instance or iterable of (<class 'google.appengine.ext.db.Model'>, <class 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>); received <bound method Employeeprofile.key of <ITISMYAPP.main.models.Employeeprofile object at 0xb090aac>> (a instancemethod). Request Method: GET Request URL: http://localhost:9778/employee/removeall/ Exception Type: BadArgumentError Exception Value: Expected an instance or iterable of (<class 'google.appengine.ext.db.Model'>, <class 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>); received <bound method Employeeprofile.key of <ITISMYAPP.main.models.Employeeprofile object at 0xb090aac>> (a instancemethod). Exception Location: /home/user/google_appengine/google/appengine/api/datastore.py in NormalizeAndTypeCheck, line 148
//in my view
from ITISMYAPP.main.models import Employeeprofile from google.appengine.ext import db def removeall(request): employees =Employeeprofile.all().fetch(2000) employeekeys = [] for employee in employees: employeekeys.append(employee.key) db.delete(employeekeys) return render_to_response('main/index.html')
On Friday, 9 November 2012 11:33:53 UTC, muhammed riyas wrote:
> hi, > while trying to delete the datas from the datastore it shows the > error...
> BadArgumentError at /employee/removeall/ Expected an instance or iterable > of (<class 'google.appengine.ext.db.Model'>, <class > 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>); received > <bound method Employeeprofile.key of <ITISMYAPP.main.models.Employeeprofile > object at 0xb090aac>> (a instancemethod). Request Method: GET Request > URL: http://localhost:9778/employee/removeall/ Exception Type: > BadArgumentError Exception Value: Expected an instance or iterable of > (<class 'google.appengine.ext.db.Model'>, <class > 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>); received > <bound method Employeeprofile.key of <ITISMYAPP.main.models.Employeeprofile > object at 0xb090aac>> (a instancemethod). Exception Location: /home/user/google_appengine/google/appengine/api/datastore.py > in NormalizeAndTypeCheck, line 148
> //in my view
> from ITISMYAPP.main.models import Employeeprofile > from google.appengine.ext import db > def removeall(request): > employees =Employeeprofile.all().fetch(2000) > employeekeys = [] > for employee in employees: > employeekeys.append(employee.key) > db.delete(employeekeys) > return render_to_response('main/index.html')
> i dont know why?,,,,
You should ask AppEngine questions on the relevant AppEngine group, not here, as this is not a Django question.
But your problem is that `.key` is a method, not an attribute, so you should call it: `employee.key()`. -- DR.
muhammed riyas wrote:
> hi,
> while trying to delete the datas from the datastore it shows the
> error...
> BadArgumentError at /employee/removeall/ Expected an instance or iterable
> of (<class 'google.appengine.ext.db.Model'>, <class
> 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>);
> received <bound method Employeeprofile.key of
> <ITISMYAPP.main.models.Employeeprofile
> object at 0xb090aac>> (a instancemethod). Request Method: GET Request
> URL:
> http://localhost:9778/employee/removeall/ Exception Type:
> BadArgumentError Exception Value: Expected an instance or iterable of
> (<class 'google.appengine.ext.db.Model'>, <class
> 'google.appengine.api.datastore_types.Key'>, <type 'basestring'>);
> received <bound method Employeeprofile.key of
> <ITISMYAPP.main.models.Employeeprofile
> object at 0xb090aac>> (a instancemethod). Exception Location:
> /home/user/google_appengine/google/appengine/api/datastore.py in
> NormalizeAndTypeCheck, line 148
> //in my view
> from ITISMYAPP.main.models import Employeeprofile
> from google.appengine.ext import db
> def removeall(request):
> employees =Employeeprofile.all().fetch(2000)
> employeekeys = []
> for employee in employees:
> employeekeys.append(employee.key)
> db.delete(employeekeys)
> return render_to_response('main/index.html')
> i dont know why?,,,,
Hello,
Your question isn't related to Django, so it is not suitable for this group.
You should send questions about App Engine software to an App Engine-related group.
Having said that, the error message that you are getting is telling you that your employeekeys list does not contain keys, it contains references to the key method of each Employee instance in your query resultset.