javascript - no attribute '_meta' error when trying to run method to delete a row from a URL called by .get() -


it's part of project in django framework. in javascript file i'm writing code segment .get() url

e.g. /delete/student/<id_of_student> . . . $.get($(this).attr('href'), location.reload(true), function(data){ alert("put in bin !!"); }); . . 

when called , urls.py mapped function put row in trash_bin , page row deleted after reload.

but in runserver console it's throwing error like:

concrete_model = model._meta.concrete_model  attributeerror: type object 'builtin_function_or_method' has no attribute '_meta' 

but in console.log showing correct url, /delete/student/123.

here's trash part models.py :

class trashaction(models.model): user = models.foreignkey(user) timestamp = models.datetimefield()

def __unicode__(self):     return "%d items %s on %s" % (self.trashitem_set.count(), self.user, self.timestamp.strftime('%y-%m-%d %h:%m')) 

class trashitem(models.model): json_data = models.textfield() contenttype = models.foreignkey(contenttype) action = models.foreignkey(trashaction)

def __unicode__(self):     data = json.loads(self.json_data)[0]     return "%s[%d]" % (data['model'], data['pk']) 

here's view of trash.py :

def move_to_trash(request, obj): """ moves object trash bin. """

c = collector(using='default') c.collect([obj])  action = none  transaction.atomic():     action = trashaction()     action.user = request.user     action.timestamp = datetime.now()     action.save()      in c.instances_with_model():         item = trashitem()         item.action = action         item.contenttype = contenttype.objects.get_for_model(i[1])         item.json_data = serializers.serialize('json', [ i[1] ])         item.save()  obj.delete() 

def delete_product(request, student_id): move_to_trash(request, id)

could please me understand why error coming?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -