Hi, not on my computet so will keep it short. Try to google "django
form trick" the top result should be a blog post by colin grady.
Basically what you need to do is to override the init method.
~Jakob
On May 21, 8:44 pm, Joakim Hove wrote:
> Hello,
>
> I have just started using Django - looks
This is probably more a python issue than a Django issue. Also
I don't really know what it is you want to do, but you should
consider if you really need to make all these lists? Also when
dealing with dates or datetimes python can do a lot of string
conversion for you. If you want to do it the way
Hi
It seems your problem with dlist_choice is caused by an incorrect
you of global vars. I've not used globals much myself, but I believe
that you don't import them, but instead in every function that needs
them do a global var_name.
the other traceback seems irrelevant, but the problem you that
This should fix it.
def __init__(self, something, *args, **kwargs):
super(ShippingMethodForm, self).__init__(*args, **kwargs)
self.fields["ship_method"].queryset =
ShippingMethod.objects.filter(something)
when you initiate the form, you do it like this:
form = ShippingMethodForm(
ake a look at that.
~Jakob
On 11 Maj, 09:17, newbie wrote:
> First of all, thanks for the reply :)
>
> On May 11, 11:59 am, google torp wrote:> So CustomUser
> and UserDetails is a model you made for your
> > users? If that is the case, you probably want to hook use a
&
So CustomUser and UserDetails is a model you made for your
users? If that is the case, you probably want to hook use a
modelform instead is it makes things a bit eaiser.
Anyways in your view, the user just pops out of the blue. My guess
is that you need to do something like user = CustomUser(...
Hi.
I haven't used Django with mysql, but judging from your error
it sounds like you haven't created the database in mysql. Django
probably cannot create a db like it can when you use sqlite, as it's
only a file anwyays. So you need to use your mysql tool
phpmyadmin or whatever you use and create
On Apr 21, 10:53 pm, Margie wrote:
> Can anyone advise me on what is the best way in the views.py code to
> return an HttpResponse that simply returns the user to the previous
> page they were on?
>
> For example, let's say that multiple different pages have a button
> that executes some code i
if you really wanted it like that, you could setup your url like this
(r'^search/q=(?P)', ...)
or you could just remove the q= for prettier urls and do:
(r'^search/(?P)', ...)
That will give you the variable "query" to your view, you have to
write it in your view function aswell.
read about urlc
You can do do something like this:
date = date.today()
while date.day != 20:
date += timedelta(1)
~Jakob
On 18 Apr., 21:57, Alfonso wrote:
> Hi,
>
> I'd like to set the default date of a datefield to be 'the 20th of the
> current month', if past that date the date should be set to the 20th
Hi.
Normally, what you are doing would work, initializing the form
with request.POST. However the way you have constructed
your form, you need have a poll object as well. Not only that
but it should of cause be the poll that the post data is associated
to.
Then you could do it like this
form = Pol
cases was a speciel naming convention for tests after reading the
docs.
~Jakob
On Apr 17, 10:29 pm, Alex Gaynor wrote:
> On Fri, Apr 17, 2009 at 4:26 PM, google torp wrote:
>
> > Hi.
> > You have named your test incorectly, so django won't see it as a test.
> >
= z.name
> return t
>
> Worked just fine.
>
> Thanks again :)
>
> Alan.
>
> On Apr 17, 3:21 am, google torp wrote:
>
> > Hi.
> > I think the problem is that get is being run before the exclude when
> > you still have two results and fail
Hi.
You have named your test incorectly, so django won't see it as a test.
You need to name testCamelCaseName. Camel cases are probably not
required but that's the convention. Try renaming your test.
~Jakob
On Apr 17, 9:04 pm, Daniel Joshua Worth
wrote:
> If I run "./manage.py tests booking" it
Hi.
I think the problem is that get is being run before the exclude when
you still have two results and fails as it can only handle a single
result.
In this case you can't use get but should use filter().exclude()[0] to
get
the result.
On Apr 16, 10:01 pm, zayatzz wrote:
> I need help with makin
This group is for Django related subjects only, please help us keep
the posts on subject. I would suggest you asked this question in a
Portable Ubuntu group instead.
~Jakob
On 15 Apr., 20:58, bconnors wrote:
> I have a Windows PC which I installed Portable Ubuntu -- which gives
> you linux on i
m
the query you would need an if statement in the randrange
version aswell.
~Jakob
On 15 Apr., 17:54, Baxter wrote:
> On Apr 15, 10:44 am, google torp wrote:> What I meant
> was that you could do it like this
>
> > import random
> > sa = Article.objects.filter(...).orde
so the first wont be
selected) and number of articles -1 so there wont be in problem
getting a number that is too high.
This is just pure python functionality btw.
~Jakob
On 15 Apr., 16:54, Baxter wrote:
> On Apr 15, 9:39 am, Baxter wrote:
>
> > On Apr 15, 9:33 am, google torp wrote:
Hi.
You can just use the python random function, I believe it's in math,
and generate a random number in range of the number of articles.
You could do that before the slice even, and just get a random
number with min value of 2 instead.
~Jakob
On 15 Apr., 16:23, "bax...@gretschpages.com"
wrote:
> > safe }}
> > {% endautoescape %}
>
> > Data goes from the db (by but some stuff) so there is not risk.
>
> > Thanks again.
>
> > Wishes,
>
> > M.
>
> > On Apr 15, 2:15 pm, google torp wrote:
>
> > > Hi
> > > The
Hi
There is a page for all the django template tags:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/
Your problem is the auto escape, you can use "|safe" to mark something
safe and it wont be escaped. Doing this for user submitted data is a
bad idea though, so make sure you don't mak
Hi.
As I'm not sure exactly what your goals with this site is, I'll be
guessing a
bit here. Using the admin to create customers ect, can be a solution,
but
having access to the admin also means having access to a whole bunch
of
stuff that you can mess with. You could instead make some views that
Hi.
You misunderstood the docs a bit, I c/p'ed the url-conf bit here:
(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
The problem here that is also causing the error is that the file name
should be
a variable and not hardcoded for every file,
Hi.
It sounds like you need to change your code structure a bit to really
take advantage of Django and the possibilities it offer. If you just
want
to get your stuff working with Django and then nothing more, I guess
you could keep it like it is, but else re factoring would be a good
idea.
The w
Hi.
I'm guessing a bit here, not sure if it actually will make any
difference, but
try to delete the $ in the include so it'll become:
(r'^', include('p2.front.urls')),
$ marks the end of the url, so maybe that is giving you the problem.
~Jakob
On 9 Apr., 11:55, zayatzz wrote:
> I think it has
25 matches
Mail list logo