Hello,
In one of my models I have a choices field:
class MyModel(models.Model):
units = models.CharField(maxlength=2, choices=UNITS)
When I try to create a new instance of this model in the admin, the initial
value in the select list for the units field is a dashed line. What I'd like
is to b
Hi
I came across localflavors and would like to use the UKPostcodeField
for post code validation. However when I try to import this I'm
getting ViewDoesNotExist errors.
Within my forms.py I'm importing like so:
from django.contrib.localflavor.uk.forms import UKPostcodeField
I'm then referencin
I am trying to build a simple single page quiz model, with multiple
questions with three classes for quiz,questions and answers, and fourth (not
included) to manage the scores as given below.
class Quiz(models.Model):
name = models.CharField(maxlength=200)
pub_date = models.DateTimeField()
question.choice.all is wrong :)
The default reverse relation name is FOO_set where FOO is the lower-
case name of your model.
So in your case, it would be question.choice_set.all
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Make template tags for your various apps, and use them on the index
page :)
--~--~-~--~~~---~--~~
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
It really depends on how complicated you want to make it.
However using generic views would easily suffice, just set up a
dictionary of the objects you need to pass in. Something like:
django.views.generic.simple.direct_to_template would do the job.
On Aug 21, 9:12 am, Rufman <[EMAIL PROTECTED]
You're importing UKPostcodeField - so why are you trying to use
models.UKPostcodeField ? :)
--~--~-~--~~~---~--~~
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@goo
Sorry that was a typo on my part Colin
Should have read:
forms.UKPostcodeField()
Think its time for a coffee!
On Aug 21, 9:19 am, Collin Grady <[EMAIL PROTECTED]> wrote:
> You're importing UKPostcodeField - so why are you trying to use
> models.UKPostcodeField ? :)
--~--~-~--~~-
That probably isn't what you want, though it will work (technically
speaking)
The way you're doing it, that's going to chain the filters with AND,
not OR, so only things that match the title and description for all
words will show up.
You probably want to build a Q object with | for an OR lookup
hi
does anyone have a good idea how i could make an index page that
combines different apps. e.g. the results of a poll is shown as well
as a news feed next to it.
thanks
stephane rufer
--~--~-~--~~~---~--~~
You received this message because you are subscribed
The same question applies though :)
You didn't import the "forms" bit, you imported the field directly, so
you should just be using it as UKPostcodeField :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django u
On Mon, 2007-08-20 at 17:27 +, arthur debert wrote:
> Hi Rob.
>
> After the unicode branch merge django expects and produces unicodes
> objects throughout.
>
> A detail how to port guide is here:
> http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist
>
> In
On Mon, 2007-08-20 at 22:04 +, Djon wrote:
> Hi
>
> My model is:
>
> class Tag(models.Model):
> name = models.CharField(maxlength=30)
>
> class Snippet(models.Model):
> name = models.CharField(maxlength=30)
> tags =
> models.ManyToManyField(Tag,filter_interface=models.HORIZONTAL
thanks...worked like a charm
On Aug 21, 10:18 am, MikeHowarth <[EMAIL PROTECTED]> wrote:
> It really depends on how complicated you want to make it.
>
> However using generic views would easily suffice, just set up a
> dictionary of the objects you need to pass in. Something like:
> django.views.
thanks...worked like a charm
On Aug 21, 10:18 am, MikeHowarth <[EMAIL PROTECTED]> wrote:
> It really depends on how complicated you want to make it.
>
> However using generic views would easily suffice, just set up a
> dictionary of the objects you need to pass in. Something like:
> django.views.
So really I'd be better off using:
from django.contrib.localflavor.uk import forms
On Aug 21, 9:35 am, Collin Grady <[EMAIL PROTECTED]> wrote:
> The same question applies though :)
>
> You didn't import the "forms" bit, you imported the field directly, so
> you should just be using it as UKPostc
Hello,
Has anyone gotten the file upload progress bar from ticket #4165 to
work in safari? It works great in IE and FF, but so far no luck on
safari. For some reason the xmlhttp requests get stuck on readyState 1
when a file upload is in progress. When I run them without a file
upload, the readyS
do you by any chance know how the django admin page gets the help_text
from the model...e.i. how can i get the help_text without having to
define it again in my custom form?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
do you by any chance know how the django admin page gets the help_text
from the model...e.i. how can i get the help_text without having to
define it again in my custom form?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Yes sorry, In this example I didn't realize about that, but in my code
I have Q objects.
I wrote it very quick.
On 21 ago, 10:27, Collin Grady <[EMAIL PROTECTED]> wrote:
> That probably isn't what you want, though it will work (technically
> speaking)
>
> The way you're doing it, that's going to
On Tue, 2007-08-21 at 00:09 +0200, Tomas Kopecek wrote:
> Hello,
> I've been playing with these functions and finally I've become totally
> confused.
>
> I've expected that there would be some difference in behaviour, but I
> was not able to create such use case in which these two functions
>
Thanks,
Actually I was referring to the django admin tables as mentioned . I
didn't define those models!
None of these issues are a huge problem - but I'm a perfectionist ;)
Ben,
On Aug 17, 2:36 pm, Michal Ludvig <[EMAIL PROTECTED]> wrote:
> b3n wrote:
> > Thanks,
>
> > OK, but if a field va
On Tue, 2007-08-21 at 02:20 -0700, MikeHowarth wrote:
> So really I'd be better off using:
>
> from django.contrib.localflavor.uk import forms
If, in the same file, you also do "import newforms as forms", things are
going to go pear-shaped pretty quickly, so be careful.
My gut reaction, if I'm
Thats a very valid point Malcolm and something I'll implement!
On Aug 21, 12:22 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-08-21 at 02:20 -0700, MikeHowarth wrote:
> > So really I'd be better off using:
>
> > from django.contrib.localflavor.uk import forms
>
> If, in the sam
Hello Carl Karsten!
On Mon, 20 Aug 2007 14:07:39 -0500 you wrote:
> > settings.py:MEDIA_ROOT = BASE_DIR+'/media/'
> > settings.py:MEDIA_URL = '/site_media/'
> > urls.py:(r'^site_media/(?P.*)$',
> > 'django.views.static.serve', {'document_root':
> > settings.BASE_DIR+'/media/', 'show_indexes':
> dscn0001___.jpg
> dscn0001.jpg
> dscn0001_.jpg
>
> I could override the save() method to save the files under /
> , but that would make the get_FOO_url and others fail.
No it won't. As long as your ImageField ends up pointing to the
correct relative path of your renamed imag
On Aug 19, 10:40 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone worked on a quiz/ multiple choice contest design using Django
> using Newforms?
Yes.
http://popteen.com/feature/view/style/looks/what-s-your-sunbathing-style-/
--~--~-~--~~~---~--~
We're using Django and SimpleXMLRPCDispatcher to publish some web service
calls. The last missing piece is that I'm trying to put an authentication
layer in front of the services and I'm not sure the best way to go about
it.
Right now I'm using Apache's mod_auth and AuthType Basic with an htp
> So the question is, if anybody is aware of an in-line comment system
> we could use or build upon, otherwise I guess I'll try and do
> something myself.
A good starting point:
http://www.jackslocum.com/blog/2006/10/09/my-wordpress-comments-system-built-with-yahoo-ui-and-yahooext/
--~--~
I'm starting django and doing the tutorial.
Whet trying the admin pages, the foreign-key poll in the class choises
shows not the reference but:
-,
poll object
poll object
why doesn't this works?
--~--~-~--~~~---~--~~
You received this message because you
I want all of my "views" (HTML pages) to use a common header, footer
etc.
What is the python/django way of achieving this?
I need to know because if I have to change the header/footer, then I
only want to have to do it one place, rather than editing every
template file.
I can't get my head arou
On 21-Aug-07, at 8:20 PM, b3n wrote:
> What is the python/django way of achieving this?
template inheritance
--
regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribe
On Tue, 21 Aug 2007 20:27:20 +0530, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
>
> On 21-Aug-07, at 8:20 PM, b3n wrote:
>
>> What is the python/django way of achieving this?
>
> template inheritance
>
Read this page. Read it all the way through.
http://www.djangoproject.com/documentat
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
Grigory Fateyev wrote:
> Hello Carl Karsten!
> On Mon, 20 Aug 2007 14:07:39 -0500 you wrote:
>
>>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/'
>>> settings.py:MEDIA_URL = '/site_media/'
>>> urls.py:(r'^site_media/(?P.*)$',
>>> 'django.views.static.serve', {'document_root':
>>> settings.BASE_D
> I want all of my "views" (HTML pages) to use a common header, footer
> etc.
>
> What is the python/django way of achieving this?
http://www.djangoproject.com/documentation/templates/#template-inheritance
It's somewhat backwards from how other template-languages work
that I've used, but it ma
Check to make sure you're defining the __str__(self) on your poll
object. That indicates that the object does not know how to turn
itself into a string. (note that with trunk the best practice way to
do this will be __unicode__ but with any of the static releases the
new unicode method will not wo
For prosperities sake I will finish out what was causing the issue.
RajeshD pointed out that the media url was being mapped directly to
lighty. Which it was. So I moved all static media to a dir called
'static' and removed the line in the lighty vhost that maps media to
lighty.
Now it all works
Actually I need another clue...
I'm getting very confused about how to structure my Python projects/
apps.
In settings.py:
TEMPLATE_DIRS = (
"C:/Python/my_templates",
)
In my template dir:
mylinks/
mylinks/base_site.html
mylinks/bookmark_list.html (extends base_site)
Now in bookmark_list.
hi,list
I think there are many chinese django users,i think we can
exchange info here http://forum.devshare.org.
Make it the most popular django forum in china.Good luck all :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I've had 20 tabs open all day, all displaying django docs - but I
can't work this out.
A bookmark can have many categories, and a category can be in many
bookmarks. So I just want a simple table that consists of
category_id, bookmark_id
>From the docs I thought Django would create this automatic
Hello Carl Karsten!
On Tue, 21 Aug 2007 10:21:06 -0500 you wrote:
>
> Grigory Fateyev wrote:
> > Hello Carl Karsten!
> > On Mon, 20 Aug 2007 14:07:39 -0500 you wrote:
> >
> >>> settings.py:MEDIA_ROOT = BASE_DIR+'/media/'
> >>> settings.py:MEDIA_URL = '/site_media/'
> >>> urls.py:(r'^site_me
On Aug 20, 6:38 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Aug 20, 5:13 pm, Sasha Weberov <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Aug 20, 12:13 am, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Aug 20, 3:01 pm, Sasha Weberov <[EMAIL PROTECTED]> wrote:
>
> > > > Is it n
Don't know if you're only looking for a django solution, but if you
just need something that (AFAIK) works, this might do it:
http://www.futureofthebook.org/commentpress/
thin layer over Wordpress to allow comments similar to djangobook, but
in the sidebar instead of fancy little popup windows.
how can I know programatically if an operation in a model is an insert,
update or delete?
I just want to extend the admin log to log any action in my application
models. Right now,
admin app only log actions executed by itself.
--
Lic. José M. Rodriguez Bacallao
Cupet
Lic. José M. Rodriguez Bacallao wrote:
> how can I know programatically if an operation in a model is an insert,
> update or delete?
> I just want to extend the admin log to log any action in my application
> models. Right now,
> admin app only log actions executed by itself.
Part of your quest
Hi,
Have any of you guys imported excel/cvs by using Python/Django? I need
to import 1000 products for a shopping site and I'd like to learn the
fastest and easiest way to do so.
Is there any free/shareware programs you guys would recommend?
Thanks.
--~--~-~--~~~--
On Tuesday 21 August 2007, robo wrote:
> Have any of you guys imported excel/cvs by using Python/Django?
Check out "pydoc csv". Python ships with a nice CSV-reader module.
--
Kirk Strauser
signature.asc
Description: This is a digitally signed message part.
I am trying to use external CSS in template using built-in Django web
server but I'm experiencing some problems.
I've set URLConf as described at
http://www.djangoproject.com/documentation/0.96/static_files/,
but still nothing. It finds CSS file but styles won't apply.
When I try to use inline
Hi,
On Aug 21, 1:44 pm, arelenas <[EMAIL PROTECTED]> wrote:
> I've set URLConf as described
> athttp://www.djangoproject.com/documentation/0.96/static_files/,
> but still nothing. It finds CSS file but styles won't apply.
What does your URLConf look like? What is the URL you are using to
link
> Have any of you guys imported excel/cvs by using
> Python/Django? I need to import 1000 products for a shopping
> site and I'd like to learn the fastest and easiest way to do
> so.
I do this day in and day out :)
I prefer tab-delimited because it's easy and clean, though
Python's built-in "cs
Malcolm Tredinnick napsal(a):
> makes 's1' a Unicode object. It's value will be based on the locale when
> it is executed and then never change, no matter what the locale is. So
> anything that is executed at *import* time should not be using
> ugettext(). Since it's a cause of great confusion for
> Have any of you guys imported excel/cvs by using Python/Django? I need
> to import 1000 products for a shopping site and I'd like to learn the
> fastest and easiest way to do so.
If you need to load data straight from the Excel, you can use xlrd,
which works great.
http://www.lexicon.net/sjma
On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote:
> http://code.djangoproject.com/ticket/4879
> If you need that functionality, add a vote for it. :)
Yes, I need such functionality :)
Peter
--~--~-~--~~~---~--~~
You received this message because you are subs
how can I vote?
On 8/21/07, Peter Melvyn <[EMAIL PROTECTED]> wrote:
>
>
> On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote:
>
> > http://code.djangoproject.com/ticket/4879
> > If you need that functionality, add a vote for it. :)
>
> Yes, I need such functionality :)
>
> Peter
>
> >
>
--
Li
Lic. José M. Rodriguez Bacallao wrote:
> how can I vote?
There's no official voting mechanism for the non-Django developers
right now, it's mostly just based on putting a comment on the Trac
ticket or in the mailing list saying that you would use this
functionality for such and such a reason.
On 8/21/07, George Vilches <[EMAIL PROTECTED]> wrote:
> or in the mailing list saying that you would use this
> functionality for such and such a reason.
OK, I'll specify the reason
We use web as administrative/configuration tool for non-web based
back-office server and we need to synchronize i
Yes, I've done that. The following function read_excel_csv works with
Excel CSV files saved on Mac (I can't remember exactly, but it might
be that MS Office for Mac OS X saves CSV files using different
separators than on Windows). The function reads the rows line by line,
parses the cells of each
While I was writing reply to you Will, I've decided to try once more,
just to make sure that I didn't make some stupid mistake, and
surprisingly it worked!
Only difference is that I've tried it on another computer. Now I know
for sure that there is nothing wrong with Django or me. It's relief :)
On Aug 21, 8:37 pm, robo <[EMAIL PROTECTED]> wrote:
> Have any of you guys imported excel/cvs by using Python/Django? I need
> to import 1000 products for a shopping site and I'd like to learn the
> fastest and easiest way to do so.
I already did this, but in another way.
1. I write Models,
2.
The official mod_python mailing list details are at www.modpython.org.
You posted to the mod_python Google group which no one uses.
Also look through:
http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.html
and specifically the other pages it links to. You may need to work out
Rufman wrote:
> do you by any chance know how the django admin page gets the help_text
> from the model...e.i. how can i get the help_text without having to
> define it again in my custom form?
you can use something like:
>>> modelinstance._meta.get_field('myfield').help_text
where modelinstanc
hi amit,
Amit Ramon wrote:
> units = models.CharField(maxlength=2, choices=UNITS)
>
> When I try to create a new instance of this model in the admin, the initial
> value in the select list for the units field is a dashed line. What I'd like
> is to be able to define an initial value for this f
I was wondering if it was easy and if there are examples of using
django's ORM and even the authentication system in contrib outside of
django, say in a twisted network application?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
On 8/21/07, Lee Connell <[EMAIL PROTECTED]> wrote:
> I was wondering if it was easy and if there are examples of using
> django's ORM and even the authentication system in contrib outside of
> django, say in a twisted network application?
http://groups.google.com/group/django-users/search?group=d
I think do like below maybe more simple
from django.shortcuts import render_to_response
from django.template.context import RequestContext
def template_name(func):
def _template_name(request,template_name,*args,**keys):
result=func(request,*args,**keys)
if type(result)!=dict
Good! I am also a chineses, good work!
On 8月22日, 上午12时15分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> hi,list
> I think there are many chinese django users,i think we can
> exchange info herehttp://forum.devshare.org.
> Make it the most popular django forum in china.Good luck all :)
excellent! but almost us only read englist, pls translate you doc to
englist!
On 8月21日, 上午6时01分, MiloZ <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm just starting a workflow engine for django, based on Zope2
> openflow product.
>
> Home:http://django-goflow.blogspot.com/(in french)
> Dev trac:https://o
On Aug 21, 5:43 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> The official mod_python mailing list details are atwww.modpython.org.
> You posted to the mod_python Google group which no one uses.
>
> Also look through:
>
> http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.ht
On Tue, 2007-08-21 at 21:25 +0200, Tomas Kopecek wrote:
> Malcolm Tredinnick napsal(a):
> > makes 's1' a Unicode object. It's value will be based on the locale when
> > it is executed and then never change, no matter what the locale is. So
> > anything that is executed at *import* time should not
On Tue, 2007-08-21 at 16:33 -0400, George Vilches wrote:
> Lic. José M. Rodriguez Bacallao wrote:
> > how can I vote?
>
> There's no official voting mechanism for the non-Django developers
> right now, it's mostly just based on putting a comment on the Trac
> ticket
Please don't do this. It's
There isn't a solution to your particular problem. Your problem is
that you are accepting invalid data. Nobody can be born on a day that
doesn't exist. I'd recommend verifying that the data be entered into
the database is valid.
On Aug 3, 5:37 am, Bram - Smartelectronix <[EMAIL PROTECTED]>
wro
Err, my bad. I wasn't thinking. I need to stop writing replies after
having a few beers. ;)
On Aug 21, 9:09 pm, Brian Rosner <[EMAIL PROTECTED]> wrote:
> There isn't a solution to your particular problem. Your problem is
> that you are accepting invalid data. Nobody can be born on a day that
As far as insert or update, just overide the save method within the
class. It is something that must be done for each class, but what I
have done (for essentially the same purpose) is override save() on
each model I need to log the action for like so:
def save():
# if id exists, this record
r_f_d wrote:
> As far as insert or update, just overide the save method within the
> class. It is something that must be done for each class, but what I
> have done (for essentially the same purpose) is override save() on
> each model I need to log the action for like so:
>
> def save():
> #
Hello
Is it possible to have multiple one-to-one relationships for a single
class or is there a better way to do it.
What I have is an event which has about 12 fields. Optionally any
combination of a single weather record, a single event detail record,
a single survey record and one of four even
On Tue, 2007-08-21 at 21:21 -0700, Catriona wrote:
> Hello
>
> Is it possible to have multiple one-to-one relationships for a single
> class or is there a better way to do it.
Not at the moment, no. OneToOneFields assume they are going to be the
primary key, so you're restricted to a single one.
Thanks Jake.
It works like a charm. I thought I tried this before, so I obviously made some
mistake.
Thanks,
Amit
>
> hi amit,
>
> Amit Ramon wrote:
> > units = models.CharField(maxlength=2, choices=UNITS)
> >
> > When I try to create a new instance of this model in the admin, the
initial
Hi Malcolm
Thanks for the awesomely quick reply.
I'll give the foreign key option a go for now and maybe dive deep
later.
I'm assuming that I could check for say an existing event detail
record when I try and create a new one as well - probably cause less
user angst.
Thanks again
Catriona
On
On 8/22/07, b3n <[EMAIL PROTECTED]> wrote:
>
> I've had 20 tabs open all day, all displaying django docs - but I
> can't work this out.
>
> A bookmark can have many categories, and a category can be in many
> bookmarks. So I just want a simple table that consists of
> category_id, bookmark_id
>
>
80 matches
Mail list logo