Re: django template forloop

2020-10-14 Thread webmbackslash
for field in formone not fieldi Il giorno mer 14 ott 2020 alle ore 13:06 RANGA BHARATH JINKA < bharathjink...@gmail.com> ha scritto: > Hi, > > You have to end for loop for second for loop > > On Wed, Oct 14, 2020 at 4:23 PM luca72.b...@gmail.com < > luca72.bertolo...@gmail.com> wrote: > >> Hello

Re: django template forloop

2020-10-14 Thread RANGA BHARATH JINKA
Hi, You have to end for loop for second for loop On Wed, Oct 14, 2020 at 4:23 PM luca72.b...@gmail.com < luca72.bertolo...@gmail.com> wrote: > Hello > I have this: > {% for x in lista_form %} > {% if forloop.counter < 100 %} > {% for fieldi in formone %} >

Re: Django Template Tags not working inside script

2019-10-10 Thread Rain
Thanks Alot. its just my code editor not reading it. appreciate your Help..!! On Thu, Oct 10, 2019 at 6:55 PM wd wrote: > hi, > > I didn't think django template tags are relevant with script or any html > code. They are totally different things. > I think it's just your code editor didn't recog

Re: Django Template Tags not working inside script

2019-10-10 Thread Rain
its totally fine now its just my code editor not reading it thanks for your help. Appreciated..!! On Thu, Oct 10, 2019 at 7:04 PM Andréas Kühne wrote: > Hi, > > This is completely vaid, as long as you use a render method to render the > html file. It shouldn't be a problem. How do you include th

Re: Django Template Tags not working inside script

2019-10-10 Thread Andréas Kühne
Hi, This is completely vaid, as long as you use a render method to render the html file. It shouldn't be a problem. How do you include this in your html page? Regards, Andréas Den tors 10 okt. 2019 kl 12:22 skrev Rain : > I want to add an for each method in inside script but for some reason >

Re: Django Template Tags not working inside script

2019-10-10 Thread wd
hi, I didn't think django template tags are relevant with script or any html code. They are totally different things. I think it's just your code editor didn't recognize the tags, have you tried ignore them and see if django will report an error ? On Thu, Oct 10, 2019 at 6:22 PM Rain wrote: > I

Re: Django Template url mapping

2019-08-22 Thread Abu Yusuf
Your template name should be: template_name = "index.html" That's all. On Thu, Aug 22, 2019 at 12:55 PM RONAK JAIN wrote: > Hi > > I am new in Django I am doing struggle with add Django templates using by > inheritance. > > > so when I am trying within *Example:: index.html add inside the > b

Re: Django template

2019-02-09 Thread rich gang
Hi guys, I just finished learning python on sololeran.com. And I wanna start django, so I was wondering If anybody would wanna help me personally. Like I said I have a fair knowledge about python. I would be grateful. thanks, On Sat, 9 Feb 2019 at 11:43, PASCUAL Eric wrote: > Hi, > > Templates a

Re: Django template

2019-02-09 Thread PASCUAL Eric
Hi, Templates are nothing more than HTML files with special tags inside. In their simplest form, they can be plain HTML without any templating tags and they will thus be rendered without any change. In conclusion, to keep it simple and still let you the opportunity to benefit from templating f

Re: Django template

2019-02-08 Thread Mikko Meronen
Hi, I haven't used any other framework, so maybe someone else can better answer that. But using my logic I think that if I want to change framework, I just have to know how to connect again my database to my html, which is just to learn the new framework logic I guess. But as I said, hopefully som

Re: Django template

2019-02-08 Thread Tom Zhang
Thanks. I know how to do this according to Django way. But if you use Django's way to transfer data, it makes it difficult to move to other frameworks, right? What do you think? On Saturday, February 9, 2019 at 1:42:19 AM UTC-5, Mikko wrote: > > Hi, > > You can connect your backend to frontend u

Re: Django template

2019-02-08 Thread Mikko Meronen
Hi, You can connect your backend to frontend using views.py file. In views.py you can get and sort your data from SQL and send it to your html. You probably should do tutorial or watch youtube videos (as I did since I get bored in reading very fast) to learn more. CodingEntrepreneur has done quit

Re: Django template

2019-02-08 Thread Tom Zhang
Thanks. But if I do this way, how do I transfer data between back-end and front-end? Do I use post request? On Friday, February 8, 2019 at 8:35:28 PM UTC-5, Nitin Kalmaste wrote: > > You are correct, > You are using HTML and JavaScript as template in django. You need to store > static files lik

Re: Django template

2019-02-08 Thread Nitin Kalmaste
You are correct, You are using HTML and JavaScript as template in django. You need to store static files like css/images/JavaScript in static folder and configure static folder in the settings file On Sat, Feb 9, 2019, 1:00 AM Mikko Meronen Hi, > > Have to say that Im still beginner in Django and

Re: Django template

2019-02-08 Thread Tom Zhang
I will give it a try first. Thanks On Friday, February 8, 2019 at 2:30:39 PM UTC-5, Mikko wrote: > > Hi, > > Have to say that Im still beginner in Django and coding, but I think you > just create you html files to your templates folder, and in the end you are > basically using just html. Django

Re: Django template

2019-02-08 Thread Mikko Meronen
Hi, Have to say that Im still beginner in Django and coding, but I think you just create you html files to your templates folder, and in the end you are basically using just html. Django can just find your html file from templates folder. Im just learning javascript and I assume i can save my js-

Re: Django template translation not working as expected

2019-01-10 Thread shiva kumar
Can you explain what are django translation On Thu 10 Jan, 2019 11:59 pm Ashutosh Das I am using django 2.1 , here is all the settings related to translation: > > > MIDDLEWARE = [ > 'corsheaders.middleware.CorsMiddleware', > 'django.middleware.security.SecurityMiddleware', > 'django.c

Re: Django template cheat sheet or ebook

2018-07-30 Thread mottaz hejaze
i think docs are very good On Mon, 30 Jul 2018, 13:41 , wrote: > Hello, > > I have found a lot of example on the Django's CookBook, at this url : > https://code.djangoproject.com/wiki/CookBook > > Le lundi 30 juillet 2018 05:44:44 UTC+2, aditya a écrit : >> >> Can anyone tell me where I can find

Re: Django template cheat sheet or ebook

2018-07-30 Thread Rahul Gurung
search or google or pinterest. On 30 July 2018 at 09:14, aditya gupta wrote: > Can anyone tell me where I can find Django template cheat sheet or ebook. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and

Re: Django template cheat sheet or ebook

2018-07-30 Thread benjamin . bernard-bouissieres
Hello, I have found a lot of example on the Django's CookBook, at this url : https://code.djangoproject.com/wiki/CookBook Le lundi 30 juillet 2018 05:44:44 UTC+2, aditya a écrit : > > Can anyone tell me where I can find Django template cheat sheet or ebook. > -- A quelle Vitesse surfez-vous ?

Re: django template rendering performance

2018-07-09 Thread Andrew Paulsen
No, Django renders the templates. Masoud, if you suspect there are negative difference between 2.7 and 3.5, please try to make a minimal app showing off the problem so the devs can fix it. On 2018-07-10 09:11, mottaz hejaze wrote: > i dont think so . rendering templates , though rendering templa

Re: django template rendering performance

2018-07-09 Thread mottaz hejaze
i dont think so . rendering templates , though rendering templates us a matter of the web server then users browsers On Tue, 10 Jul 2018, 00:56 Masoud Sadri, wrote: > Hi, > when rendering django(v 1.11) templates, is there any performance > difference between python 2.7 and 3.5? > > Thanks. > >

Re: Django Template and compating with select option value

2017-10-29 Thread Andréas Kühne
Hi, I am not really sure what you are trying to accomplish. What you are writing doesn't make sense. I think you should check how to write the paginate by properties. You can find some information here: https://docs.djangoproject.com/en/1.11/topics/pagination/ https://simpleisbetterthancomplex.co

Re: Django template language resolve url

2017-02-22 Thread chris rose
sorry i typed an s in there, here is that code amended > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post

Re: Django template language resolve url

2017-02-22 Thread chris rose
hey xyron.. i replied to your other thread your namespace should actually just be links so the answer should be: -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: Django template language resolve url

2017-02-22 Thread Luvpreet Singh
Iudovic is right, your syntax is wrong. use {% url 'ytlinks:save_ytlinks' %} the original syntax is , {% url 'namespace:url_name' arguments %} On Thursday, February 16, 2017 at 9:42:14 PM UTC+5:30, xyron wrote: > > Code hier eingeben... > > Hey there, > > I'm searching since more than 12 hours

Re: Django template language resolve url

2017-02-16 Thread ludovic coues
First, I would make sure all namespace are unique. Then I would try {% url "ytlinks:save_ytlink" %} In 'links.views.save_ytlink', I have no idea what links or views are. You might also want to re-read the documentation on urls namespace and included urlconfs https://docs.djangoproject.com/en/1.10

Re: Django template iterating through two dictionaries/variables

2016-08-30 Thread Aaron Weisberg
This is why i ask this group. Everyone helped out, but Nate's link pushed me in the right direction. Sometimes I don't even know what to ask stack overflow, but the google group always helps out. Thanks On Tuesday, August 30, 2016 at 11:28:37 AM UTC-5, Nate Granatir wrote: > > You could also

Re: Django template iterating through two dictionaries/variables

2016-08-30 Thread Nate Granatir
You could also just join the dicts before passing them to the template. It looks like it's relatively straightforward (scores is just a list that contains dicts of a 'Number' and a 'score', right?) Then you could turn scores into a dict, assuming Numbers are unique: scores_new = {score['Number'

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Asad Jibran Ahmed
Unfortunately without knowing your project layout I can't show you exactly how to load the filters, but you should give this a read: https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/. Your template should look like the example from Ludovic. Asad Jibran Ahmed http://blog.asadjb.c

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Aaron Weisberg
I hate to be thick but could you explain to me how to load the filters and also how the template should look with the updated function? Solving this will unlock a ton of functionality for my app. Thanks, Aaron On Aug 29, 2016 12:34 PM, "Asad Jibran Ahmed" wrote: > No problem. The most probabl

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Asad Jibran Ahmed
No problem. The most probable reason why you're getting the invalid filter error is because you forgot to load the filters. Your explanation of the workflow is correct, with one small correction. The template will handoff the search for the correct *Score* to the filter function. Whatever the f

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Aaron Weisberg
Thanks Asad. Is that why I'm getting errors saying invalid filter name? Also I'm having a difficult time thinking my way through the workflow. I'm defining a new function that requires scores(my URL based dictionary) and person (my database dictionary). The function then asks to return the scores

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Asad Jibran Ahmed
Since the example given by Ludovic uses the same variable names that are already present in your context, you won't need to change anything in the context dictionary. Just use {% load APP_NAME %} on top of the template file to load the filter and you should be good to go. On Monday, August 29,

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Asad Jibran Ahmed
No need to change the context, since the variable names the example here uses are the same as your existing context. It should work as long as you remember to {% load APPNAME %} your filters in the template first. ​ Asad Jibran Ahmed http://blog.asadjb.com On Mon, Aug 29, 2016 at 6:50 PM, Aaron

Re: Django template iterating through two dictionaries/variables

2016-08-29 Thread Aaron Weisberg
Thanks ludovic, I'm trying to write that python code presently- would I have to also change the context? how would that look? Thanks On Fri, Aug 26, 2016 at 10:40 AM, ludovic coues wrote: > You could write a filter [1]. It would be used like {{ > scores|from_player:person }} and look like tha

Re: Django template iterating through two dictionaries/variables

2016-08-26 Thread ludovic coues
You could write a filter [1]. It would be used like {{ scores|from_player:person }} and look like that: def from_player (scores, player): return scores[player.Number] You might want to adjust to your actual code, check that you got the right arguments and that kind of things. [1] htt

Re: django template {% url %}

2016-04-04 Thread 颜刚
yes,you are right,i have noticed that,but now i have a new error: i have this code in my template: {% for action in actions %} {{ action.name_short }} {% endfor %} the value of action.url_alias is 'user-edit' i.id host 'account' ,that's what i want value from table,i use django-hosts in

Re: django template {% url %}

2016-04-03 Thread Larry Martell
On Sun, Apr 3, 2016 at 11:50 AM, 颜刚 wrote: > > > i have this code in my template: > > {% for action in actions %} > > {{ action.name_short }} > > {% endfor %} > > but that's error: > > Exception Type: TemplateSyntaxError > Exception Value: > Could not parse the remainder: '{{' from '{{' > >

Re: Django template coverage

2015-09-24 Thread Ned Batchelder
This plugin won't work with Jinja2 templates, but another coverage.py plugin could be written for Jinja2, sure. Get in touch if you want to get started on it. --Ned. On 9/20/15 9:45 AM, Avraham Serour wrote: would this work with jinja2 templates also? On Tue, Aug 25, 2015 at 3:45 AM, Ned Ba

Re: Django template coverage

2015-09-20 Thread Avraham Serour
would this work with jinja2 templates also? On Tue, Aug 25, 2015 at 3:45 AM, Ned Batchelder wrote: > Hi all, > > If you've been using coverage measurement on your Django code, you might > be interested in a new development: now you can also measure the coverage > of your templates. > > Coverage.

Re: Django template not displaying

2015-03-12 Thread john
OK the view.py functions are the way Django responds to a browser request. IOW the browser asks for a page to display and Django checks the URL (in the urls.py). In the urls.py you have to have an entry something like url(r'signup/$', 'signup.views.home', name ='signup') and then Django excute

Re: Django template not displaying

2015-03-12 Thread sourav mohanty
from 'My templates just wouldn't load or show' , i mean that my base.html loads perfectly but signup.html doesn't show up. On Friday, March 13, 2015 at 12:20:26 AM UTC+5:30, sourav mohanty wrote: > > i have revised the views.py : > > from django.shortcuts import render, render_to_response, Reque

Re: Django template not displaying

2015-03-12 Thread sourav mohanty
I thank you for your reply and time.. But please help me.. On Thursday, March 12, 2015 at 6:50:23 PM UTC+5:30, John Fabiani wrote: > > You have two 'home' functions in views.py. > You have an indent on the first line of the urls.py (could be the paste) > You did not provide the forms.py > > Johnf

Re: Django template not displaying

2015-03-12 Thread sourav mohanty
i have revised the views.py : from django.shortcuts import render, render_to_response, RequestContext # from .forms import SignUpForm # Create your views here. from django.template import Context, Template def home(request): # form = SignUpForm(request.POST or None) # if form.is_valid(

Re: Django template not displaying

2015-03-12 Thread sourav mohanty
i have changed the views.py: from django.shortcuts import render, render_to_response, RequestContext # from .forms import SignUpForm # Create your views here. from django.template import Context, Template def home(request): # form = SignUpForm(request.POST or None) # if form.is_valid()

Re: Django template not displaying

2015-03-12 Thread James Schneider
You also have two different URL's named 'home', which will lead to a bad time. Make sure that those are unique. >From what I can tell, none of your views render/reference 'signup.html', so I would never expect that template to be rendered. Configure a fields attribute on your form to get rid of t

Re: Django template not displaying

2015-03-12 Thread john
You have two 'home' functions in views.py. You have an indent on the first line of the urls.py (could be the paste) You did not provide the forms.py Johnf On 03/12/2015 01:31 AM, sourav mohanty wrote: I dont know why but i'm facing a strange problem.. My templates just wouldn't load or show. c

Re: django template auto format tool?

2014-12-17 Thread Abraham Varricatt
Ha, ha. :D I'm no expert. I need the tool myself to learn a lot of this stuff. -Abraham V. On Wed, Dec 17, 2014 at 7:15 PM, Collin Anderson wrote: > > Hi Abraham, > > If you made a took, I'd use it. :) > > Collin > > On Saturday, December 13, 2014 9:53:56 PM UTC-5, Abraham Varricatt wrote: >>

Re: django template auto format tool?

2014-12-17 Thread Collin Anderson
Hi Abraham, If you made a took, I'd use it. :) Collin On Saturday, December 13, 2014 9:53:56 PM UTC-5, Abraham Varricatt wrote: > > Hello, > > Is there any command-line based tool which would let one auto-format > Django template files? Ideally, the tool should also be used to format > HTML, C

Re: django template auto format tool?

2014-12-15 Thread Abraham Varricatt
@José Luis Regalado, The vim idea is interesting, but I don't think too many developers can be convinced to open a file in a different editor just to format it. @ somecallitblues , Same reasoning. I'm using Pycharm myself, but for a mixed-editor/IDE team, I need a different tool to standardiz

Re: django template auto format tool?

2014-12-14 Thread Mario Gudelj
PyCharm ide does a great job for all those file types. On 14/12/2014 2:00 pm, "Abraham Varricatt" wrote: > Hello, > > Is there any command-line based tool which would let one auto-format > Django template files? Ideally, the tool should also be used to format > HTML, CSS and .JS files too. > > I'

Re: django template auto format tool?

2014-12-14 Thread Jose Regalado
Install vim-autoformat plugin https://github.com/Chiel92/vim-autoformat install sudo apt-get install python-autopep8 pep8 node nodejs sudo npm install -g js-beautify try: 1. create a vim file and put insde file: :Autoformat python :wq save and name it: indent.vim 2 now: vim -s indent.vim my

Re: Django Template Dir Question

2014-07-17 Thread Tom Evans
On Wed, Jul 16, 2014 at 9:37 PM, G Z wrote: > My project structure goes > > holon > > -holon > -settings.py > -etc > > -portal -App name > -static > css / images > -templates >-main site template files > views.py > url

Re: django template

2014-07-17 Thread ngangsia akumbo
Thanks On Wednesday, July 16, 2014 3:12:51 PM UTC+1, Andréas Kühne wrote: > > Hi, > > Sure, but I won't always be able to answer :-) > > Regards, > > Andréas > > > 2014-07-16 13:49 GMT+02:00 ngangsia akumbo >: > >> Thanks bro for this inside , can i always contact u personally if i had >>> so

Re: django template

2014-07-17 Thread ngangsia akumbo
Thanks On Wednesday, July 16, 2014 3:12:51 PM UTC+1, Andréas Kühne wrote: > > Hi, > > Sure, but I won't always be able to answer :-) > > Regards, > > Andréas > > > 2014-07-16 13:49 GMT+02:00 ngangsia akumbo >: > >> Thanks bro for this inside , can i always contact u personally if i had >>> so

Re: django template

2014-07-16 Thread Andreas Kuhne
Hi, Sure, but I won't always be able to answer :-) Regards, Andréas 2014-07-16 13:49 GMT+02:00 ngangsia akumbo : > Thanks bro for this inside , can i always contact u personally if i had >> some issues please. >> > > I am from western Africa - Cameroon. > > Thanks in advance > > -- > You rece

Re: django template

2014-07-16 Thread ngangsia akumbo
> > Thanks bro for this inside , can i always contact u personally if i had > some issues please. > I am from western Africa - Cameroon. Thanks in advance -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and sto

Re: django template

2014-07-16 Thread ngangsia akumbo
> > Thanks bro for this inside , can i always contact u personally if i had > some issues please. > I am from western Africa - Cameroon. Thanks in advance -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and sto

Re: django template

2014-07-16 Thread Andreas Kuhne
Hi again, You can create separate base files, but you will have to save each under different names. For example if you had an app called website, you could have a website_base.html that has {% extends "base.html" %} in it. As to how to link them together? What do you mean? Each app should contai

Re: django template

2014-07-16 Thread ngangsia akumbo
After creating these app with their html files , how do i link them together ? I am sorry if the question is stupid On Wednesday, July 16, 2014 10:11:45 AM UTC+1, Andréas Kühne wrote: > > Hi, > > All of your templates are available in all of your apps. So you can use a > template from one app in

Re: django template

2014-07-16 Thread ngangsia akumbo
ok can i create a seperate base.html in other app and link that app to the main base.html file. because after creating all these html files which links back to the main base.html, how would i link them? Thanks On Wednesday, July 16, 2014 10:11:45 AM UTC+1, Andréas Kühne wrote: > > Hi, > > All

Re: django template

2014-07-16 Thread Andreas Kuhne
Hi, All of your templates are available in all of your apps. So you can use a template from one app in another app (our website is created this way). In other words you can continue to use the same base.html for the second app as well. Regards, Andréas 2014-07-16 9:47 GMT+02:00 ngangsia akumbo

Re: Django Template - problema

2014-05-31 Thread Erick Brockes
It worked. Thank you very much 2014-05-31 4:33 GMT-03:00 Kelvin Wong : > At the very top of the models.py file add: > > # -*- coding: utf-8 -*- > from __future__ import unicode_literals > > I'm not sure this will work, but it might. > > K > > > > On Friday, May 30, 2014 8:35:58 PM UTC-7, ebrocke

Re: Django Template - problema

2014-05-31 Thread Kelvin Wong
At the very top of the models.py file add: # -*- coding: utf-8 -*- from __future__ import unicode_literals I'm not sure this will work, but it might. K On Friday, May 30, 2014 8:35:58 PM UTC-7, ebrockes wrote: > > Problem solved by replacing on models.py: > > TIPO_CONJUGE = ( > ('CA',

Re: Django Template - problema

2014-05-30 Thread Erick Brockes
Problem solved by replacing on models.py: TIPO_CONJUGE = ( ('CA', _('Casados')), ('UE', _('União estável')), ('OU', _('Outros')), ) by TIPO_CONJUGE = ( ('CA', _('Casados')), ('UE', _('Uniao estavel')), ('OU', _('Outros')), ) I'll see how t

Re: Django Template - problema

2014-05-30 Thread Erick Brockes
Kevin, Thank you. If you don't mind, I'm kind of new in django. I've got the following response in the browser: {'tipo_conjuge': } Could you help me out on how to proceed? 2014-05-30 18:45 GMT-03:00 Kelvin Wong : > In relacaoconjugetipouniao_form.html > > Add this tag...then refresh... > > {

Re: Django Template - problema

2014-05-30 Thread Kelvin Wong
In relacaoconjugetipouniao_form.html Add this tag...then refresh... {{ form.fields }} Should give you more info about what fields are in the form and what widget they are using. ie. 'tipo_conjuge': django.forms.fields.TypedChoiceField object Also check your html source in a browser. Sometimes

Re: Django Template Based If Statement Issue

2014-05-12 Thread donarb
On Monday, May 12, 2014 3:37:47 PM UTC-7, G Z wrote: > > ok its still not putting out the vm data i get > > > Grant - google.com - 7029855378 - zuk...@gmail.com - 2332 > oakland st > - - > > > {% for customer in customers %} > {{ customer.NAME }} - {{ customer.W

Re: Django Template Based If Statement Issue

2014-05-12 Thread G Z
> > ok its still not putting out the vm data i get Grant - google.com - 7029855378 - zuk...@gmail.com - 2332 oakland st - - {% for customer in customers %} {{ customer.NAME }} - {{ customer.WEBSITE }} - {{customer.PHONE}} - {{ customer.EMAIL }} - {{ customer.

Re: Django Template Based If Statement Issue

2014-05-12 Thread G Z
this is my models from django.db import models # Create your models here. class Customer(models.Model): NAME = models.CharField(max_length=200) WEBSITE = models.CharField(max_length=200) PHONE = models.CharField(max_length=200) EMAIL = models.CharField(max_length=200) ADDRES

Re: Django Template Based If Statement Issue

2014-05-12 Thread G Z
also thank you so much for your help. On Monday, May 12, 2014 4:00:27 PM UTC-6, Tom Evans wrote: > > On Mon, May 12, 2014 at 10:47 PM, G Z > > wrote: > > I'm just trying to associate each vm tied to the customers id and > display > > the vms under the customer that are associated with his id.

Re: Django Template Based If Statement Issue

2014-05-12 Thread Tom Evans
On Mon, May 12, 2014 at 10:47 PM, G Z wrote: > I'm just trying to associate each vm tied to the customers id and display > the vms under the customer that are associated with his id. > Normally, you would have some sort of relationship between those models, and the template code would look someth

Re: Django Template Based If Statement Issue

2014-05-12 Thread G Z
so as you can see when ever the vm field customer id matches the customers name i want to display the vm with the customer. To create a table of vms that each customer has. I also will be associating a third database with vmspecs to each vm. I know there is an easier way to do this with django

Re: Django Template Based If Statement Issue

2014-05-12 Thread G Z
I'm just trying to associate each vm tied to the customers id and display the vms under the customer that are associated with his id. On Monday, May 12, 2014 3:02:34 PM UTC-6, G Z wrote: > > Views.py > > > from django.shortcuts import render > from django.http import HttpResponse > from vmware.mo

Re: Django Template Based If Statement Issue

2014-05-12 Thread Tom Evans
On Mon, May 12, 2014 at 10:02 PM, G Z wrote: > Views.py > > > from django.shortcuts import render > from django.http import HttpResponse > from vmware.models import Customer > from django.shortcuts import render_to_response > from vmware.models import Vms > > def index(request): > customer

Re: django template string and int comparison behavior

2013-09-20 Thread J Y
That makes a lot of sense. Thanks for the explanation. I will use the view to convert it to an int. Jack On Tuesday, September 17, 2013 1:00:01 PM UTC-7, ke1g wrote: > > Yes, this is the expected behavior. The GET parameter is a string, being > something that is just parsed out of the query

Re: django template string and int comparison behavior

2013-09-17 Thread Bill Freeman
Yes, this is the expected behavior. The GET parameter is a string, being something that is just parsed out of the query parameter portion of the URL (which is, itself, a string). There is nothing to inform the code that parses the query parameters which of the things that might look like numbers

Re: django template string and int comparison behavior

2013-09-17 Thread Rafael Durán Castañeda
Hi, I don´t think using requests objects into templates is a good idea, use request object in the view so you source the template context with whatever you need. HTH El 17/09/2013, a las 20:50, J Y escribió: > I am building a search form that provides a drop down list, and then on the > sear

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-26 Thread Daviddd
I solved in this way: my_dict = collections.defaultdict(lambda: collections.defaultdict(list)) for obj in queryset: my_dict[int(obj.position.split('-')[0])][int(obj.position.split('-')[2])].append(obj) for obj in my_dict: my_dict[obj].default_factory = No

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-26 Thread Daviddd
On Friday, August 23, 2013 5:58:38 PM UTC+2, Daviddd wrote: > > Dear All, > > In my view I create the following dictionary of lists from a queryset > > #view.py > queryset = MyModel.objects.filter(owner=user, > dashboard=tab).order_by('position') > my_dict = collections.defaultdict(lambda: colle

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-26 Thread Thomas Scrace
On Monday, 26 August 2013, Daviddd wrote: > Sincerely, I don't know how I can create the dict without using > defaultdict. > > D > You can create it using a defaultdict if you want to, but once it is created, and before you pass it to the template, loop through all the values of your outer dict a

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-25 Thread Daviddd
Thanks Tom for replying! The code used to create the dict is: my_dict = collections.defaultdict(lambda: collections.defaultdict(list)) for obj in queryset: my_dict[int(obj.position.split('-')[0])][int(obj.position.split('-')[2])].append(obj) Basically I have one field in the queryset calle

Re: django template loop collections.defaultdict(lambda: collections.defaultdict(list))

2013-08-24 Thread Thomas Scrace
On 23 Aug 2013, at 16:58, Daviddd wrote: > In my template I tried: > > {% for key, groups in queryset.iteritems %} > groups = {{ groups }} > {% for group_key, cols in groups.iteritems %} > cols = {{ group_key }} > {% for objs in cols %} > {# rest of the code #} >

Re: django template prints

2013-07-16 Thread Lukas Nemec
If you have some DB model where is the data saved, you can do this from project.app.models import NameOfModel # try this, but if it will not work, look at django models help filtered_data = NameOfModel.objects.filter(job_id___gt=29).filter(job_id__lt=401) for d in filtered_data: print d

Re: Django template IndexError

2011-09-21 Thread Martin Tiršel
It seems, that Django handles methods and variables indexes differently. So I solved it this way: e = IndexError() e.silent_variable_failure = True raise e Martin On Wed, 21 Sep 2011 23:36:58 +0200, Martin Tiršel wrote: Hello, I have this situation: class SomeClass(object): ...

Re: django template extends and include problem.

2011-06-13 Thread yohanes . adhi
.temp.html {% extends "index.html" % {% block t2 %} zzz {% endblock %} .index.html {% extends "base.html" %} {% block t1 %} kk {% endblock %} {% block t2 %} {% endblock %} That will do. Sent from BlackBerry® on 3 -Original Message- From: Korobase Sender: djan

Re: django template strange behavior

2011-04-14 Thread Jason Culverhouse
You can use the template language to test against what you think are constants, the parser is actually testing 2 "literals". The parser tests for 2 literals with names 'None' and 'False'. When parser tries to resolve these in the context a VariableDoesNotExist exception is thrown and both object

RE: Django Template CSS Load Path

2011-01-30 Thread Chris Matthews
: Django users Subject: Re: Django Template CSS Load Path I still cannot get the css page to load. On Jan 19, 4:02 pm, Matías Iturburu wrote: > On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < > > eduardocer...@gmail.com> wrote: > > You can use MEDIA_URL conf to get the r

Re: Django Template CSS Load Path

2011-01-29 Thread octopusgrabbus
Interestingly, I added TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.core.context_processors.media', ) to my settings.py and got this error. Put 'django.contrib.auth.context_processors.auth' in your TEMPLATE_CONTEXT_PROCESSORS setting in order to use t

Re: Django Template CSS Load Path

2011-01-29 Thread octopusgrabbus
I still cannot get the css page to load. On Jan 19, 4:02 pm, Matías Iturburu wrote: > On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < > > eduardocer...@gmail.com> wrote: > > You can use MEDIA_URL conf to get the root path to your media files. > > > > /> > My MEDIA_URL is MEDIA_URL =

Re: Django Template CSS Load Path

2011-01-19 Thread Matías Iturburu
On Wed, Jan 19, 2011 at 5:30 PM, Eduardo Cereto Carvalho < eduardocer...@gmail.com> wrote: > You can use MEDIA_URL conf to get the root path to your media files. > > /> > > the above code is correct, just make sure that you are using the media context processor or returning a RequestContext, not

Re: Django Template CSS Load Path

2011-01-19 Thread Eduardo Cereto Carvalho
You can use MEDIA_URL conf to get the root path to your media files. On Wed, Jan 19, 2011 at 5:55 PM, octopusgrabbus wrote: > I am trying to load a css file in my base.html template > > > > >{% block title %}Test{% endblock %} > > > > What kind of path is supposed

Re: Django template tags.

2010-12-08 Thread Nuño Iglesias
El Wed, 8 Dec 2010 20:00:42 +0100 Łukasz Rekucki escribió: > 2010/12/8 Nuño Iglesias : > > > > What i'm trying to do is this: > >   {{ mystring | upper }} > > to convert "mystring" into upper-case. > > AFAIR, there should be no spaces before or after "|": > {{ variable|upper }} > > Ups :-s Th

Re: Django template tags.

2010-12-08 Thread Łukasz Rekucki
2010/12/8 Nuño Iglesias : > > What i'm trying to do is this: >   {{ mystring | upper }} > to convert "mystring" into upper-case. AFAIR, there should be no spaces before or after "|": {{ variable|upper }} -- Łukasz Rekucki -- You received this message because you are subscribed to the Google G

Re: Django template : For Loop

2010-09-06 Thread Tim Chase
but is this correct way to get values from two tables and use in templates? Me actually want to combine to tables and use there values in template Is the above post code is correct way to do this? Combine the in the *view* with the zip() built-in, and use Steve's suggestion to split the part

Re: Django template : For Loop

2010-09-06 Thread Jagdeep Singh Malhi
> but is this correct way to get values from two tables and use in > templates? Me actually want to combine to tables and use there values in template Is the above post code is correct way to do this? Thanks -- You received this message because you are subscribed to the Google Groups "Django

Re: Django template : For Loop

2010-09-05 Thread Jagdeep Singh Malhi
> > I tried this, its not working. > > Sorry, but "not working" does not constitute useful information. > > My car isn't working. Can you fix it? ;-) model.py from django.db import models from django.forms import ModelForm class Input(models.Model): input1 = models.FloatField() input2 =

Re: Django template : For Loop

2010-09-05 Thread Steve Holden
On 9/5/2010 12:29 PM, Jagdeep Singh Malhi wrote: > >> If these objects are lists, say list1 and list2, in your view just >> create a single object made up of pairs of elements from the original lists: >> >>values = zip(list1, list2) >> >> Then you can pass that item to your template and iterat

Re: Django template : For Loop

2010-09-05 Thread Justin Myers
What error message is it giving you? I'd assume it's a problem with the objects you're passing it, since zip is a built-in Python function: http://docs.python.org/library/functions.html#zip On Sep 5, 11:29 am, Jagdeep Singh Malhi wrote: > > If these objects are lists, say list1 and list2, in yo

  1   2   >