On Feb 27, 1:44 am, Masklinn wrote:
> On 27 févr. 2012, at 07:23, Zheng Li wrote:
> > i thought "\d+" in url promises i can get an int point in cheer_confirm,
> > and am i wrong?
>
> \d+ ensures you will only get naturals, but django will not perform any
> conversion automatically. Especially n
Docs are here: https://docs.djangoproject.com/en/1.3/topics/http/urls/#url
-Justin
On Nov 14, 11:59 pm, Mike Thon wrote:
> I recently started working on a new Django project using the latest
> release, and I found the function django.conf.urls.defaults.url being used
> in urls.py. There's no pyd
It already tells you why it's showing that page. You need to add some
entries to urls.py, at the very least. The tutorial Sithembewena
linked you to is a good start.
-Justin
On Sep 16, 12:25 am, perfecthills wrote:
> Have a website build on django, i desire to transfer the website to a
> new doma
Another idea would be to connect to User's post-save signal. You can
set it up to check whether the User instance being saved is just being
created, and if so, you can create its UserProfile instance at the
same time. That'd make it so all future users have profiles as soon as
they're created; once
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
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
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 tem
s All,
>
> Its now clear to me. For sharing purpose, maybe I'll go for pygeoip?
> Since I really only need the GeoIP only. Much simpler, though could be
> much slower?
>
> On Jul 18, 12:20 am, Justin Myers wrote:
>
> > Yes, there are dependencies for Geo
Yes, there are dependencies for GeoIP. They're listed in the docs for
GeoIP (http://docs.djangoproject.com/en/1.2/ref/contrib/gis/geoip/),
and the docs' list of GeoDjango's requirements in general (http://
docs.djangoproject.com/en/1.2/ref/contrib/gis/install/#requirements)
is also useful.
HTH,
Ju
When is that code running? If it's in the head element and not
checking whether the document's finished yet, it might be executing
before the anchor you're targeting is ready. Consider either using
this, for something using jQuery:
$(document).ready(function() {
window.location = window.locati
Each model has a meta attribute with a list of fields on it; for a
Photo model, for example, you can use Photo._meta.fields.
This means you could do something (at least in the shell) like:
>>> fields = Photo._meta.fields
>>> photo = Photo.objects.latest()
>>> for field in fields:
... print '%
As another idea, can you just update your SITE_ID setting (http://
docs.djangoproject.com/en/1.2/ref/settings/#site-id)? It defaults to 1
(for the example.com instance), but if you've got a new Site object
for your actual domain, you should just be able to use its id instead.
-Justin
On Jul 10, 7:
Have you set your MEDIA_ROOT, MEDIA_URL and ADMIN_MEDIA_PREFIX
settings in settings.py?
On Jun 19, 12:06 pm, Jagdeep Singh Malhi
wrote:
> now my httpd.conf file is :-
>
> Alias /media/ /usr/local/lib/python2.6/dist-packages/django/contrib/
> admin/media/
>
> media/>
> Order deny,allow
> Allow
It says you're missing a 500.html template.
Without it, you can't see any error pages. See
http://docs.djangoproject.com/en/dev/topics/http/views/#the-500-server-error-view
Once you've made that template, you should be able to see what other
errors are happening.
-Justin
On Jun 6, 12:16 am, Jagd
If you're passing a "year" and "month" variable, I would use
Post.objects.filter(publish_date__year=year,
publish_date__month=month).
-Justin
On May 30, 12:34 am, greg wrote:
> Hello,
>
> I'm (almost) done coding up my blog in Django.
>
> Right now I'm working to implement a search by date functi
I'm a fan of Webfaction's shared plans, and I've used them for three
or four projects now. I've had no problems with their support, and
they even did a pretty good job keeping everyone informed when they
were affected by that big explosion at The Planet's datacenter a
couple of years ago (http://te
I'm not able to test this idea directly myself at the moment, but it
appears you're storing an absolute path (i.e., starting from the
filesystem root) in self.thumb. I'm pretty sure FileFields (and, by
extension, ImageFields) store relative paths from settings.MEDIA_ROOT.
(To make sure I'm thinkin
1.1.1 remedies a security issue in 1.1 (http://www.djangoproject.com/
weblog/2009/oct/09/security/), so while technically the two versions
are different, there's no reason to run any 1.1 release other than
1.1.1.
As for whether 1.0 (which was patched at the same time to 1.0.4) or
1.1 is better, 1
Two ideas:
1. Instead of having the slug prepopulated, override save() [1] and
run slugify yourself.
2. Instead of running slugify on the name, why not just access its
slugfield directly?
HTH,
Justin
[1]
http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods
The included login view (django.contrib.auth.views.login) takes an
optional "next" argument for this:
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login
Hope that helps.
-Justin
On Jul 31, 9:15 am, When ideas fail wrote:
> I was wondering if there was a way to red
s.
Fair enough. Hope that one's working out for you. Sorry this one
didn't work out.
> Thanks again,
> Joe
>
> On Tue, Jun 9, 2009 at 12:52 PM, Justin Myers wrote:
>
> > Have you tried this yet?
>
> > info_dict = {
> > 'q
Have you tried this yet?
info_dict = {
'queryset': Entry.objects.order_by(-featured),
'date_field': 'pub_date'
}
urlpatterns = patterns('django.views.generic.date_based',
...
(r'^$', 'archive_index', info_dict),
)
I haven't checked whether or not it works, but it seems like it'd do
t
On Feb 14, 12:55 am, Gour wrote:
> Finally, I managed to add 'class Meta' as subclass of BlogPost class (as
> above), but I wonder if adding 'ordering = ('-timestamp',)' to
> BlogPostAdmin class is supposed to work or what is explanation if it
> should not work (as we experienced)?
ordering is a
Pagination changed quite a bit in 1.0. There's a chance you'll have to
change more than simply get_page(). An easier-to-read list of the
Paginator and Page methods and attributes is here:
http://docs.djangoproject.com/en/dev/topics/pagination/#paginator-objects
(I ran into the same problem trying
It sounds like you're after a custom template tag:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/
On Jan 4, 2:31 pm, Ashish wrote:
> I want to have a common html form with only a dropdown and a submit
> button on all pages.
> It will placed in one corner and user can select say
It failed after it imported your settings file the first time, so I
don't think the problem's there; it also got the folder name right, so
it looks like it's just failing to recognize it as a Python package.
Any chance you got rid of __init__.py (empty file in the mysite
folder) by mistake?
On Ja
Assuming you know you'll always be filtering Entry objects (probably
true, given the view's name) and using the same template, here's what
I'd do:
===urls.py===
urlpatterns = patterns('',
url(r'^entries/$', view_entry_list),
)
===views.py===
def view_entry_list(request):
queryset = Ent
Well, it's saying it can't find a file named seoappsla/views.py. Does
that file exist?
Based on the example code within the URLconf, I'd guess you might want
to try seoapp_sla.views.index and seoapp_sla.views.detail instead--but
without knowing what files you have in what directories, it's hard t
> How do I write the drop down menu on the index page to then
> retrieve the value from the drop down menu.
Django itself won't generate the dropdowns for you--that's a template
issue. What you'd want to do is generate the markup (i.e., a list
within tags or something similar) with Django and
I use a couple of filters, which I think I first found in the code for
generic views:
from datetime import date, time, datetime
Class.objects.filter(date__gte=datetime.combine(date(int(year),int(month),int(day)),time.min)).filter(date__lte=datetime.combine(date(int(year),int(month),int(day)),time
Ah, worked perfectly. Thanks so much!
-Justin
On Jul 18, 8:52 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Python gothca: you've neglected to put a comma after 'slug' in 'fields':
> ('slug'). Single-element tuples need to have a comma after their one
> element to force them to be tuples. In
Hello again! Still working on the blogging app I mentioned a couple of
days ago for my student newspaper. It's working on our production
server right now (so some of the other editors can check it out and
make suggestions), though I'll naturally be making some tweaks here
and there.
Right now, th
Worked like a charm. In case anyone's wondering:
def blog_index(request, blog_slug):
qs = Entry.objects.filter(blog__slug__exact=blog_slug)
blog_name = Blog.objects.get(slug=blog_slug).title
extra = {'blog_name': blog_name}
return archive_index(request, qs, 'date', extra_context=e
Ah, that makes sense. I'll give that a shot. Thanks again!
-Justin
On Jul 17, 12:49 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> You are making the assumption that the queryset will be recreated anew
> each time and that this will only happen after the blog_slug value has
> been determined
Hey there. I'm starting a term as web development editor at my student
newspaper in the fall, and we recently (February) launched a new site
created in Django. My background's definitely more in design than in
development per se, so I'm trying to get up to speed with Django by
putting together a b
35 matches
Mail list logo