Re: question about "\d" in url pattern

2012-02-27 Thread Justin Myers
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

Re: django.conf.urls.defaults.url documentation

2011-11-15 Thread Justin Myers
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

Re: how to replace "Congratulations on your first Django-powered page." with my home page

2010-09-16 Thread Justin Myers
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

Re: Integrating User Profile with Auth

2010-09-12 Thread Justin Myers
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;

Re: Django template : For Loop

2010-09-05 Thread Justin Myers
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,

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.

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

Re: Django GeoIP

2010-07-18 Thread Justin Myers
wrote: > Thanks 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 <masterb...@gmail.com> wrote: > > > Yes, there

Re: Django GeoIP

2010-07-17 Thread Justin Myers
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,

Re: How can view tweak response object to go to a specific *anchor* on the template?

2010-07-17 Thread Justin Myers
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 =

Re: Best way to get data into a HTML table?

2010-07-17 Thread Justin Myers
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

Re: IntegrityError

2010-07-10 Thread Justin Myers
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,

Re: Serving media files

2010-06-19 Thread Justin Myers
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/> >

Re: Django with Apache and mod_python

2010-06-06 Thread Justin Myers
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,

Re: Query Posts By Date

2010-05-30 Thread Justin Myers
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

Re: Hosting for Django sites

2010-04-04 Thread Justin Myers
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

Re: Photo + thumbnail

2010-01-04 Thread Justin Myers
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

Re: Feedback on Django1.1.1

2009-11-07 Thread Justin Myers
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,

Re: Slugify doesn't match pre-populated slug field.

2009-09-23 Thread Justin Myers
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

Re: redirecting after login

2009-08-01 Thread Justin Myers
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

Re: how to override ordering in date-based generic views

2009-06-12 Thread Justin Myers
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 <masterb...@gmail.com> wrote: > > > Have you tried this yet? > > > info_dict = { > >

Re: how to override ordering in date-based generic views

2009-06-09 Thread Justin Myers
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

Re: date-based ordering confusion

2009-02-14 Thread Justin Myers
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

Re: ObjectPaginator

2009-01-28 Thread Justin Myers
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

Re: Same form with dropdown on all pages

2009-01-04 Thread Justin Myers
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

Re: Tutorial Problem

2009-01-03 Thread Justin Myers
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

Re: A better way to filter queryset in generic view?

2008-12-29 Thread Justin Myers
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 =

Re: ViewDoesNotExist

2008-12-24 Thread Justin Myers
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

Re: Need Drop down menu code

2008-12-18 Thread Justin Myers
> 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

Re: Admin fields setting raises FieldDoesNotExist

2008-07-18 Thread Justin Myers
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

Admin fields setting raises FieldDoesNotExist

2008-07-18 Thread Justin Myers
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,

Re: Filtering generic view querysets with URLconf named groups

2008-07-17 Thread Justin Myers
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',

Re: Filtering generic view querysets with URLconf named groups

2008-07-17 Thread Justin Myers
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

Filtering generic view querysets with URLconf named groups

2008-07-16 Thread Justin Myers
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