Re: Trouble writing a view for a model

2010-07-12 Thread Rodion Raskolnikiv
Rupert, Without knowing what you are aiming to accomplish, my advice might not be pertinent. However, it looks like your models could be rearranged like this: class Question(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class

Re: way to detecting visitiors zip code

2010-07-12 Thread Rodion Raskolnikiv
There are various tools to map a visitor's IP to their zip code: http://www.google.com/search?hl=en&q=ip+to+zip That would be where I would start with such a project... On Jul 12, 7:53 am, haibin wrote: > hi all, > > Is there a way to get the visitor's location represented as zip code > (not only

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
Soo easy... Thanks for the tips! I knew that there had to be a simple solution!! On Jul 8, 2:02 pm, Daniel Roseman wrote: > On Jul 8, 6:28 pm, Rodion Raskolnikiv wrote: > > > > > > > Good morning! > > I have been wanting to design a model (to be administered via t

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
to do. On Jul 8, 11:25 am, Rodion Raskolnikiv wrote: > To be more specific, here is what I have tried: > > # in models.py > from django import forms > > class UploadFileForm(forms.Form): >     title = forms.CharField(max_length=50) >     file  = forms.FileField() > > #

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
gives me the error message: TypeError at /admin/ 'DeclarativeFieldsMetaclass' object is not iterable Am I heading in the wrong direction? On Jul 8, 10:28 am, Rodion Raskolnikiv wrote: > Good morning! > I have been wanting to design a model (to be administered via the > admi

Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
Good morning! I have been wanting to design a model (to be administered via the admin area) which would allow for file uploads. I have not been able to grasp a singular, simple approach to this. Perhaps things are complicated by Django's preference for serving media files under a different domain,

Re: Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
it_page'), > > Then in your view: > > def unit_page(request, unit_id, page_slug): >   the_page = Page.objects.get(slug=PageSlug) > > Do the same for the Unit model and regex matching.  Adjust as > necessary to fit your actual models. > > On Jul 7, 2:13 pm,

Re: Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
x27;m not quite clear on what you're asking, but if the issue is how to write > a regex for slugs: The regular expression you need for slugs is *[\w\d\-]+* > > Hope that helps. > > Daniel > ------- > Daniel Lathrop > > On Wed, Jul 7, 2010 at 9:32 A

Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
Greetings! I am trying to implement a very simple (yet elegant) solution for a university departmental website in django. In designing my urls, I desired to have them follow this pattern: university.edu/department/page_title_made_into_slug However, I couldn't get it working or find any doc tha