Template - counter for if loop
I need to show the heading only one time when forloop executed along with if-loop; example: - data.html -- {% for val in data %} {% ifnotequal val 2 %} My Heading {{val}} {% endifnotequal %} {% endfor %} Input data=[1,2,3,4,5,2,6] Excepted Out put: --- My heading 1 3 4 5 6 Here "My Heading" shouldn't repeat and it should occur one time. We can't use forloop.counter/first, since we have a if-loop condition . Pl let me know how to implement it. Thanks & Regards, Jai -- 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 implement a data grid? (or populate inlineformset with initial data)
Hi, Long back i had used Dojo data grid, plz go through my blog http://jayapal-d.blogspot.com/2009/08/dojo-datagrid-with-editable-cells-in.html I am sure that we can do with jquery. Lemme know if u required any help. Thanks, Jayapal On May 31, 6:39 am, snfctechwrote: > I want to display a list of records that have some editable fields and > some readonly fields, as well as asynchronously add new records to the > list. I thought the way to start would be with an InlineFormSet - but > I can't figure out how to populate my formset with initial data. E.g. > MyInlineFormset(queryset=myquery.all()) or > MyInlineFormset(data=myquery.vales()) doesn't do the trick. > > Can someone steer me in the right direction? > > 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.
Django persistent database(postgres) connection.
Hi friends, My django application runs in red hat server with apache & mod_wsgi. We have several request which interacts with database(postgresql), so database interaction is huge. i found that every time django application establishing a new connection to interact with DB. So my server hanging often due to large number of DB connection (approximately some 200-250 connection/minute, it may increase gradually) Its very urgent. Hope I will get support here Thanks for looking my thread. Thanks & Regards, Jayapal D -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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 interactive shell shows invalid datetime
Dear friends, I am just wondering how comes django interactive shell shows wrong datetime. I.e my system correct time (python shell) shows print datetime.datetime.now() --> ``2010-08-09 00:44:33.439732`` and django interactive shell shows wrong time print datetime.datetime.now()--> ``2010-08-09 10:13:47.457335``. So almost 10 hours greater than the current time. How comes its possible ? How can I solve this? Thanks for spending time to reading my issue.. Jayapal D -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
change database schema ``Public``
HI friends, How can we change the database schema ``Public`` to ``MySchema``. Default syncdb will create tables in public schema. How can i change it? Thanks & Regards, Jayapal D -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Search by omitting special characters
HI Leepy, Even am also got stuck with the same issue. Did you find any solution? I want to search content inside TEXTFEILD without any condition like (comma, line break, space)Can anyone here to help me out to solve this issue. Thanks & Regards, Jai Python On Nov 23, 4:15 pm, leppywrote: > Hi all, > > I have a TextFeild() in my application for storing addresses. It > contains address as comma separated, or space separated, or with > linefeed characters. When I try to search the field using 'icontains' > by giving address as comma separated value, I am getting a null query > set. > > I am getting address from requested url as 'testing, testing 1, > testing 2.' > > i.e., > > >>> ModelName.objects.filter(address__icontains= 'testing, testing 1, > >>> testing 2.') > >>> [] > > Getting [] since the address is being stored in the model as > u'testing,\r\ntesting 1,\r\ntesting 2.' > > How can I search address by omitting some special characters such as > '\r\n', ',' etc. since I'm not sure how end users will add data via > django admin page. > > Thanks in advance, > Leppy. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: redirect or reload page after pdf file generation.
I save the response content in pdf file and then page will be redirected and pdf file will be called on page onload Thanks Jai On Nov 3, 11:10 am, Jani Tiainen <rede...@gmail.com> wrote: > jai_python kirjoitti: > > > > > Hello every one, > > > I have a form which contains group of data and I can select some of > > them to take pdf file. When I submit the form, it returns pdf file > > which contains the selected data. But i need to redirect or reload the > > present form after pdf file has been generated inorder to remove > > previous entry(i.e data included in the pdf file ) . Here goes my > > source > > > def getPDF(request): > > if not request.POST: > > return to html form page > > response = HttpResponse(mimetype='application/pdf') > > #some content will be added to response with the use REPORTLAB > > return response# will return pdf > > > This response will sent an pdf file to client side. same time i want > > to reload or refresh after pdf file generation. > > I don't think that such a mechanism exists in HTTP protocol so what > you're asking might not be really possible. > > With little JS (ajax iframe download) you can achieve that kind of > refresh like functionality. But it relies on ajax functionality. > > -- > Jani Tiainen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
redirect or reload page after pdf file generation.
Hello every one, I have a form which contains group of data and I can select some of them to take pdf file. When I submit the form, it returns pdf file which contains the selected data. But i need to redirect or reload the present form after pdf file has been generated inorder to remove previous entry(i.e data included in the pdf file ) . Here goes my source def getPDF(request): if not request.POST: return to html form page response = HttpResponse(mimetype='application/pdf') #some content will be added to response with the use REPORTLAB return response# will return pdf This response will sent an pdf file to client side. same time i want to reload or refresh after pdf file generation. Thanks & Regards, Jai --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
inlineformset_factory multiple models error.
Hie I am using formset for edit details belonging to a particular ticket. But when I used the below function , I am getting error as follows. Models --- class Ticket(models.Model): ticket_id = models.AutoField("ID", primary_key=True) title = models.CharField("Ticket title", max_length=50) class Comment(models.Model): ticket_id = models.ForeignKey(Ticket) comment = models.TextField(max_length=500) class Attachment(models.Model): ticket_id = models.ForeignKey(Ticket) attach_title = models.CharField("Title", max_length=30, blank=True, null=True) Views -- def edit(request, ticket_id): ticket = get_object_or_404(Ticket, pk=ticket_id) TickFomset=inlineformset_factory(Ticket,Comment,Attachment)# error arise in this line. formset=TickFomset(instance=ticket) Error: TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases Please help me to fix this issue. Thanks in advance. Jayapal --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Invoke Django admin list filter
Hi Friends. Can any one help me to implement or invoke Django default admin list filter in our own application. Thanks in advance, Jayapal D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamic upload paths Based on object
I want to create Dynamic Upload Path for my models as follows. Models.py. --- class Books(models.Model): no=models.IntegerField() class Collection(models.Model): Page=models.ForeignKey('Books') image=models.ImageField(upload_to='Book_Media') def save(self): for field in self._meta.fields: if field.name == 'image': field.upload_to = 'Book_Media/'+str(self.Page.no) super(Collection, self).save() - Issue: - When ever i upload an image in 'Collection Models', the image is stored in previous object path. how can we overcome this ? Or else is there any other solution for DYNAMIC PATH based on object? Thanks & Regards, Jayapal --~--~-~--~~~---~--~~ 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 decimal field query issue
Hie, I have a problem in django decimal field query execution. Here i have explained clearly about my problem. Model Class VehicleLocation: simno = models.DecimalField(max_digits=10, decimal_places=0) latitude = models.DecimalField(max_digits=25, decimal_places=16) longitude =models.DecimalField(max_digits=25, decimal_places=16) Sample data in table: simnolongitude latitude 1 4545. 2493386.1000 2 638936. 2745824. 1.Test.py -- from decimal import * def Location(request): getcontext().prec = 16 # here make decimal precision length as 16 long=Decimal('2745824.') # here 'long' data type is VehicleObject=VehicleLocation.objects.get(longitude=long) print VehicleObject Ouput: I am able to get the vehilcelocation object. --- 2.Error.py --- from decimal import * def Location(request): getcontext().prec = 16 # here make decimal precision length long=Decimal('2493386.1000 ') # here 'long' data type is VehicleObject=VehicleLocation.objects.get(longitude=long) print VehicleObject Ouput: error VehicleLocation matching query does not exist. Issue: The issue which i found was when we give any value other than zero after dot(1.1000), then query always fail. If we give values zero after dot(1.) then i am able to get output. How can i overcome this problem? Thanks & Regards, Jayapal D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Database connection object in session
Hi. Is it possible to add database connection object in session and handle in different views. Thanks in advance. Jayapal --~--~-~--~~~---~--~~ 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 can i use "Django Admin" part sortable in my project?
Hi frenz, i want to use sortable in my project for sorting datas. already django admin part has one sortable. can we use(extend) admin part sortable in our project. if possible, can you please tel me how can i do it? Would be thankful for reply. Jayapal --~--~-~--~~~---~--~~ 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 +Appy Framework+ generate pdf and odt file
No one here to solve my 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 -~--~~~~--~~--~--~---
DJango +Appy Framework+ generate pdf and odt file
Dear all, I am using POD APPY framework (http://appyframework.org/) for generating reports in pdf and odt files. i am able to get reports in odt file using development server. when i tried with pdf reports, i got an error ERROR An error occurred during the conversion. Could not connect to OpenOffice on port 2002. UNO (OpenOffice API) says: Connector : couldn't connect to socket (Success). - When i googled out this error, i got a solution. SOLUTION-Run the comman in terminal -- /usr/lib/openoffice/program/soffice "- accept=socket,host=localhost,port=2002;urp;" -- then i am able to get the reports in pdf in development server. PROBLEM The problem i am facing is, i have deployed my project in apache with modpython. i can get the report in odt file with out any problem. but when i try to get the report in pdf format, i am getting an error Error is --- com.sun.star.task.ErrorCodeIOException --- i have gooogled out to solve this issue, but still i am hanging with tis error Can any one help me to solve this problem. thanks in advance :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
please help me to solve the anchor tag issue
Hi.. I want to implement "HELP" in my project. For time being i am planning to do a general help by including all help contents in the same html file(say for example-help.html). My application contains some 10 pages (search page, login page, form submit page, report page,...etc ) with a Help-Button. When clicking on help button, i want to show the content in the HELP page regarding the particular page accessed by the enduser. Example: --- help.html file seems to be {% extends "base.html" %} {% block content %} Search 1. 2. 3. Report 1. 2. 3. etc. {% endblock %} --- If a user click help button from the report page, then it should show the Report section from the help.html. Its just like a anchor tag used to navigate within one page. Can anyone help me out? thanks in advance... --~--~-~--~~~---~--~~ 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: Get values of HTML Select Multiple Tag From request.POST
thanks for your reply. I got the solution On Nov 29, 2:30 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sat, Nov 29, 2008 at 3:19 AM, jai_python <[EMAIL PROTECTED]> wrote: > > Issue that I found out is "The variable 'colour' gets overwritten > > everytime when the user selects different values". Then how come it is > > possible that the request.POST shows all selected values. And why am > > not getting the same when i extract value from the variable 'colour'. > > Any help would be thankful > > A full and complete explanation is available in the Django > documentation on HttpRequest objects. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Get values of HTML Select Multiple Tag From request.POST
HI, I have a problem in getting values from an HTML SELECT MULTIPLE TAG through request.POST -- My form.html page contains Red Pink Black --- My view file: success.py print "POST data--->", request.POST print "Selected Colours--->",request.POST['colour'] -- Output: POST data--->request.POST 1 - Issue that I found out is "The variable 'colour' gets overwritten everytime when the user selects different values". Then how come it is possible that the request.POST shows all selected values. And why am not getting the same when i extract value from the variable 'colour'. Any help would be thankful --~--~-~--~~~---~--~~ 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: Logout- Back Button
Any possible to clear browser cache alone using javascript? it ill help to solve this back button 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: parameter not getting passed to view function
modify ur url as (r'^hello/(?P[^/]+\w*)/?', 'swamiji.poll.views.hello') http://localhost:8000/hello/TEST then "print who" in ur view file. Lemme know, if it fails to work. --~--~-~--~~~---~--~~ 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: Logout- Back Button
i have tried with Django decorators never_cache and cache_control, but still facing same issue. its purely based on browser cache. never_cache decorators say that browser wont get cache, but its Firefox by default cached all time. Then i googled out to find a solution to clear cache using javascript, but i dint get any solution so far. in some forum , members saying that due to security purpose, we cant clear cache using javascript. so any suggestion to overcome this problem? if we get a solution, then it would be helpful for all Thanks for all replies... :) --~--~-~--~~~---~--~~ 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: Logout- Back Button
hi.. i tried with logout_then_login method. But i am still facing that back button after logout issue.. any other suggestion? --~--~-~--~~~---~--~~ 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: Logout- Back Button
thanks alot for your reply. i need to check out this logout_then_login method. i will update the status after testing. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Logout- Back Button
But closing browser after logout in not a proper solution for this issue right? just take gmail as example, after logout from gmail accont and hit back button, it will prompt to login page, this is one proper method for secure our data. Does django supports this methodology ? --~--~-~--~~~---~--~~ 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: Logout- Back Button
Please help me out --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Logout- Back Button
Hi, i have created a project named as Asset and application named as Management. The problem i am facing is after i logout form the project, if i hit the back button it fails to show the login window. I knew that some browsers don't actually hit the server on a "back". So can u tel me how to implement "redirect to login page, if i hit back button after logout." Its very urgent to implement in my project. would be thank full for replies :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to give a style for "CHOICE FILED" in py file
class cust_search(forms.Form): customer_name= forms.CharField(max_length = 255, required = False) product_id= forms.CharField(max_length = 1, required = False) date1=forms.DateField(widget=forms.TextInput(attrs={'class':"vDateField"}),required = False) date2=forms.DateField(widget=forms.TextInput(attrs={'class':"vDateField"}),required = False) group_name=forms.ChoiceField(choices=[("itp","ITP"),("csg", "CSG"), ("nwg","NWG"),("pcis","PCIS"),("serv","SERV"),("swg","SWG"), ("wsg","WSG")],required = False) I WANT TO GIVE A STYLE FOR CHOICE FILED DATA(swg,wsg)... HW CAN I? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---