Search Results

Search found 119 results on 5 pages for 'hulk'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Django JSON serializable error

    - by Hulk
    With the following code below, There is an error saying File "/home/user/web_pro/info/views.py", line 184, in headerview, raise TypeError("%r is not JSON serializable" % (o,)) TypeError: <lastname: jerry> is not JSON serializable In the models code header(models.Model): firstname = models.ForeignKey(Firstname) lastname = models.ForeignKey(Lastname) In the views code headerview(request): header = header.objects.filter(created_by=my_id).order_by(order_by)[offset:limit] l_array = [] l_array_obj = [] for obj in header: l_array_obj = [obj.title, obj.lastname ,obj.firstname ] l_array.append(l_array_obj) dictionary_l.update({'Data': l_array}) ; return HttpResponse(simplejson.dumps(dictionary_l), mimetype='application/javascript') what is this error and how to resolve this? thanks..

    Read the article

  • Django syncdb error

    - by Hulk
    /mysite/project4 class notes(models.Model): created_by = models.ForeignKey(User) detail = models.ForeignKey(Details) Details and User are in the same module i.e,/mysite/project1 In project1 models i have defined class User(): ...... class Details(): ...... When DB i synced there is an error saying Error: One or more models did not validate: project4: Accessor for field 'detail' clashes with related field . Add a related_name argument to the definition for 'detail'. How can this be solved.. thanks..

    Read the article

  • queries in django

    - by Hulk
    How to query Employee to get all the address related to the employee, Employee.Add.all() doe not work.. class Employee(): Add = models.ManyToManyField(Address) parent = models.ManyToManyField(Parent, blank=True, null=True) class Address(models.Model): address_emp = models.CharField(max_length=512) description = models.TextField() def __unicode__(self): return self.name()

    Read the article

  • Copying contents of a model

    - by Hulk
    If there exists an old data of a model say , query=Emp.objects.filter(pk=profile.id) Is there a easier way to copy the same values into the same model again.. Now that the id will be different so.. I have this requirement. Thanks..

    Read the article

  • Django url parameters

    - by Hulk
    How to pass two paramters in urls in django <script> url=/toolbox/display/" + id + "2"; window.location=url; </script> Also how is this handeled in urls.py (r'^display/(?P<rid>\d+)/(?P<param>\d+)/$', 'table_display'), In views, def table_display(request,rid,param): print param //This should print 2

    Read the article

  • Django urls on json request

    - by Hulk
    When making a django request through json as, var info=id + "##" +name+"##" $.post("/supervise/activity/" + info ,[] , function Handler(data,arr) { } In urls.py (r'^activity/(?P<info>\d+)/$, 'activity'), In views, def activity(request,info): print info The request does not go through.info is a string.How can this be resolved Thanks..

    Read the article

  • Django many to many queries

    - by Hulk
    In the following, How to get designation when querying Emp sc=Emp.objects.filter(pk=profile.emp.id)[0] sc.desg //this gives an error class Emp(models.Model): name = models.CharField(max_length=255, unique=True) address1 = models.CharField(max_length=255) city = models.CharField(max_length=48) state = models.CharField(max_length=48) country = models.CharField(max_length=48) desg = models.ManyToManyField(Designation) class Designation(models.Model): description = models.TextField() title = models.TextField() def __unicode__(self): return self.board

    Read the article

  • Querying many to many fields in django

    - by Hulk
    In the models there is a many to many fields as, from emp.models import Name def info(request): name = models.ManyToManyField(Name) And in emp.models the schema is as class Name(models.Model): name = models.CharField(max_length=512) def __unicode__(self): return self.name Now when i want to query a particular id say for ex: info= info.objects.filter(id=a) for i in info: logging.debug(i.name) //gives an error how should the query be to get the name Thanks..

    Read the article

  • mysqldump from a query

    - by Hulk
    How do we take a mysql dump from the results of a query I need something like this.. `mysqldump -uroot -pxxxx mydb "select * from table where name='1';" /tmp/a Thanks

    Read the article

  • Get value of multiselect box using jquery or javascript

    - by Hulk
    In the code below, how to get the values of multiselect box in function val() using jquery or javascript. <script> function val() { //Get values of mutliselect drop down box } $(document).ready(function() { var flag=0; $('#emp').change(function() { var sub=$("OPTION:selected", this).val() if(flag == 1) $('#new_row').remove(); $('#topics').val(''); var html='<tr id="new_row" class="new_row"><td>Topics:</td><td> <select id="topic_l" name="topic_l" class="topic_l" multiple="multiple">'; var idarr =new Array(); var valarr =new Array(); {% for top in dict.tops %} idarr.push('{{top.is}}'); valarr.push('{{topic.ele}}'); {% endfor %} for (var i=0;i < idarr.length; i++) { if (sub == idarr[i]) { html += '<option value="'+idarr[i]+'" >'+valarr[i]+'</option>'; } } html +='</select></p></td></tr>'; $('#tops').append(html); flag=1; }); }); </script> Emp:&nbsp;&nbsp;&nbsp;&nbsp;<select id="emp" name="emp"> <option value=""></option> </select> <div name="tops" id="tops"></div> <input type="submit" value="Create Template" id="create" onclick="javascript:var ret=val();return ret;"> Thanks..

    Read the article

  • Copying contents of a module

    - by Hulk
    If there exists an old data of a model say , query=Emp.objects.filter(pk=profile.id) Is there a easier way to copy the same values into the same model again.. Now that the id will be different so.. I have this requirement. Thanks..

    Read the article

  • Django models query

    - by Hulk
    Code: class criteria(models.Model): details = models.CharField(max_length = 512) Headerid = models.ForeignKey(Header) def __unicode__(self): return self.id() the details corresponds to a textarea in the UI and a validation is done for 512 characters but when this is saved. /home/project/django/django/core/handlers/base.py in get_response, line 109 Is this any thing related with schema or number of characters entered from UI

    Read the article

  • Django template-printing variables

    - by Hulk
    In django views def add(request): dict{} co_data = optarr dict.update({'co_data' : co_data}) logging.debug(co_data) return render_to_response('scheme/create.html',context_instance=RequestContext(request,{'dict': dict})) And data has the following string 1##2##3##4## And in the template when i say {{co_data}} it doesnt display the values.Please point out whats wrong in the code. Thanks..

    Read the article

  • Django foreign key question

    - by Hulk
    All, i have the following model defined, class header(models.Model): title = models.CharField(max_length = 255) created_by = models.CharField(max_length = 255) def __unicode__(self): return self.id() class criteria(models.Model): details = models.CharField(max_length = 255) headerid = models.ForeignKey(header) def __unicode__(self): return self.id() class options(models.Model): opt_details = models.CharField(max_length = 255) headerid = models.ForeignKey(header) def __unicode__(self): return self.id() AND IN MY VIEWS I HAVE p= header(title=name,created_by=id) p.save() Now the data will be saved to header table .My question is that for this id generated in header table how will save the data to criteria and options table..Please let me know.. Thanks..

    Read the article

  • Django Foreign key queries

    - by Hulk
    In the following model: class header(models.Model): title = models.CharField(max_length = 255) created_by = models.CharField(max_length = 255) def __unicode__(self): return self.id() class criteria(models.Model): details = models.CharField(max_length = 255) headerid = models.ForeignKey(header) def __unicode__(self): return self.id() class options(models.Model): opt_details = models.CharField(max_length = 255) headerid = models.ForeignKey(header) def __unicode__(self): return self.id() If there is a row in the database for table header as Id=1, title=value-mart , createdby=CEO How do i query criteria and options tables to get all the values related to header table id=1 Also can some one please suggest a good link for queries examples, Thanks..

    Read the article

  • using distinct in django query

    - by Hulk
    There is a column as designation in the defaults table,How to get the distinct designation values from defaults table In the below the distinct applies on the id field, this need to be on designation field def = defaults.objects.filter(name=sc).distinct() And can some one explain what is flat=true condition Thanks..

    Read the article

  • Django javascript escape characters

    - by Hulk
    There is a text area in which the data is entered as, 122 //Enter button pushed Address Name //Enter button pushed 1 And the same is tored in the db.And the data is fetched in views and returned it to template as, <script> {% for i in dict.row_arr %} var ii= ('{{ i }}'); row_arr.push( ii ); {% endfor %} </script> Here there is an error as Error: unterminated string literal Line: 40, Column: 12 Source Code: var ii= ('1212 And when the html source shows up as, var ii= ('1212 1 21 11212121212'); row_arr.push( ii ); How should the escape function be applied here. Thanks..

    Read the article

  • remove element in javascript

    - by Hulk
    In the below code how to remove the hyperlink after getting the innerHTML function test(obj) { var a=obj.innerHTML // remove obj element here } $p = $('<a id="name" onclick="javascript:var ele=test(this);">').html( "test" ); $('#questions').append( $p ); Thanks..

    Read the article

  • Html generate data and print from another page

    - by Hulk
    In the below code, in a.html there is this code as, <div id="tableview"></div>//Data loaded dynamically <input type="button" id="printbtn" onclick="print()"/> <script> function print() { var data=$('#tableview').html(); dataobj.print(); } In b.html I need to print a.html without opening it ,But without opening it how will the data in the div get generated and how to print only this data from b.html Thanks..

    Read the article

  • Django updating db for selected ids

    - by Hulk
    In the following, New row values in DB are 6,8.They are the ids of a field I want to update these some other fields in the table based on these values row_newid=request.POST.get('row_updated_id') //Array row_newdata=request.POST.get('row_updated_data') //Array for newrow in row_newid: //how to update row_newdata for newrow values No for all the ids in row_newid how do i update row_newdata. row_newdata has the values 'a' and 'b' for example. thanks....

    Read the article

  • Accessing django choice field

    - by Hulk
    there is a module as header , from test.models import SEL_VALUES class rubrics_header(models.Model): sel_values = models.IntegerField(choices=SEL_VALUES) So when SEL_VALUES is imported from test.modules.What is the code that has to go in views to get the choices in sel_values . And the test.modules has the following, class SEL_VALUES: vaue = 0 value2 = 1 class Entries(forms.Form) : models.IntegerField(choices=SEL_VALUES) SEL_VALUES = ((ACCESS.value,'NAME'),(ACCESS.value2,'DESIGNATION'))

    Read the article

  • Django foreign key error

    - by Hulk
    In models the code is as, class header(models.Model): title = models.CharField(max_length = 255) created_by = models.CharField(max_length = 255) def __unicode__(self): return self.id() class criteria(models.Model): details = models.CharField(max_length = 255) headerid = models.ForeignKey(header) def __unicode__(self): return self.id() In views, p_l=header.objects.filter(id=rid) for rows in row_data: row_query =criteria(details=rows,headerid=p_l) row_query.save() In row_query =criteria(details=rows,headerid=p_l) there is an error saying 'long' object is not callable in models.py in __unicode__, What is wrong in the code Thanks..

    Read the article

  • vim superuser mode

    - by Hulk
    After opening a file in vim,And if that file is created by root .How to change the current user to superuser mode without quitting or before saving. Thanks.

    Read the article

  • Auto width on tables

    - by Hulk
    A html table cols and rows are generated dynamically, i.e, for the first instance it could be two rows and there columns. and next time it could be two rows and 10 columns My question is how to adjust the with automatically of the table so that the table always appears 100% in the page adjusting the coulmn size and row size <table> <tr><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td></tr> </table> <table> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> </table> Thanks..

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >