compiling python files in django
Hi, I have added one column in the table of mysql db using 'python manage.py syncdb' after deleting the table. Now from the home page, I am fetching the value of text area, and trying to put in the database. The value when written to flat file, is same as fetched, but when writing to database, it is inserting null. The code is- value fetched by- submit['grnvalue'] = request.GET.get('grnvalue', '') g = open('/c/coverity/ngcov.lst', 'a') g.write("branch=" + submit['branch'] + ";" + "arch=" + submit['arch'] + ";" + "targets=" + added_tgts + ";" + "schedule=" + submit['schedule'] + ";grn=" + submit['grnvalue']+"\n") g.close() In this file, I am getting the value as put in the text area having id 'grnvalue'. Now I am saving this to database- s = Subscribed(name=submit['branch'], status="Subscribed", targets=added_tgts, architecture=submit['arch'], release=submit['schedule'], running_time=0, user=owner, remarks=notify, grn=submit['grnvalue']) s.save() The database contains Table Subscribed where I have added column grn. All values are put, but grn field is filled empty all the time. Please help me in this issue. -- Best Regards, *M Shahid Siddiqui* DISCLAIMER: This message is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message and you will delete the mail. Sender accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including any damage from virus. Ce courriel et les pièces jointes s’y rattachant sont de nature personnelle, privilégiée et confidentielle et pour l’usage exclusif du destinataire à qui ils sont adressés et destinés. Si vous avez reçu ce courriel par erreur, veuillez s’il vous plaît le renvoyer à l’expéditeur. Si vous n’êtes pas le bon destinataire ou si vous croyez ne pas l’être, nous vous informons immédiatement que la publication, distribution, diffusion, copie ou plagiat de ce courriel et de ses pièces jointes sont strictement interdits. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
One column in table is not getting updated
Hi, I have added one column in the table of mysql db using 'python manage.py syncdb' after deleting the table. Now from the home page, I am fetching the value of text area, and trying to put in the database. The value when written to flat file, is same as fetched, but when writing to database, it is inserting null. The code is- value fetched by- submit['grnvalue'] = request.GET.get('grnvalue', '') g = open('/c/coverity/ngcov.lst', 'a') g.write("branch=" + submit['branch'] + ";" + "arch=" + submit['arch'] + ";" + "targets=" + added_tgts + ";" + "schedule=" + submit['schedule'] + ";grn=" + submit['grnvalue']+"\n") g.close() In this file, I am getting the value as put in the text area having id 'grnvalue'. Now I am saving this to database- s = Subscribed(name=submit['branch'], status="Subscribed", targets=added_tgts, architecture=submit['arch'], release=submit['schedule'], running_time=0, user=owner, remarks=notify, grn=submit['grnvalue']) s.save() The database contains Table Subscribed where I have added column grn. All values are put, but grn field is filled empty all the time. Please help me in this issue. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Need help in renaming template tags
Hey everyone, I am running into an issue where two third party apps easy_thumbnail and sorl_thumbnail are using the custom template tag called thumbnail. Hence, I am actually unable to use the tag at all. I would like to change it so that the template tag from sorl_thumbnail is renamed as sorl_thumbnail. A similar issue has cropped up before over on SO, but it hasn't been resolved. See here: http://bit.ly/sE64Tb I have created a templatetags module within one of my apps, and have tried a simple way to rename a registered tag as such: from django import template from sorl.thumbnail.templatetags import thumbnail register = template.Library() def do_sorl_thumbnail(parser, token): return thumbnail(parser, token) register.tag('sorl_thumbnail', do_sorl_thumbnail) Do I need to write a compile function and a render function for this? Any help on this would be great. Thanks, Harshil -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
When override default setting of TinyMCE, why can't get the value of textarea?
Hi, I refer the article,https://code.djangoproject.com/wiki/ AddWYSIWYGEditor, and create textareas.js to override default setting of TinyMCE. the textarea shows new functions while creating the textareas.js. However, when I submit the data, server can't save the data. if I don't override the setting, server can save the data. How to solve this? thanks!! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Need new *pyc files
Hi, I have added one column in the table of mysql db using 'python manage.py syncdb' after deleting the table. Now from the home page, I am fetching the value of text area, and trying to put in the database. The value when written to flat file, is same as fetched, but when writing to database, it is inserting null. The code is- value fetched by- submit['grnvalue'] = request.GET.get('grnvalue', '') g = open('/c/coverity/ngcov.lst', 'a') g.write("branch=" + submit['branch'] + ";" + "arch=" + submit['arch'] + ";" + "targets=" + added_tgts + ";" + "schedule=" + submit['schedule'] + ";grn=" + submit['grnvalue']+"\n") g.close() In this file, I am getting the value as put in the text area having id 'grnvalue'. Now I am saving this to database- s = Subscribed(name=submit['branch'], status="Subscribed", targets=added_tgts, architecture=submit['arch'], release=submit['schedule'], running_time=0, user=owner, remarks=notify, grn=submit['grnvalue']) s.save() The database contains Table Subscribed where I have added column grn. All values are put, but grn field is filled empty all the time. Please help me in this issue. Also, I have moved the *pyc files. Now no new pyc files are getting generated. I want new as I have modified the source. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is Django deleting my python objects?
I've a post_save handler method which stores values in a dictionary, like dictionary[instance.id] = some_value I was writing a post_delete handler to pop the value from the dictionary, when I found that the value had been already popped. I don't delete or pop the value anywhere else in the code. dictionary is the attribute of a singleton object. It lives as long as the server instance is up. How could it be possible? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django deleting my python objects?
You have inconsistent imports so that your signal is being called more than once. By inconsistent I mean "from myapp.models import foo" and "from models import foo" in different areas of your app/project. Cheers, AT On Mon, Dec 26, 2011 at 2:09 PM, devbird wrote: > I've a post_save handler method which stores values in a dictionary, > like > > dictionary[instance.id] = some_value > > I was writing a post_delete handler to pop the value from the > dictionary, when I found that the value had been already popped. > I don't delete or pop the value anywhere else in the code. dictionary > is the attribute of a singleton object. It lives as long as the server > instance is up. > > How could it be possible? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django deleting my python objects?
On Mon, Dec 26, 2011 at 11:09 AM, devbird wrote: > dictionary > is the attribute of a singleton object. It lives as long as the server > instance is up. > > How could it be possible? are you running a single instance of your django process? the development server does; but any non-toy deployment fires up several workers. -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django deleting my python objects?
I'm running tests. And I don't have any post_delete or pre_delete signal handler defined. On Dec 26, 6:02 pm, Javier Guerra Giraldez wrote: > On Mon, Dec 26, 2011 at 11:09 AM, devbird wrote: > > dictionary > > is the attribute of a singleton object. It lives as long as the server > > instance is up. > > > How could it be possible? > > are you running a single instance of your django process? the > development server does; but any non-toy deployment fires up several > workers. > > -- > Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django deleting my python objects?
It's very awkward: there's no strict relation between the dictionary keys and the deleted objects, but the keys are deleted together with the objects. I found where it happens: it's between the pre_delete and the post_delete send in the django.models.deletion.Collector delete() method, still I can't figure out why. On Dec 26, 6:17 pm, devbird wrote: > I'm running tests. > And I don't have any post_delete or pre_delete signal handler defined. > > On Dec 26, 6:02 pm, Javier Guerra Giraldez wrote: > > > > > > > > > On Mon, Dec 26, 2011 at 11:09 AM, devbird wrote: > > > dictionary > > > is the attribute of a singleton object. It lives as long as the server > > > instance is up. > > > > How could it be possible? > > > are you running a single instance of your django process? the > > development server does; but any non-toy deployment fires up several > > workers. > > > -- > > Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is Django deleting my python objects?
I found out that using another field, as "slug" instead of "id", so that "dictionary[instance.id] = some_value" becomes "dictionary[instance.slug] = some_value", the behaviour is different: the dictionary isn't affected when the object is deleted. Is not instance.id a simple integer then? Seems it has a special meaning, and objects are collected after that. On Dec 26, 6:32 pm, devbird wrote: > It's very awkward: there's no strict relation between the dictionary > keys and the deleted objects, but the keys are deleted together with > the objects. > I found where it happens: it's between the pre_delete and the > post_delete send in the django.models.deletion.Collector delete() > method, still I can't figure out why. > > On Dec 26, 6:17 pm, devbird wrote: > > > > > > > > > I'm running tests. > > And I don't have any post_delete or pre_delete signal handler defined. > > > On Dec 26, 6:02 pm, Javier Guerra Giraldez wrote: > > > > On Mon, Dec 26, 2011 at 11:09 AM, devbird wrote: > > > > dictionary > > > > is the attribute of a singleton object. It lives as long as the server > > > > instance is up. > > > > > How could it be possible? > > > > are you running a single instance of your django process? the > > > development server does; but any non-toy deployment fires up several > > > workers. > > > > -- > > > Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django - Forms Widget TypeChoiceField - how to set id for two radio buttons
hi everyone. i'm using a form with a TypeChoiceField, this is the form code: http://pastebin.com/GHttrDyN. now i'm trying to set a custom id for the two radio buttons displayed but i havent found yet the right way. maybe it's possible set it during form instantiation (as i set auto_id=False) in the view, but it's just my assumption, anyway i haven't find anything helpful on the internet.any idea? thanx - luke -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django - Forms Widget TypeChoiceField - how to set id for two radio buttons
hi luke, instead of setting auto_id to False, you should give it a string parameter. please read more on https://docs.djangoproject.com/en/dev/ref/forms/api/#ref-forms-api-configuring-label. all the best. On 26 Aralık, 21:45, luke lukes wrote: > hi everyone. i'm using a form with a TypeChoiceField, this is the form > code:http://pastebin.com/GHttrDyN. now i'm trying to set a custom id > for the two radio buttons displayed but i havent found yet the right > way. maybe it's possible set it during form instantiation (as i set > auto_id=False) in the view, but it's just my assumption, anyway i > haven't find anything helpful on the internet.any idea? > > thanx - luke -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: compiling python files in django
I assume that you are performing these functions in a view. I would test the value grn=submit['grnvalue']) by rendering this to a template and see what 'gm' spits out. This way you will find out what is sitting in the variable On Dec 26, 4:33 am, Mohammad Shahid Siddiqui wrote: > Hi, > > I have added one column in the table of mysql db using 'python manage.py > syncdb' after deleting the table. > Now from the home page, I am fetching the value of text area, and trying to > put in the database. The value when written to flat file, is same as > fetched, but when writing to database, it is inserting null. The code is- > > value fetched by- > > submit['grnvalue'] = request.GET.get('grnvalue', '') > > g = open('/c/coverity/ngcov.lst', 'a') > g.write("branch=" + submit['branch'] + ";" + "arch=" + submit['arch'] + ";" > + "targets=" + added_tgts + ";" + "schedule=" + submit['schedule'] + > ";grn=" + submit['grnvalue']+"\n") > g.close() > > In this file, I am getting the value as put in the text area having id > 'grnvalue'. > > Now I am saving this to database- > s = Subscribed(name=submit['branch'], status="Subscribed", > targets=added_tgts, architecture=submit['arch'], > release=submit['schedule'], running_time=0, user=owner, remarks=notify, > grn=submit['grnvalue']) > s.save() > > The database contains Table Subscribed where I have added column grn. All > values are put, but grn field is filled empty all the time. > > Please help me in this issue. > > -- > Best Regards, > *M Shahid Siddiqui* > > DISCLAIMER: > This message is intended solely for the use of the individual to whom it is > addressed. It may contain privileged or confidential information and should > not be circulated or used for any purpose other than for what it is > intended. If you have received this message in error, please notify the > originator immediately. If you are not the intended recipient, you are > notified that you are strictly prohibited from using, copying, altering, or > disclosing the contents of this message and you will delete the mail. > Sender accepts no responsibility for loss or damage arising from the use of > the information transmitted by this email including any damage from virus. > Ce courriel et les pièces jointes s’y rattachant sont de nature > personnelle, privilégiée et confidentielle et pour l’usage exclusif du > destinataire à qui ils sont adressés et destinés. Si vous avez reçu ce > courriel par erreur, veuillez s’il vous plaît le renvoyer à l’expéditeur. > Si vous n’êtes pas le bon destinataire ou si vous croyez ne pas l’être, > nous vous informons immédiatement que la publication, distribution, > diffusion, copie ou plagiat de ce courriel et de ses pièces jointes sont > strictement interdits. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Query with no-correspondence results
Sorry for digging this up but I have a more complex funcionality to implement and I was hoping you could help I had mydatabase_votecontext (id, name) (1, Flavour) (2, Smell) (3, Usability) (4, Size) mydatabase_vote (id, thing, context, user, vote) (1, Potatoes, Flavour, Me, 2.0) (2, Potatoes, Smell, Me, 4.3) (3, Potatoes, Usability, Me, 4.0) (4, Carrots, Flavor, Me, 3.0) (5, Cars, Smell, Me, 4.2) (6, Cars, Usability, Me, 4.9) and now I also have: mydatabase_user (id, ..) mydatabase_facebookuser) (id, user_id, gender, ...) I would like to query the average votes by gender :O I thought if the original was SELECT mb.id, mb.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote FROM mydatabase_votecontext AS md LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = md.id AND thing_id = 1) GROUP BY thing_id, name ORDER BY md.id then SELECT md.id, md.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote FROM mydatabase_votecontext AS md LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = vc.id AND thing_id = 1), facebook_facebookprofile WHERE mydatabase_vote.user_id = facebook_facebookprofile.user_id AND facebook_facebookprofile.gender = 'male' GROUP BY thing_id, name ORDER BY md.id could be the solution. But the "filter" by gender comes after the LEFT JOIN and is messing everything up. It will cut off a vote_context if no vote for that context exists (the original, but solved, problem) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Query with no-correspondence results
I have not read all 18 responses, so if I am off base I apologize. I believe that you want to avg the votes (by gender) of each unique combination of thing and context. (First take gender out of the equation) In order to be able to get the avg votes for the combination of potatoes and flavor as compared to potatoes and smells you have to give each combo a unique value and then group on that value. for example potato and flavor could be =1 and potatoes and smells =2 , let's call this combo attribute column Then you can group by the unique combo attribute, 1,or 2 in this example select combo_attribute,COALESCE( AVG( vote ) , 0.0 ) AS average_vote from mydatabase_votecontext AS md group by combo_attribute You can then join the 3 tables on the user id , no outsr join necessary and add gender select gender,combo_attribute,COALESCE( AVG( vote ) , 0.0 ) AS average_vote from mydatabase_votecontext a, mydatabase_user b, mydatabase_facebookuser c where a.id=c.id group by combo_attribute,gender On Dec 26, 11:00 pm, wgis wrote: > Sorry for digging this up but I have a more complex funcionality to > implement and I was hoping you could help > > I had > > mydatabase_votecontext > (id, name) > (1, Flavour) > (2, Smell) > (3, Usability) > (4, Size) > > mydatabase_vote > (id, thing, context, user, vote) > (1, Potatoes, Flavour, Me, 2.0) > (2, Potatoes, Smell, Me, 4.3) > (3, Potatoes, Usability, Me, 4.0) > (4, Carrots, Flavor, Me, 3.0) > (5, Cars, Smell, Me, 4.2) > (6, Cars, Usability, Me, 4.9) > > and now I also have: > > mydatabase_user > (id, ..) > > mydatabase_facebookuser) > (id, user_id, gender, ...) > > I would like to query the average votes by gender :O > > I thought if the original was > > SELECT mb.id, mb.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote > FROM mydatabase_votecontext AS md > LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = md.id > AND thing_id = 1) > GROUP BY thing_id, name > ORDER BY md.id > > then > > SELECT md.id, md.name, COALESCE( AVG( vote ) , 0.0 ) AS average_vote > FROM mydatabase_votecontext AS md > LEFT JOIN restudante_vote ON ( mydatabase_vote.context_id = vc.id > AND thing_id = 1), > facebook_facebookprofile > WHERE mydatabase_vote.user_id = facebook_facebookprofile.user_id > AND facebook_facebookprofile.gender = 'male' > GROUP BY thing_id, name > ORDER BY md.id > > could be the solution. But the "filter" by gender comes after the LEFT > JOIN and is messing everything up. It will cut off a vote_context if > no vote for that context exists (the original, but solved, problem) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django - Forms Widget TypeChoiceField - how to set id for two radio buttons
Try this: widget=forms.RadioSelect(renderer=HorizRadioRenderer, attrs={"id":"whatever_you_want"}) On Tue, Dec 27, 2011 at 3:08 AM, Mengu wrote: > hi luke, > > instead of setting auto_id to False, you should give it a string > parameter. please read more on > > https://docs.djangoproject.com/en/dev/ref/forms/api/#ref-forms-api-configuring-label > . > > all the best. > > On 26 Aralık, 21:45, luke lukes wrote: > > hi everyone. i'm using a form with a TypeChoiceField, this is the form > > code:http://pastebin.com/GHttrDyN. now i'm trying to set a custom id > > for the two radio buttons displayed but i havent found yet the right > > way. maybe it's possible set it during form instantiation (as i set > > auto_id=False) in the view, but it's just my assumption, anyway i > > haven't find anything helpful on the internet.any idea? > > > > thanx - luke > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.