Script to call loaddata on multiple fixtures
I have quite a number of fixtures that I call loaddata to insert fixtures into my sqlite database using the following syntax: python ./manage.py loaddata ./apps/addresses/fixtures/cities.json python ./manage.py loaddata ./apps/addresses/fixtures/addresses.json ... I would like to create a script to call all of these, so I can insert them all at once. I do not want to combine all of the json files. To do this, would I create a py script similar to my bootstrap.py script? My bootstrap.py script executes subprocess.call() on all packages listed in my requirements txt file. Am I going down the right path with this, or is there an easier way? L J -- 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: Script to call loaddata on multiple fixtures
That worked great. I haven't done much shell scripting, but it was easier than I thought. Thanks, Shawn! L J On Feb 18, 9:46 am, LJ wrote: > I have quite a number of fixtures that I call loaddata to insert > fixtures into my sqlite database using the following syntax: > > python ./manage.py loaddata ./apps/addresses/fixtures/cities.json > python ./manage.py loaddata ./apps/addresses/fixtures/addresses.json > ... > > I would like to create a script to call all of these, so I can insert > them all at once. > I do not want to combine all of the json files. > To do this, would I create a py script similar to my bootstrap.py > script? > My bootstrap.py script executes subprocess.call() on all packages > listed in my requirements txt file. > Am I going down the right path with this, or is there an easier way? > > L J -- 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: Script to call loaddata on multiple fixtures
Thanks, Dennis. Some of the fixtures are order dependent. I will have to do some more research on how to use glob.glob() and spawn. For now, just adding the list of python loaddata commands to a shell script seem to work great. Thanks again for the info! L J On Feb 18, 4:33 pm, Dennis Lee Bieber wrote: > On Sat, 18 Feb 2012 08:46:25 -0800 (PST), LJ > wrote: > > >I would like to create a script to call all of these, so I can insert > >them all at once. > >I do not want to combine all of the json files. > > Are they order dependent? That is, do any of the loads require > certain data to have already been loaded? Foreign key constraints, > perhaps? > > If so, you may want to just create a shell script of the commands > rather than running a Python process which just spawns separate > processes to do the load call. > > If they are NOT order dependent (OR you are willing to rename them > into some scheme that can be sorted) AND if all the .json files in the > directory are to be loaded (they are not used for any other use), THEN > you might consider a Python script that reads the directory contents > (glob.glob() ?) into a list of all the .json files and spawns the load > command for each (possibly after sorting per the ordering scheme). Of > course, you could probably develop a shell script to do the same thing. > The Python version would be more portable if you change OS. > > >>> import glob > >>> for fid in glob.glob("*"): > > ... print "pretend to spawn using %s" % fid > ... > pretend to spawn using license.txt > pretend to spawn using mfc90.dll > pretend to spawn using mfc90u.dll > pretend to spawn using mfcm90.dll > pretend to spawn using mfcm90u.dll > pretend to spawn using Microsoft.VC90.MFC.manifest > pretend to spawn using Pythonwin.exe > pretend to spawn using pywin > pretend to spawn using scintilla.dll > pretend to spawn using win32ui.pyd > pretend to spawn using win32uiole.pyd > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ -- 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.
Returning template data from a ManyToMany model
I am having trouble figuring out how to query the database and return the results in a format that my template can render appropriately. I have a model that has a ManyToMany field: class Student() ... parents = models.ManyToManyField('parents.Parent', blank=True, null=True) ... The Parent model looks like: class Parent() ... first_name models.CharField(max_length=30) last_name models.CharField(max_length=30) gender models.CharField(max_length=1) ... def __unicode__(self): return u'Parent : %s %s' % (self.first_name, self.last_name) The method in my view currently looks something like this: def get_parents( request, template ) id=request.GET['id'] template_data["parents"] = Parent.objects.filter(student=id) return render_to_response( template, template_data, context_instance=RequestContext(request)) The template data is returning the data in the format: [ , ] Instead, I need the template data formatted with the other fields in my Parent model, like: [ , ] The format doesn't have to be exactly like the above, but I need to include the index, and to return some of the other fields defined in my Parent model. My template will look something like: {% for parent in parents.object_list %} {{parent.id}} {{parent.first_name}} {{parent.last_name}} {% endfor %} Can someone give me some ideas about how I can change my view to return my template data in a more useable format? -- 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: Returning template data from a ManyToMany model
Thank you, Phang. I was not familiar with the locals() method, so I may look into this. L J On Apr 17, 2:22 am, Phang Mulianto wrote: > On Tue, Apr 17, 2012 at 2:10 PM, LJ wrote: > > I am having trouble figuring out how to query the database and return > > the results in a format that my template can render appropriately. > > I have a model that has a ManyToMany field: > > > class Student() > > ... > > parents = models.ManyToManyField('parents.Parent', blank=True, > > null=True) > > ... > > The Parent model looks like: > > > class Parent() > > ... > > first_name models.CharField(max_length=30) > > last_name models.CharField(max_length=30) > > gender models.CharField(max_length=1) > > ... > > def __unicode__(self): > > return u'Parent : %s %s' % (self.first_name, self.last_name) > > > The method in my view currently looks something like this: > > > def get_parents( request, template ) > > id=request.GET['id'] > > template_data["parents"] = Parent.objects.filter(student=id) > > return render_to_response( template, template_data, > > context_instance=RequestContext(request)) > > > The template data is returning the data in the format: > > [ , ] > > > I think this because you return your result in template_data["parents"] , > > so in your tempalte it will be parent:parent:bob thomas. > > usualy i use locals() to pass all the var to template. > > return render_to_repsonse(template, > locals(),context_instance=RequestContext(request)) > > don't know if this is best practice in django, but make me easier to work > with variables need to pass to template without have to include it in an > array. > > with the locals() you will have the data in your template like you mention > below. > > > > > > > > > Instead, I need the template data formatted with the other fields in > > my Parent model, like: > > [ , > > ] > > > The format doesn't have to be exactly like the above, but I need to > > include the index, and to return some of the other fields defined in > > my Parent model. > > My template will look something like: > > {% for parent in parents.object_list %} > > > > {{parent.id}} > > {{parent.first_name}} > > {{parent.last_name}} > > {% endfor %} > > > Can someone give me some ideas about how I can change my view to > > return my template data in a more useable format? > > > -- > > 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: Returning template data from a ManyToMany model
Thank you, Daniel. That makes sense now. If the full objects are already there, then this should work great! L J On Apr 17, 4:07 am, Daniel Roseman wrote: > On Tuesday, 17 April 2012 07:10:35 UTC+1, LJ wrote: > > > I am having trouble figuring out how to query the database and return > > the results in a format that my template can render appropriately. > > I have a model that has a ManyToMany field: > > > class Student() > > ... > > parents = models.ManyToManyField('parents.Parent', blank=True, > > null=True) > > ... > > The Parent model looks like: > > > class Parent() > > ... > > first_name models.CharField(max_length=30) > > last_name models.CharField(max_length=30) > > gender models.CharField(max_length=1) > > ... > > def __unicode__(self): > > return u'Parent : %s %s' % (self.first_name, self.last_name) > > > The method in my view currently looks something like this: > > > def get_parents( request, template ) > > id=request.GET['id'] > > template_data["parents"] = Parent.objects.filter(student=id) > > return render_to_response( template, template_data, > > context_instance=RequestContext(request)) > > > The template data is returning the data in the format: > > [ , ] > > > Instead, I need the template data formatted with the other fields in > > my Parent model, like: > > [ , > > ] > > > The format doesn't have to be exactly like the above, but I need to > > include the index, and to return some of the other fields defined in > > my Parent model. > > My template will look something like: > > {% for parent in parents.object_list %} > > > > {{parent.id}} > > {{parent.first_name}} > > {{parent.last_name}} > > {% endfor %} > > > Can someone give me some ideas about how I can change my view to > > return my template data in a more useable format? > > This has nothing to do with your view, which is fine. The query isn't > returning the data like that - you're just showing a string representation > of the queryset, created by calling `repr()` (which calls `unicode()`) on > each parent. The objects are there in full. > > Your proposed template code is correct, except that you should iterate > through just `parents`, not "parents.object_list". > -- > 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
URL resolution in a Django template
I am using ajax to update a list of participants in my html page, based on the student id selected. I am trying to figure out how Django knows what path to look to find my method. Does it just go through all of the urls.py files until it finds a method that matches the url request? $('#id_student').change(function(){ var student_id = $(this).val(); $.get('{% url get_required_meeting_participants %}', {id:student_id}, function(data) { $(".participants").last().append(data); }); }); In other words, if I have two methods with the same name, but each in a different directory, how would Django know which method to call? -- 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.
Trouble with query syntax in Django view
I have a Student model that stores information about a student, including the student's teacher. The teacher's information is stored in the Employee model that inherits from the Person Model. I am having trouble figuring out how to query the teacher, when a student id is passed as an ajax argument to the view function. I have no trouble returning the data about the parents and the student, but my filter for querying the teacher info is incorrect. Does anyone have any ideas how I can query for the teacher information based on the models below? #models.py class Student(Person): grade = models.ForeignKey('schools.Grade') school = models.ManyToManyField('schools.School', blank=True, null=True, related_name="school") parents = models.ManyToManyField('parents.Parent', blank=True, null=True) teacher = models.ForeignKey(Employee, blank=True, null=True, related_name='teacher') class Employee(Person): ''' Employee model inherit Person Model''' role=models.ForeignKey(EmployeeType, blank=True, null=True) user=models.ForeignKey(User) schools = models.ManyToManyField(School,blank=True,null=True) # views.py def get_required_meeting_participants(request, template): try: id=request.GET['id'] except: id=None parents = Parent.objects.filter(student=id) student = Student.objects.filter(pk=id) teacher = Employee.objects.filter(pk=student.teacher_id) #this line is incorrect...help, please? data = { 'parents': parents, 'student': student, 'teacher': teacher, } return render_to_response(template,data, context_instance=RequestContext(request)) -- 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.
How to get the Exception Type
I am trying to add exception handling to my application. I have been reading the documentation on Django Exceptions: https://docs.djangoproject.com/en/dev/ref/exceptions/ I also found the list of Exceptions (both Django and Python). But for testing purposes, I need a way to handle all exceptions and to log the exception types: try: addresses = Address.objects.all() except Exception: logger.debug(Exception.Type) How do I catch all types of exceptions? And, how do I get the exception type? -- 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.
Saving ManyToMany models
I am having trouble saving entities to my models that have ManyToMany relationships. I have a Student object that inherits from a Person: class Person(models.Model): first_name = models.CharField(max_length=30) middle_name = models.CharField(max_length=30, blank=True) last_name = models.CharField(max_length=30) ... class Student(Person): parents = models.ManyToManyField('parents.Parent', blank=True, null=True) ... class Parent(Person): occupation = models.CharField(max_length=128, blank=True) In my view, I create a new Student: newStudent = Student(first_name='Donald', middle_name='R', last_name='Duck') newStudent.save() I also create a Parent and add the new parent to the list of parents for the student: newParent = Parent(first_name='Ronald', middle_name='T', last_name='Duck') newParent.save() newStudent.parents.add(newParent) However, when I call save_m2m(), it throws an error: newStudent.save_m2m() Perhaps I do not need to call save_m2m(). Does the relationship get saved to the database when I call the add() method? LJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/JmC8fj_cvtQJ. 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.
What happens underneath when I save to a model with ManyToMany relationships?
I have a Python script that will be called daily from a scheduled service or daemon. The script uses MySQLdb to read a csv file and import data into a MySQL database that is used in my Django application. Some of the models contain ManyToMany relationships. I am directly inserting the relationships. I thought that this was working great until I tried to query the models from my Django view. For example, I have a list of students, and each student has one or more parents. Even though the students_student_parents table that stores the student/parent relationship is updated by the script, when I run the query to get a list of parents, the list is empty. importedStudent = get_object_or_404(Student, pk=studentId) logger.info(importedStudent) the_parents = importedStudent.parents.all().values_list('id', flat=True) It appears that I have one of two choices: 1) Figure out what really happens under the covers when I add a parent to a student in a Django form and call save() or save_m2m(). 2) Instead of inserting data into my tables using MySQLdb cursor execute methods, would it be better for me to create a service in my Django application that my script can call? Any suggestions? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/mjJFBffN-ZcJ. 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: New to DJANGO
I started out learning Django using the "Writing your first Django app" article: https://docs.djangoproject.com/en/dev/intro/tutorial01/ This is a very well-written tutorial that goes through each part in detail. Please note, at the bottom of each section there is a link to the next section. There are 3 parts. Part 2 shows how to create the urls.py. Part 3 shows how to create the views.py. I'm sure there are other tutorials out there, but I haven't seen any that are better for getting started. There are also some good books out there that have examples. You could get used books for pretty cheap on Amazon, or even get a free trial to use Safari for 30 days: http://my.safaribooksonline.com/ On Thursday, June 21, 2012 5:52:52 PM UTC-6, Jeff Silverman wrote: > > I am new to Django. I am trying to get the Class version of hello_world > to work. I cannot find a good full example of the code that works. I have > made multiple view.py files and urls.py files trying to get it to work. I > cannot seem to come up with the right url to pass the variables name and > times in. I am using soaplib among other libraries. Pretty much trying > anything I find. > > Can anyone point out a full urls.py, views.py and url combination that > works? Ultimately, I want to use the wsdl to expose the funtions to NINTEX > workflows. > > Any thing will be helpful. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/q__g7pPSgZ8J. 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.
Dajaxice Unresolved Import
I followed the installation instructions on the dajaxice project website (http://docs.dajaxproject.com/dajaxice/installation.html). Some parts of the simple example project work great, but some parts do not work. I am getting the error: Unresolved import: dajaxice_autodiscover This is on the line that imports dajaxice_autodiscover in urls.py: from dajxice.core import dajaxice_autodiscover I am curious to know if I have installed the wrong version of python- django-dajaxice or python-django-dajax. I just used the Synaptic Package Manager to install these so I have version 0.1.5-1 of python-django-dajaxice, and version 0.8.4-1 of python-django-dajax. Does anyone know if it matters what version I install of these packages? (I'm using version 2.6.6 of python and 1.2.3-1ubuntu0.2.10.10.1 of python-django.) -- 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.
How to reinstall Python Interpreters?
I installed the latest version of dajaxice, but I am still getting Unresolved import errors. My guess is that I need to remove and reinstall the Python Interpreters. Is there a some documentation somewhere that explains how to reinstall the Python Interpreters, so I can resolve all of my Unresolved Import errors? -- 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: How to reinstall Python Interpreters?
I am on Ubuntu 10, using Python 2.6 and Django 1.2.3. Mike Ramirez suggested that I look at the site packages (in my case dist-packages) in my python lib dir. I did not see anything in there that references dajaxice. I may need to manually edit the PYTHONPATH once I figure out how and where. My errors are: Unresolved import: dajaxice_autodiscover Unresolved import: dajaxice_functions On Feb 18, 7:17 am, CrabbyPete wrote: > I wouldn't reinstall python because of an unresolved import error. > What's unresolved and what type of system are you on PC/Linux? > > On Feb 17, 7:48 pm, LJ wrote: > > > I installed the latest version of dajaxice, but I am still getting > > Unresolved import errors. > > My guess is that I need to remove and reinstall the Python > > Interpreters. > > Is there a some documentation somewhere that explains how to reinstall > > the Python Interpreters, so I can resolve all of my Unresolved Import > > errors? -- 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: How to reinstall Python Interpreters?
Just adding a note for anyone else struggling with a similar 'unresolved import' problem... This article explains in details how to modify the PYTHONPATH if you decide to go that route. http://www.stereoplex.com/blog/understanding-imports-and-pythonpath I don't prefer to use this method, but I now understand how django is able to find imported libraries. I am still looking for a good article on how to install/configure a 3rd party app in site packages--or dist-packages on Ubuntu (Python 2.6). On Feb 18, 12:39 pm, LJ wrote: > I am on Ubuntu 10, using Python 2.6 and Django 1.2.3. > Mike Ramirez suggested that I look at the site packages (in my case > dist-packages) in my python lib dir. > I did not see anything in there that references dajaxice. I may need > to manually edit the PYTHONPATH once I figure out how and where. > > My errors are: > Unresolved import: dajaxice_autodiscover > Unresolved import: dajaxice_functions > > On Feb 18, 7:17 am, CrabbyPete wrote: > > > I wouldn't reinstall python because of an unresolved import error. > > What's unresolved and what type of system are you on PC/Linux? > > > On Feb 17, 7:48 pm, LJ wrote: > > > > I installed the latest version of dajaxice, but I am still getting > > > Unresolved import errors. > > > My guess is that I need to remove and reinstall the Python > > > Interpreters. > > > Is there a some documentation somewhere that explains how to reinstall > > > the Python Interpreters, so I can resolve all of my Unresolved Import > > > errors? -- 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: How to reinstall Python Interpreters?
Yes. I used the apt-get install command to install dajaxice, but it installs an older version, and the installer for the newer version isn't done. The installer for the older version does not put anything in the dist- packages directory. I'm trying to figure out how to manually install it, but I'm not making any progress. On Feb 18, 8:07 pm, lduros wrote: > Did you install dajaxice through apt-get? From the command line: sudo > apt-get install python-django-dajaxice > If not, you might want to try it it might do the trick of installing > it in a much easier way than from the sources. > > On Feb 18, 5:04 pm, LJ wrote: > > > Just adding a note for anyone else struggling with a similar > > 'unresolved import' problem... > > This article explains in details how to modify the PYTHONPATH if you > > decide to go that route. > > http://www.stereoplex.com/blog/understanding-imports-and-pythonpath > > I don't prefer to use this method, but I now understand how django is > > able to find imported libraries. > > > I am still looking for a good article on how to install/configure a > > 3rd party app in site packages--or dist-packages on Ubuntu (Python > > 2.6). > > > On Feb 18, 12:39 pm, LJ wrote: > > > > I am on Ubuntu 10, using Python 2.6 and Django 1.2.3. > > > Mike Ramirez suggested that I look at the site packages (in my case > > > dist-packages) in my python lib dir. > > > I did not see anything in there that references dajaxice. I may need > > > to manually edit the PYTHONPATH once I figure out how and where. > > > > My errors are: > > > Unresolved import: dajaxice_autodiscover > > > Unresolved import: dajaxice_functions > > > > On Feb 18, 7:17 am, CrabbyPete wrote: > > > > > I wouldn't reinstall python because of an unresolved import error. > > > > What's unresolved and what type of system are you on PC/Linux? > > > > > On Feb 17, 7:48 pm, LJ wrote: > > > > > > I installed the latest version of dajaxice, but I am still getting > > > > > Unresolved import errors. > > > > > My guess is that I need to remove and reinstall the Python > > > > > Interpreters. > > > > > Is there a some documentation somewhere that explains how to reinstall > > > > > the Python Interpreters, so I can resolve all of my Unresolved Import > > > > > errors? -- 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.
Virtualenv and Dajaxice up...Now looking for Django Twitter Birds
I can't tell you how helpful this User Group has been to me! With the help of several helpful responses and a lot of great articles out there, I was finally able to install virtualenv and virtualenvwrapper and get dajaxice working. I wrote all about it on my blog, if there are any newbies wanting some consolidated info about it, ping me. Now I am curious to know if anyone out there in the Django community uses Twitter or has a Blog. If so, please Tweet me your blog @ljayadams. -- 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: Dajax, what do you think about it?
My opinion would be to add it in. But, I am not as experienced with Dajaxice as others may be. I just know it took me a long time to figure out how to manually add it and get it working. It wasn't until I learned how to use virtualenv that I was able to get Dajaxice installed and working correctly. On Mar 30, 10:55 pm, Sameer Rahmani wrote: > What do you think about using Dajax and Dajaxice in Django? is it worth? or > you like to write your own ajax code? -- 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.
Rendering only a portion of the page
I am building a django web app that has a control panel with various icons. Right now, the icons have href tags that load a new page when the user clicks the icon. I want to change this to instead call a jQuery function that will use ajax, or dajaxice, to render only the content part of the page. Does this sound possible? Would this be easier to do with Dajaxice, or with jQuery functions? Could I still use django templates for the content that corresponds with each icon? -- 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: Rendering only a portion of the page
Thank you, Jorge! Yes, that helps a lot! On Apr 2, 5:18 am, Jorge Bastida wrote: > Hi Lj, > > > I am building a django web app that has a control panel with various > > icons. Right now, the icons have href tags that load a new page when > > the user clicks the icon. I want to change this to instead call a > > jQuery function that will use ajax, or dajaxice, to render only the > > content part of the page. > > Does this sound possible? > > Yes, absolutely. > > > Would this be easier to do with Dajaxice, or with jQuery functions? > > Could I still use django templates for the content that corresponds > > with each icon? > > In every panel icon, you should register an onclick event and call your > registered dajaxice function or instead use jQuery to call your own view. > > That dajaxice function or your own view should return the html content that > you want to show. How? probably rendering that code using render_to_string > [1] > > [1]http://docs.djangoproject.com/en/dev/ref/templates/api/#the-render-to... > > Hope this helps you, > > Jorge Bastida. -- 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.