Static file problem using the development server

2011-08-09 Thread Rodney Topor
I tried using a style sheet served as a static file with the tutorial project. In settings.py, I defined STATIC_URL = /static/ and STATICFILES_DIRS = ('/path/to/project/static/',). Then I defined a base_html template with a line in the HEAD of the form and put style.css in directory /static/

Re: How can I use {{variable}} in custom templatetag?

2011-08-09 Thread Josh
{% get_related_entries weblog.entry 5 from object.categories as related_entries %} {% for entry in related_entries %} {{ entry.title }} {% endfor %} class RelatedEntryNode(template.Node): def __init__(self, model, number, categories, varname): self.model = mode

Re: Static file problem using the development server

2011-08-09 Thread Daniel Roseman
On Tuesday, 9 August 2011 08:24:20 UTC+1, Rodney Topor wrote: > > I tried using a style sheet served as a static file with the tutorial > project. In settings.py, I defined STATIC_URL = /static/ and > STATICFILES_DIRS = ('/path/to/project/static/',). Then I defined a > base_html template with

Re: how to get request object out of views

2011-08-09 Thread Daniel Roseman
On Tuesday, 9 August 2011 02:33:47 UTC+1, oops wrote: > > Hi, > > May be you miss understanted my meaning. > > I just want to get the current user object in a normal .py file out of > views. > > And this file just offer some data according to different user. > > Do you have any methods to get the

Re: Static file problem using the development server

2011-08-09 Thread Rodney Topor
Great. Thank you. I missed one, and this somehow affected others. (Must try to understand what RequestContext really does one day.) RT -- 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@googlegro

Re: Static file problem using the development server

2011-08-09 Thread Daniel Roseman
On Tuesday, 9 August 2011 09:48:22 UTC+1, Rodney Topor wrote: > > Great. Thank you. I missed one, and this somehow affected others. > (Must try to understand what RequestContext really does one day.) > > RT It just runs the context processors, which add various things to the context - includ

Re: how to get request object out of views

2011-08-09 Thread Kejun He
hi, Ok, It is a good method to get the current user. I am sorry for that. But i just do maintain a django project, and i do not want to change the template structure. And now, I have found a new method to resolve the problem. through a variable CURRENT_USER defined in settings.py to save the cur

Passing data between the view and the form

2011-08-09 Thread vanderkerkoff
Hello there I've got an event model, which has an association with multiple workshops models.py class Event(models.Model): workshops = models.ManyToManyField(Workshop, related_name='evt_workshop', limit_choices_to = {'lang_code__in': ('B', 'E')}, blank=True, null=True) I've got a form that I the

Re: how to get request object out of views

2011-08-09 Thread bruno desthuilliers
On Aug 9, 11:22 am, Kejun He wrote: > hi, > Ok, It is a good method to get the current user. It's actually THE good method. > > But i just do maintain a django project, and i do not want to change the > template structure. > > And now, I have found a new method to resolve the problem. > > throug

Re: how to get request object out of views

2011-08-09 Thread Tom Evans
On Tue, Aug 9, 2011 at 10:22 AM, Kejun He wrote: > hi, > Ok, It is a good method to get the current user. I am sorry for that. > > But i just do maintain a django project, and i do not want to change the > template structure. > > And now, I have found a new method to resolve the problem. > > throu

Re: how to get request object out of views

2011-08-09 Thread Kejun He
On Tue, Aug 9, 2011 at 5:54 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On Aug 9, 11:22 am, Kejun He wrote: > > hi, > > Ok, It is a good method to get the current user. > > It's actually THE good method. > > > > > But i just do maintain a django project, and i do not want to

Re: how to get request object out of views

2011-08-09 Thread Kejun He
hi, I will do as your method thanks for your reply regards, kejun On Tue, Aug 9, 2011 at 5:56 PM, Tom Evans wrote: > On Tue, Aug 9, 2011 at 10:22 AM, Kejun He wrote: > > hi, > > Ok, It is a good method to get the current user. I am sorry for that. > > > > But i just do maintain a django proje

Re: Using Form Elements Widgets direclty in HTML

2011-08-09 Thread Jian Chang
Since you don't want to use forms class, you can write elements in your templates directly. 2011/8/9 Hayyan Rafiq > Hi I wanted to know if there was a way in which we could use widget > directly in an HTML file > By widget i mean elements of a form such as input boxes,calendars,Buttons > etc wi

Re: how to get request object out of views

2011-08-09 Thread bruno desthuilliers
On Aug 9, 12:13 pm, Kejun He wrote: > On Tue, Aug 9, 2011 at 5:54 PM, bruno desthuilliers < > > > > DONT import settings that way. ALWAYS use "from django.conf import > > settings" > > I test in my development server, and found that > > from django.conf import settings   is to all client > > but >

Trying to simplify the last post

2011-08-09 Thread vanderkerkoff
Hello there I'm trying to make this as easy as possible, but it's pretty complicated. Here's my form class EventBookForm(ModelForm): """A form for governors to email to govwales with details of which events they wish to attend""" title = CharField() firstname = CharField(

Re: Tutorial Part 2, django 1.3, installed via bitnami

2011-08-09 Thread eggxtreme
That did help, thanks a lot :) On 9 Sie, 03:21, Mike Dewhirst wrote: > On 9/08/2011 9:49am, eggxtreme wrote: > > > Hi, i've had some strange errors when trying to install django > > standalone, so i have used the whole bundle option, linked from > > documentation. Bitnami. It installed python, dj

Re: Trying to simplify the last post

2011-08-09 Thread Daniel Roseman
On Tuesday, 9 August 2011 12:09:08 UTC+1, vanderkerkoff wrote: > > Hello there > > I'm trying to make this as easy as possible, but it's pretty > complicated. > > Here's my form > > > > As you can see I've hard coded the id of the event into this section > > data = Workshop.objects.filter(

Time duration in django models

2011-08-09 Thread Mohamed Ghoneim
Hey guys, I am just wondering if there is a time duration field in django models. what I want to do is a field that takes a time duration in days, hours, mins, seconds and store it into the database. -- Mohamed Sayed Ghoneim -- You received this message because you are subscribed to the Google

Re: Time duration in django models

2011-08-09 Thread Scott Gould
Nothing native. I'd store it in seconds, as an int, and let the model convert to and from a timedelta. Looks like there's a snippet all ready to go: http://djangosnippets.org/snippets/1060/ On Aug 9, 6:32 am, Mohamed Ghoneim wrote: > Hey guys, > > I am just wondering if there is a time duration

Re: Need help writing join Django query for this simple model..

2011-08-09 Thread Karen Tracey
On Mon, Aug 8, 2011 at 11:49 PM, Hayyan Rafiq wrote: > so i tried this now > > > class Student_Info(models.Model): > Roll_No = models.IntegerField(primary_key=True) > Cell_No = models.IntegerField() > > E_mail = models.EmailField(max_length=30) > > class Academics(models.Model): > * #Roll

Tutorial: New class based generic views

2011-08-09 Thread Juan Pablo Romero Méndez
Hey guys, This is the first part of a series of blog posts I'm writing about class based generic views: http://pseudocorta.blogspot.com/2011/08/django-generic-views.html Cheers! Juan Pablo -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: problem with django admin

2011-08-09 Thread damola oyeniyi
Hi all, Anybody know a good documentation or book that can help me with integrating google maps with my app? -- 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 fro

RE: Using Form Elements Widgets direclty in HTML

2011-08-09 Thread Hayyan Rafiq
Could you please give an example.. say of a simple input box in html its done like How would i replace the default input box with the one from Django widgets?? Date: Tue, 9 Aug 2011 18:34:56 +0800 Subject: Re: Using Form Elements Widgets direclty in HTML From: changjia...@gmail.com To: django-

Re: Admin model listing custom ordering

2011-08-09 Thread Vinicius Massuchetto
Thanks, Christian. After trying your attempts, I solved the problem by creating an additional "order" field in the ForeignKey. So in the referenced model I had to do: class Meta: ordering = ['fkfield__order'] That's not so elegant as I wished it to be, but it's not that ugly too, IMO. Vinic

RE: Need help writing join Django query for this simple model..

2011-08-09 Thread Hayyan Rafiq
Thanks for the suggestions.. okay suppose i change my models to something like this class Student_Info(models.Model): Roll_No = models.IntegerField(primary_key=True) Cell_No = models.IntegerField() E_mail = models.EmailField(max_length=30) class Academics(models.Model): #Roll_No = mo

Re: Google AppEngine vs. dedicated hosting (Pros/cons)

2011-08-09 Thread Fatrix
Hi, If I wouldn't have a dedicated server, I would choose a hosting service, where I can deploy the (mostly) exact project as I do on my own server. This for the reason of portability and because of avoiding the learning curve.. You could have a look at [1]. These days there are lots of provider

Re: Passing tuple values to a model choices field

2011-08-09 Thread Kayode Odeyemi
The label_from_instance should simply return the obj. I don't think any fuzzy codes is needed as described in the Django docs [1] The method label_from_instance already converts the objects to string. So a simple override like this: class MyModelChoiceField(ModelChoiceField): def label_from_i

'str' object has no attribute 'resolve' when access admin site

2011-08-09 Thread raj
I keep getting this error: 'str' object has no attribute 'resolve' when trying to accessing the django admin site and I can't figure out why. I have apps within my project that have their own admin.py files. Could this cause it? here is my urls.py: from django.conf.urls.defaults import * import

same form model with separate admins and data

2011-08-09 Thread brian
I've created a form with Model->ModelForm flow. Django is running on a sub-domain and I'm putting separate instances of the form on multiple php websites via iframe. How can I use the same form model but have independent forms? For example I want: form1 to be at: example.com/form1

Re: same form model with separate admins and data

2011-08-09 Thread Michal Petrucha
On Tue, Aug 09, 2011 at 08:53:07AM -0700, brian wrote: > I've created a form with Model->ModelForm flow. Django is running on > a sub-domain and I'm putting separate instances of the form on > multiple php websites via iframe. > > How can I use the same form model but have independent forms? > >

RE: Need help writing join Django query for this simple model..

2011-08-09 Thread Hayyan Rafiq
okay so i got it working (Thanks to you guys) but i do have a question.. First my dbmodel is class Student_Info(models.Model): roll_no = models.IntegerField(primary_key=True) cell_no = models.IntegerField() e_mail = models.EmailField(max_length=30) class Academics(models.Model): roll =

Re: Need help writing join Django query for this simple model..

2011-08-09 Thread Shawn Milochik
This is where using the related_name kwarg comes in. You can also use the default value, which in this case is academics_set. I see you made most of the recommended changes to your model definitions. I'd just like to reiterate two: Remove the underscore in your model name. Remove the 's

dull look after install on ubuntu

2011-08-09 Thread Peter Kovgan
django 1.3 on python 2.7.1 ubuntu 11.04 looking through firefox 4 Dull look, like all javascript has been removed On windows looks nice, but here all works, but no colors, no styles, nothing... What could it be? Thanks. -- You received this message because you are subscribed to the Google Grou

Re: dull look after install on ubuntu

2011-08-09 Thread Shawn Milochik
Please read: https://code.djangoproject.com/wiki/UsingTheMailingList Especially this section: Prepare the question -- 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 unsubscrib

How to concatenate two variables in a template for evaluation..

2011-08-09 Thread Hayyan Rafiq
hi I have been playing around with a certain scenario Consider the following {% for title in field %} {{obj}}{{.title}} {% endfor %} Here obj is an object and title are the various fields of that object. How can i evaluate the entire thing in a template Example I want it to end

Re: Tutorial: New class based generic views

2011-08-09 Thread Gelonida N
On 08/09/2011 03:33 PM, Juan Pablo Romero Méndez wrote: > Hey guys, > > This is the first part of a series of blog posts I'm writing about > class based generic views: > > http://pseudocorta.blogspot.com/2011/08/django-generic-views.html > > Cheers! > > Juan Pablo > Hi Juan, This blog looks

Re: How to concatenate two variables in a template for evaluation..

2011-08-09 Thread Shawn Milochik
You have to write it as {{ obj.title }} in your template. Django templates are designed to allow very little in the way of logic; that should take place in your views. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send e

Re: dull look after install on ubuntu

2011-08-09 Thread Gelonida N
On 08/09/2011 09:58 PM, Peter Kovgan wrote: > django 1.3 > on python 2.7.1 > ubuntu 11.04 > looking through firefox 4 > > Dull look, like all javascript has been removed > On windows looks nice, but here all works, but no colors, no styles, > nothing... > > What could it be? Well you don't real

RE: How to concatenate two variables in a template for evaluation..

2011-08-09 Thread Hayyan Rafiq
Okay then which way do u recommend that i should follow in case i need to displays objects with different no of properties Example obj has propA and PropB {{obj.propA}} {{obj.propB}} would work but i want it to be dynamic since the no and name of properties may vary.. I tried writing all the prop

Re: Tutorial: New class based generic views

2011-08-09 Thread Juan Pablo Romero Méndez
Thanks for the feedback Gelonida! 2011/8/9 Gelonida N : > On 08/09/2011 03:33 PM, Juan Pablo Romero Méndez wrote: >> Hey guys, >> >> This is the first part of a series of blog posts I'm writing about >> class based generic views: >> >> http://pseudocorta.blogspot.com/2011/08/django-generic-views.h

How to order "links" in the Admin?

2011-08-09 Thread Andre Lopes
Hi, I'm testing Django for my first project using it. I have a model like this: from django.db import models import datetime class Directory(models.Model): website_name = models.CharField(max_length=200) website_url = models.CharField(max_length=200) website_position = models.IntegerFi

Re: How to concatenate two variables in a template for evaluation..

2011-08-09 Thread bruno desthuilliers
On 9 août, 23:37, Hayyan Rafiq wrote: > Okay then which way do u recommend that i should follow in case > i need to displays objects with different no of properties > Example obj has propA and PropB > {{obj.propA}} > {{obj.propB}} > would work but i want it to be dynamic since the no and name of p

Newbie: Help with validation

2011-08-09 Thread damola oyeniyi
Hi all, I have a model snippet that I wanna use to store phonenumbers: e_mail = models.EmailField()     phone = models.CharField(max_length=15) Mobile numbers in my country are 11digit numbers e.g 080, Fixed Lines: (2 digit),7 digit e.g (01)755 I wanna try and validate this field on

Re: How to order "links" in the Admin?

2011-08-09 Thread Jian Chang
you should figure out what it is based on to order these urls. i use time stamp to order them. 2011/8/10 Andre Lopes > Hi, > > I'm testing Django for my first project using it. > > I have a model like this: > > from django.db import models > import datetime > > class Directory(models.Model):

Re: dull look after install on ubuntu

2011-08-09 Thread Peter Kovgan
Thank you guys. I use development server of django(manage.py runserver). I created an app. from the official site of the django, this one of the first tutorial. I did it on windows installation. Then I came home, installed the same app on ubuntu. Now my conf is: > django 1.3 > on python 2.7.1

How to prevent model formset from saving the empty forms?

2011-08-09 Thread Joshua Russo
I have a model formset that's displaying an extra form, but when I save I always get that form saved as an empty entry. How do I tell it not to save the model forms that I don't edit? It doesn't happen this way in the admin, does it? -- You received this message because you are subscribed to t

Re: 'str' object has no attribute 'resolve' when access admin site

2011-08-09 Thread raj
*bump* really need an answer for this. On Aug 9, 11:41 am, raj wrote: > I keep getting this error: > 'str' object has no attribute 'resolve' > > when trying to accessing the django admin site and I can't figure out > why. > I have apps within my project that have their own admin.py files. > Could

Re: How to prevent model formset from saving the empty forms?

2011-08-09 Thread Joshua Russo
Ok, I figured out why, but I still don't know how to fix it. I set a dropdown to empty_label = None, which automatically selects the first element. I want that, but the form then thinks it has changed because the value in the list of initial values is empty for that field, and I can't see how

Re: 'str' object has no attribute 'resolve' when access admin site

2011-08-09 Thread Kejun He
Hi, I have never met the same problem. And it would be better if you paste the traceback On Wed, Aug 10, 2011 at 11:56 AM, raj wrote: > *bump* really need an answer for this. > > On Aug 9, 11:41 am, raj wrote: > > I keep getting this error: > > 'str' object has no attribute 'resolve' > > > >

Re: How to prevent model formset from saving the empty forms?

2011-08-09 Thread Joshua Russo
Nm, I got it -- 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/-/lYt3r0vdv4cJ. To post to this group, send email to django-users@googlegroups.com. To unsubscrib

Re: How to prevent model formset from saving the empty forms?

2011-08-09 Thread Joshua Russo
I just needed to retrieve the first pk value from the field's queryset in the init of the form and set the initial value there. -- 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/

Re: Using Form Elements Widgets direclty in HTML

2011-08-09 Thread francescortiz
You can have a look to the as_p method of django Form class and create your own renderer based on that. On Aug 9, 4:09 pm, Hayyan Rafiq wrote: > Could you please give an example.. say of a simple input box > in html its done like > > > How would i replace the default input box with the one from

Re: Is there a way to use a tree control in my template

2011-08-09 Thread francescortiz
What part are you missing? How to write the django template, how to access the data or the what is the related HTML? On Aug 8, 9:43 pm, Hayyan Rafiq wrote: > Hi i wanted to know is there a way through which i could use a tree control > in my template > I wanted to add something like > >    Stude

Re: how to save inlines?

2011-08-09 Thread francescortiz
The django documentation about ModelAdmin.save_model seems to be what you look for. The example they give does almost what you want: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model On Aug 8, 11:32 pm, galgal wrote: > I need to override save met

Re: dull look after install on ubuntu

2011-08-09 Thread Praveen Krishna R
*please dump your *settings.py ?! On Wed, Aug 10, 2011 at 5:53 AM, Peter Kovgan wrote: > Thank you guys. > > I use development server of django(manage.py runserver). > > I created an app. from the official site of the django, this one of the > first tutorial. > > I did it on windows installation.