os.system is not working properly
i have a django application with flex as front end, i am using amfgateway for it. i have a fortran executable file which will create a new file called predict.dat(say) it will take two input files(input.dat, test) under my project directory. my code is like this os.system("/home/me/mypro/s_test")where s-test is the executable file. Inside the python interpretor and inside the interpretor provided by django it is working properly. but inside amfgateway.py it is failing by giving the following. (and also it is creating the output file without data) list in: end of file apparent state: unit 1 named input.dat last format: list io lately reading direct formatted external IO Aborted Can anybody help me? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with self referencing Foreign key field and mysql InnoDB
I were using Mysql MyISAM. But I want to enable transaction. So i shifted to InnoDB. Actually I have one model as below (*designed somebody i can't change). class Folder(models.Model): folder_id=models.AutoField(primary_key=True) user_name=models.ForeignKey(User) folder_name=models.CharField(max_length=80) parent_folder=models.ForeignKey('self') At some point i want to insert in this table as below: Folder(user_name_id=1,folder_name="s",parent_folder_id=0) But it raises one error like this. IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`myproject/folder_folder`, CONSTRAINT `parent_folder_id_refs_folder_id_12515019` FOREIGN KEY (`parent_folder_id`) REFERENCES `folder_folder` (`folder_id`))') But with MyISAM there was no problem like this... Anyways i need Transaction functionality for other tables in the database. Is there any solution for this problem. Please Help me. Thanks Lima --~--~-~--~~~---~--~~ 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: filter with respect to single attribute does not work properly
Thank you Alex . It works thank you very much. Lima On Mar 3, 12:59 am, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Mon, Mar 2, 2009 at 2:56 PM, limas <limasathyanan...@gmail.com> wrote: > > > thank you Alex for your valuable reply. > > but i am still not able to find out the solution. > > i tried this: > > dataobj=DataValue.objects.filter(Q(file=file.id)|Q(mnem=1)|Q(mnem=2)) > > but it is not working fine. it is returning every thing. > > > can you suggest some thing more. It will realy help a newbie like me. > > thanks . > > > Lima > > > On Mar 3, 12:40 am, Alex Gaynor <alex.gay...@gmail.com> wrote: > > > On Mon, Mar 2, 2009 at 2:36 PM, limas <limasathyanan...@gmail.com> > > wrote: > > > > > Hello. > > > > > my project deals with mnemonic-data pairs. > > > > so I have model like this: > > > > > class DataValue(models.Model): > > > > file=models.ForeignKey(File) > > > > row=models.IntegerField() > > > > mnem=models.IntegerField() > > > > value=models.CharField(max_length=2000) > > > > > class Curve(models.Model): > > > > file=models.ForeignKey(File) > > > > mnem=models.CharField(max_length=100) > > > > > mnem field of DataValue contains the curve id, but it not set as the > > > > foreign key. > > > > so for each set of mnemonic data pairs for same file id i am trying to > > > > maintain row numbers. > > > > > where i am failing is that .. > > > > i want to get a particular two mnemonic pairs. > > > > my query is like this: > > > > > dataobj=DataValue.objects.filter(file=file.id).filter(mnem=1,mnem=2) > > > > where 1 and 2 are the curve ids for a particular condition. > > > > > but i am getting only records corresponding to mnem=2. > > > > > any valuable suggestions ? please help me.. > > > > i think it might be some minor misunderstatnding. > > > > > thanks in advanse > > > > Lima > > > > This is a bit about how Python works, when you do filter(mnem=1, mnem=2) > > > since the filter method takes **kwargs that translates that into a > > > dictionary {'mnem': 1, 'mnem': 2}, but wait, python dics don't have > > > duplicate keys, the last key wins, so it just because {'mnem': 2}. To > > fix > > > this you want to seperate it into 2 filter calls > > > filter(mnem=1).filter(mnem=2). But that still probably doesn't do what > > you > > > want, since you can't have a field which has 2 values at once, therefore > > I'm > > > guessing you want to OR them together, > >http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-looku... > > > probably what you want. > > > > Alex > > > > -- > > > "I disapprove of what you say, but I will defend to the death your right > > to > > > say it." --Voltaire > > > "The people's good is the highest law."--Cicero > > You aren't being very clear on what you're trying to do, but my inclination > is that you want something like: > DataValue.objects.filter(file=file.id).filter(Q(mnem=1)|Q(mnem=2)) > > Which asks for all DataValue objects where (file=file.id) AND (mnem=1 OR > mnem=2) > > Alex > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ 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: filter with respect to single attribute does not work properly
thank you Alex for your valuable reply. but i am still not able to find out the solution. i tried this: dataobj=DataValue.objects.filter(Q(file=file.id)|Q(mnem=1)|Q(mnem=2)) but it is not working fine. it is returning every thing. can you suggest some thing more. It will realy help a newbie like me. thanks . Lima On Mar 3, 12:40 am, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Mon, Mar 2, 2009 at 2:36 PM, limas <limasathyanan...@gmail.com> wrote: > > > Hello. > > > my project deals with mnemonic-data pairs. > > so I have model like this: > > > class DataValue(models.Model): > > file=models.ForeignKey(File) > > row=models.IntegerField() > > mnem=models.IntegerField() > > value=models.CharField(max_length=2000) > > > class Curve(models.Model): > > file=models.ForeignKey(File) > > mnem=models.CharField(max_length=100) > > > mnem field of DataValue contains the curve id, but it not set as the > > foreign key. > > so for each set of mnemonic data pairs for same file id i am trying to > > maintain row numbers. > > > where i am failing is that .. > > i want to get a particular two mnemonic pairs. > > my query is like this: > > > dataobj=DataValue.objects.filter(file=file.id).filter(mnem=1,mnem=2) > > where 1 and 2 are the curve ids for a particular condition. > > > but i am getting only records corresponding to mnem=2. > > > any valuable suggestions ? please help me.. > > i think it might be some minor misunderstatnding. > > > thanks in advanse > > Lima > > This is a bit about how Python works, when you do filter(mnem=1, mnem=2) > since the filter method takes **kwargs that translates that into a > dictionary {'mnem': 1, 'mnem': 2}, but wait, python dics don't have > duplicate keys, the last key wins, so it just because {'mnem': 2}. To fix > this you want to seperate it into 2 filter calls > filter(mnem=1).filter(mnem=2). But that still probably doesn't do what you > want, since you can't have a field which has 2 values at once, therefore I'm > guessing you want to OR them > together,http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-looku... > probably what you want. > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
filter with respect to single attribute does not work properly
Hello. my project deals with mnemonic-data pairs. so I have model like this: class DataValue(models.Model): file=models.ForeignKey(File) row=models.IntegerField() mnem=models.IntegerField() value=models.CharField(max_length=2000) class Curve(models.Model): file=models.ForeignKey(File) mnem=models.CharField(max_length=100) mnem field of DataValue contains the curve id, but it not set as the foreign key. so for each set of mnemonic data pairs for same file id i am trying to maintain row numbers. where i am failing is that .. i want to get a particular two mnemonic pairs. my query is like this: dataobj=DataValue.objects.filter(file=file.id).filter(mnem=1,mnem=2) where 1 and 2 are the curve ids for a particular condition. but i am getting only records corresponding to mnem=2. any valuable suggestions ? please help me.. i think it might be some minor misunderstatnding. thanks in advanse Lima --~--~-~--~~~---~--~~ 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: Join two tables having foreign key field with name different from table name
> > and i want show something like this in my form: > > > > > > > Thanks for Your reply. Now I understand correctly what my problem was.But I can not find the solution yet. Actually I meant to join two tables in order to have a queryset, which contains both candidate fields and user_name from user. But I did not thoroughly know how to write sql join statement with Django. Can you solve my problem and suggest some documentation available over it? Hop you have an idea about what my problem was. Thank you once again.. Lima --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Join two tables having foreign key field with name different from table name
hai all, i have say two tables: class Candidate(models.Model): first_name=models.CharField('First Name',max_length=30) last_name=models.CharField('Last Name',max_length=30) .. owner=models.Foreign_key(User) enter_by=models.ForeignKey(User,related_name="users") class User(models.Model): user_name=models.CharField(max_length=30) and i want show something like this in my form: i tried with SORT_FIELD='users_owner__user_name' candidate=Candidate.objects.select_related().order_by(SORT_FIELD) but an error like "FieldError: Cannot resolve keyword 'users_owner' into field." is comming any help? thanks in advance... lima --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
unchecked checkboxes not accessed through request.POST['check_name']
hello all I am doing a project in Django. I want to create a list by clicking upon a link, it will open up a new window using javascript window.open() method. I have two tables for list. class Saved_list(models.Model): description=models.CharField(max_length=100) number_entries=models.IntegerField() date_created=models.DateTimeField(auto_now_add=True) date_modified=models.DateTimeField(auto_now=True) class Saved_list_entry(models.Model): saved_list=models.ForeignKey(Saved_list) date_created=models.DateTimeField(auto_now_add=True) Onload all entries in the Saved_list is listed with description and number entries with a check box in front of it. I want to create new Saved_list. I have done it with a a link. When any one of the Checkbox is checked I want to increment the number_entries field and insert a new row in Saved_list_entry. my view is : def add_to_list(request): saved_list=Saved_list.objects.all() lists=saved_list.values() if request.method=='POST': name='' for lst in lists: if request.POST[lst['description']]=='On': name=lst['description'] break if name!='': try: slist1=Saved_list.objects.get (description=name) except KeyError: pass slist_entry=Saved_list_entry (saved_list_id=slist1.id) slist1.number_entries=slist1.number_entries+1; slist1.save() else: slist=Saved_list(description=request.POST ['listname'],number_entries=0) slist.save() else: pass return render_to_response('candidates/add_to_list.html', {'list':lists}) and my template is: {% for l in list %} {{ l.description }} ({{ l.number_entries }}) {% endfor %} Save But i can't retrieve the unchecked checkboxes please help me.. thanks in advance Lima --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
setting value of a ModelForm field through Javascript
hello please help me... can i set the value of a ModelForm field ,ie a text box, using javascript. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: align a ModelForm
dear Law, The admin css worked nicely. But my work is not fullfilled yet. Actually i have a Model Candidate. class Candidate(models.Model): site=models.ForeignKey(Site) first_name=models.CharField('First Name',max_length=30) last_name=models.CharField('Last Name',max_length=30) phone_home=models.CharField(max_length=16) phone_work=models.CharField(max_length=16) address=models.CharField(max_length=100) city=models.CharField(max_length=30) state=models.CharField(max_length=30) source=models.CharField(max_length=40) date_available=models.DateTimeField() can_relocate=models.BooleanField() notes=models.CharField(max_length=300) key_skills=models.CharField(max_length=200) current_employers=models.CharField(max_length=100) enter_by=models.CharField(max_length=50) owner=models.CharField(max_length=50) date_created=models.DateField(auto_now_add=True) I create a ModelForm for it, CandidateForm. There is a Attachment model, it contains a FileField. What i want is that rearrange the fields in the CandidateForm and insert a in between it. In admin it done through ModelAdmin. What i want to do here... please help me.. lima On 5 Nov, 11:26, "Low Kian Seong" <[EMAIL PROTECTED]> wrote: > No. Look at the css of the admin that says fieldsets and put your > fields in the tags to let the css definitions > take effect. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: align a ModelForm
> I have done something similar and I generated my form automatically > using 'forms.as_p' then I put in some sections of the css from admin > interface's css and it works. The section you want to look at is the > fieldset section. hello Low, I can't understand what you mentioned clearly. Is i want to make use of /django/contrib/admin/templates/admin/includes/fieldset.html file. I tried it but failed. How can i specify the fieldset tags by not create any fieldsets using ModelAdmin. I can't use ModelAdmin for creating my own form to display it in my own page. Is there any mistake from me? sorry for my terrible English. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: align a ModelForm
hello Thomas, i tried with ModelAdmin, but it is not working properly in my own views. i got this error "__init__() got an unexpected keyword argument 'instance'" hop u understand what my problem is. Actually i want to customize my page with a look and feel of django admin page. Some modification in the alignment of a single ModelForm. thank you for ur suggestions. i expect u will respond to this reply.. Lima On 3 Nov, 18:33, Thomas Guettler <[EMAIL PROTECTED]> wrote: > limas schrieb: > > > Can i align a single long ModelForm into two raws? > > can i use django admin modules for my own purpose by customizing it? > > please give me some suggestions . > > Yes, you can do both. Suggestion: Read the documentation. > > Suggestion:http://docs.djangoproject.com/en/dev/ref/contrib/admin/http://groups.google.com/group/django-users/browse_thread/thread/536e... > > HTH, > Thomas > > -- > Thomas Guettler,http://www.thomas-guettler.de/ > E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
align a ModelForm
Can i align a single long ModelForm into two raws? can i use django admin modules for my own purpose by customizing it? please give me some suggestions . --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sql query to insert into table
thank u very much for ur reply.. i were just stuck in my project.It helps me realy... thanks... On 29 Oct, 16:42, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Oct 29, 10:26 am, limas <[EMAIL PROTECTED]> wrote: > > > hello > > > i am new in django. > > i want to insert values into two tables from a single form. > > i think ModelForm didnot work for this. > > Can i use raw sql query to insert into tables. i am using mysql and > > latest subversion of django. > > > please give me some sugessions. > > Why do you want to use raw SQL? What's wrong with using the normal > Django ORM? > eg > if form.is_valid(): > obj1 = Obj1.objects.create(elem1=cleaned_data['elem1'], > elem2=cleaned_data['elem2']) > obj2 = Obj2.objects.create(elem3=cleaned_data['elem3'], > elem4=cleaned_data['elem4']) > etc. > -- > DR. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
sql query to insert into table
hello i am new in django. i want to insert values into two tables from a single form. i think ModelForm didnot work for this. Can i use raw sql query to insert into tables. i am using mysql and latest subversion of django. please give me some sugessions. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
install django
hai, i want to install django in a local directory without the permission of root in Mandriva linux. please help meThe problem i suffered is could not create the file /usr/lib/python2.5/site-packages/django. permission denied. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---