Re: fetching values from model

2010-09-02 Thread Pradnya
ok Thanks. How about using Register tags. It's in
Django.template.Library.
Is it a good practice to use simple_tag? I want to know the plus
points and drawbacks of simple_tag.

On Sep 2, 8:52 pm, Justin Myers  wrote:
> In theory, if the view passed that function to the template (or if it
> were available as a method on something else that was passed to the
> template), I suppose you could. That said, you wouldn't be able to
> pass it any arguments.
>
> Once again, the template is _not_ designed for programming logic. It's
> _only_ designed for presentation. For the most part, if you want to
> call a function, call it in the view.
> -Justin
>
> On Sep 1, 11:02 pm, Pradnya  wrote:
>
> > Hey thanks,
> > Is there anyway I can call a function in HTML template?
>
> > On Sep 1, 6:23 pm, Steve Holden  wrote:
>
> > > On 9/1/2010 9:13 AM, Pradnya wrote:>> ok. Is there any way I can load the 
> > > model inside HTML template?
> > > >> What is {% load  %} tag all about?
>
> > > The {% load %} tag is for loading custom tags. Nothing to do with
> > > accessing the database.
>
> > > Why do you find it desirable to load records in the template?  What's
> > > wrong with doing it in the view, which is what everyone else does and
> > > how Django is intended to be used? See Jonas' remarks below.
>
> > > regards
> > >  Steve
>
> > > >> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
> > >  You don't write Python code inside your template file. That's
> > >  one of the basic django template rules. You can pass values
> > >  from your views to your template and show them there. Or
> > >  generate the HTML in your view and show it from there, which
> > >  isn't something I could advise if you're creating a larger
> > >  application.
>
> > >  Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
> > > >> Hello,
>
> > > >> Is it possible to fetch a particular record from model
> > > >> using school.object.get(id = 1) inside html template.
>
> > > >> Please suggest.
>
> > > >> Thanks Pradnya
>
> > > >> -- 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
> > > >> athttp://groups.google.com/group/django-users?hl=en.
>
> > >  Met vriendelijke groeten,
>
> > >  Jonas Geiregat jo...@geiregat.org

-- 
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: fetching values from model

2010-09-02 Thread Justin Myers
In theory, if the view passed that function to the template (or if it
were available as a method on something else that was passed to the
template), I suppose you could. That said, you wouldn't be able to
pass it any arguments.

Once again, the template is _not_ designed for programming logic. It's
_only_ designed for presentation. For the most part, if you want to
call a function, call it in the view.
-Justin

On Sep 1, 11:02 pm, Pradnya  wrote:
> Hey thanks,
> Is there anyway I can call a function in HTML template?
>
> On Sep 1, 6:23 pm, Steve Holden  wrote:
>
> > On 9/1/2010 9:13 AM, Pradnya wrote:>> ok. Is there any way I can load the 
> > model inside HTML template?
> > >> What is {% load  %} tag all about?
>
> > The {% load %} tag is for loading custom tags. Nothing to do with
> > accessing the database.
>
> > Why do you find it desirable to load records in the template?  What's
> > wrong with doing it in the view, which is what everyone else does and
> > how Django is intended to be used? See Jonas' remarks below.
>
> > regards
> >  Steve
>
> > >> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
> >  You don't write Python code inside your template file. That's
> >  one of the basic django template rules. You can pass values
> >  from your views to your template and show them there. Or
> >  generate the HTML in your view and show it from there, which
> >  isn't something I could advise if you're creating a larger
> >  application.
>
> >  Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
> > >> Hello,
>
> > >> Is it possible to fetch a particular record from model
> > >> using school.object.get(id = 1) inside html template.
>
> > >> Please suggest.
>
> > >> Thanks Pradnya
>
> > >> -- 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
> > >> athttp://groups.google.com/group/django-users?hl=en.
>
> >  Met vriendelijke groeten,
>
> >  Jonas Geiregat jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread commonzenpython
no :)

-- 
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: fetching values from model

2010-09-01 Thread Pradnya
Hey thanks,
Is there anyway I can call a function in HTML template?


On Sep 1, 6:23 pm, Steve Holden  wrote:
> On 9/1/2010 9:13 AM, Pradnya wrote:>> ok. Is there any way I can load the 
> model inside HTML template?
> >> What is {% load  %} tag all about?
>
> The {% load %} tag is for loading custom tags. Nothing to do with
> accessing the database.
>
> Why do you find it desirable to load records in the template?  What's
> wrong with doing it in the view, which is what everyone else does and
> how Django is intended to be used? See Jonas' remarks below.
>
> regards
>  Steve
>
> >> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
>  You don't write Python code inside your template file. That's
>  one of the basic django template rules. You can pass values
>  from your views to your template and show them there. Or
>  generate the HTML in your view and show it from there, which
>  isn't something I could advise if you're creating a larger
>  application.
>
>  Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
> >> Hello,
>
> >> Is it possible to fetch a particular record from model
> >> using school.object.get(id = 1) inside html template.
>
> >> Please suggest.
>
> >> Thanks Pradnya
>
> >> -- 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
> >> athttp://groups.google.com/group/django-users?hl=en.
>
>  Met vriendelijke groeten,
>
>  Jonas Geiregat jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread Pradnya
Hey thanks,
Is there anyway I can call a function in HTML template?


On Sep 1, 6:23 pm, Steve Holden  wrote:
> On 9/1/2010 9:13 AM, Pradnya wrote:>> ok. Is there any way I can load the 
> model inside HTML template?
> >> What is {% load  %} tag all about?
>
> The {% load %} tag is for loading custom tags. Nothing to do with
> accessing the database.
>
> Why do you find it desirable to load records in the template?  What's
> wrong with doing it in the view, which is what everyone else does and
> how Django is intended to be used? See Jonas' remarks below.
>
> regards
>  Steve
>
> >> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
>  You don't write Python code inside your template file. That's
>  one of the basic django template rules. You can pass values
>  from your views to your template and show them there. Or
>  generate the HTML in your view and show it from there, which
>  isn't something I could advise if you're creating a larger
>  application.
>
>  Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
> >> Hello,
>
> >> Is it possible to fetch a particular record from model
> >> using school.object.get(id = 1) inside html template.
>
> >> Please suggest.
>
> >> Thanks Pradnya
>
> >> -- 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
> >> athttp://groups.google.com/group/django-users?hl=en.
>
>  Met vriendelijke groeten,
>
>  Jonas Geiregat jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread Justin Myers
The only way to access a model from within a template is if the view
specifically passed it via the template's context. Even then, you
wouldn't be able to do much passing the model _class_ this way; you
should be passing specific model _instances_. As the design
philosophies doc says, "We see a template system as a tool that
controls presentation and presentation-related logic – and that’s it."
http://docs.djangoproject.com/en/dev/misc/design-philosophies/#template-system

{% load %} is completely unrelated. It's used to load custom template
tags and filters: 
http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/

-Justin

On Sep 1, 8:12 am, Pradnya  wrote:
> ok. Is there anyway I can load model inside HTML template? or
> basically what is {% load  %} is used for ?
>
> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
>
> > You don't write Python code inside your template file. That's one of the 
> > basic django template rules.
> > You can pass values from your views to your template and show them there.
> > Or generate the HTML in your view and show it from there, which isn't 
> > something I could advise if you're creating a larger application.
>
> > Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
> > > Hello,
>
> > > Is it possible to fetch a particular record from model using
> > > school.object.get(id = 1) inside html template.
>
> > > Please suggest.
>
> > > Thanks
> > > Pradnya
>
> > > --
> > > 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 
> > > athttp://groups.google.com/group/django-users?hl=en.
>
> > Met vriendelijke groeten,
>
> > Jonas Geiregat
> > jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread Steve Holden
On 9/1/2010 9:13 AM, Pradnya wrote:
>> ok. Is there any way I can load the model inside HTML template?
>> What is {% load  %} tag all about?
>> 
The {% load %} tag is for loading custom tags. Nothing to do with
accessing the database.

Why do you find it desirable to load records in the template?  What's
wrong with doing it in the view, which is what everyone else does and
how Django is intended to be used? See Jonas' remarks below.

regards
 Steve

>> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
 You don't write Python code inside your template file. That's
 one of the basic django template rules. You can pass values
 from your views to your template and show them there. Or
 generate the HTML in your view and show it from there, which
 isn't something I could advise if you're creating a larger
 application.
 
 Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
 
 
 
>> Hello,
 
>> Is it possible to fetch a particular record from model
>> using school.object.get(id = 1) inside html template.
 
>> Please suggest.
 
>> Thanks Pradnya
 
>> -- 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 
>> athttp://groups.google.com/group/django-users?hl=en.
 
 Met vriendelijke groeten,
 
 Jonas Geiregat jo...@geiregat.org
>> 

-- 
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: fetching values from model

2010-09-01 Thread Jonas Geiregat
I suggest you read the djangobook or some of the django documentation because 
this is very well documented.

Good luck with that!

Op 1-sep-2010, om 15:13 heeft Pradnya het volgende geschreven:

> ok. Is there any way I can load the model inside HTML template? What
> is {% load  %} tag all about?
> 
> On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
>> You don't write Python code inside your template file. That's one of the 
>> basic django template rules.
>> You can pass values from your views to your template and show them there.
>> Or generate the HTML in your view and show it from there, which isn't 
>> something I could advise if you're creating a larger application.
>> 
>> Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>> 
>> 
>> 
>>> Hello,
>> 
>>> Is it possible to fetch a particular record from model using
>>> school.object.get(id = 1) inside html template.
>> 
>>> Please suggest.
>> 
>>> Thanks
>>> Pradnya
>> 
>>> --
>>> 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 
>>> athttp://groups.google.com/group/django-users?hl=en.
>> 
>> Met vriendelijke groeten,
>> 
>> Jonas Geiregat
>> jo...@geiregat.org
> 
> -- 
> 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.
> 

Met vriendelijke groeten,

Jonas Geiregat
jo...@geiregat.org




-- 
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: fetching values from model

2010-09-01 Thread Pradnya
ok. Is there any way I can load the model inside HTML template? What
is {% load  %} tag all about?

On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
> You don't write Python code inside your template file. That's one of the 
> basic django template rules.
> You can pass values from your views to your template and show them there.
> Or generate the HTML in your view and show it from there, which isn't 
> something I could advise if you're creating a larger application.
>
> Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
>
>
> > Hello,
>
> > Is it possible to fetch a particular record from model using
> > school.object.get(id = 1) inside html template.
>
> > Please suggest.
>
> > Thanks
> > Pradnya
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Met vriendelijke groeten,
>
> Jonas Geiregat
> jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread Pradnya
ok. Is there anyway I can load model inside HTML template? or
basically what is {% load  %} is used for ?

On Sep 1, 6:02 pm, Jonas Geiregat  wrote:
> You don't write Python code inside your template file. That's one of the 
> basic django template rules.
> You can pass values from your views to your template and show them there.
> Or generate the HTML in your view and show it from there, which isn't 
> something I could advise if you're creating a larger application.
>
> Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:
>
>
>
> > Hello,
>
> > Is it possible to fetch a particular record from model using
> > school.object.get(id = 1) inside html template.
>
> > Please suggest.
>
> > Thanks
> > Pradnya
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Met vriendelijke groeten,
>
> Jonas Geiregat
> jo...@geiregat.org

-- 
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: fetching values from model

2010-09-01 Thread Jonas Geiregat

You don't write Python code inside your template file. That's one of the basic 
django template rules.
You can pass values from your views to your template and show them there.
Or generate the HTML in your view and show it from there, which isn't something 
I could advise if you're creating a larger application.



Op 1-sep-2010, om 14:53 heeft Pradnya het volgende geschreven:

> Hello,
> 
> Is it possible to fetch a particular record from model using
> school.object.get(id = 1) inside html template.
> 
> Please suggest.
> 
> Thanks
> Pradnya
> 
> -- 
> 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.
> 

Met vriendelijke groeten,

Jonas Geiregat
jo...@geiregat.org




-- 
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.



fetching values from model

2010-09-01 Thread Pradnya
Hello,

Is it possible to fetch a particular record from model using
school.object.get(id = 1) inside html template.

Please suggest.

Thanks
Pradnya

-- 
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.