Re: Admin : Select category -> show subcategory
Thank you, it's just what I wanted, but do I have to write a new template (admin/model_name/etc...) ? Or can I define this directly in my model (onchange actions...) ? I have the django Book (definitive guide to django) but I can't find this. On 4 mai, 02:26, Diego Ucha <[EMAIL PROTECTED]> wrote: > HelloMartyn, > > The main interaction, that i see you need is: > (On Product form) User select Category -> Subcategory field is auto- > filled -> User select a subcategory based on the category selected. > > Then you will have to use some JS Library (I prefer JQuery, besides > there are some discussion about those libs on the list). > > For filling this subcategory field, in terms of data transmission, i > use JSon, because JQuery has a fine JSon parser, in few lines it's all > done. > > []s, > Diego Ucha > > On May 2, 6:05 am,martyn<[EMAIL PROTECTED]> wrote: > > > Hi, > > > I've created a simple product model : > > > class Produit(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > description = models.TextField(blank=True) > > published = models.BooleanField(default=True) > > prix_ht = models.DecimalField(max_digits=30, decimal_places=2) > > famille = models.ForeignKey('Famille') > > sous_categorie = models.ForeignKey('SousCategorie') > > clic > > > class Admin: > > pass > > > I've got also Category and SubCategory : > > > class Categorie(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > class Admin: > > pass > > > def __str__(self): > > return self.nom > > > class SousCategorie(models.Model): > > nom = models.CharField(maxlength=200) > > slug = models.SlugField(prepopulate_from=('nom',)) > > categorie = models.ForeignKey('Categorie') > > class Admin: > > pass > > > def __str__(self): > > return self.nom > > > Is there a way in django admin, in the Product form, to select the > > category, then the subcategories of this category only are shown in > > the select list. > > > Thanks a lot --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Change render of RadioSelect
Hello, I'm trying to manipulate the rendering for RadioSelect so that the form element shows up within my form differently than a . So far I've come across two options... Use straight form tags in my view, or to rework RadioFieldRenderer and RadioInput from widgets.py locally so that I can have a custom renderer. And then use that custom renderer as the renderer for RadioSelect I was wondering if there was a way to bipass these options and just get at the independant radio buttons that make up the RadioSelect. Meaning to be able to get all the 2-tuple key-value pairs that makeup the RadioSelect widget. Thanks, Mike. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
@@@@@ONLINE INCOME OPPORTUNITY@@@@@
HAI FRIENDS!!! http://www.freedompeoples.blogspot.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Using alternate pluralize suffix when you don't know the word
I display a list of types with a number for each type. {% for type in types %} {{ type.count }} {{ type.type }}{{ type.count|pluralize }} {% endfor %} I can't use the alternate pluralize suffix because I don't know the actual word to be pluralized. Will I have to test each word and apply the pluralize suffix verbosely? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Template tags spanning multiple lines
Thank you very very much - DOTALL worked. I should be happy, and I am very happy, but just one more little thing Is there an elegant way to somehow subclass something, or override something , or sprinkle some magic dust somewhere to get the code in my directory, so that svn refreshes of django can be left alone? --Greg On May 4, 10:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > You *might* be able to make it work by adding the re.DOT_ALL flag to > this > re:http://code.djangoproject.com/browser/django/trunk/django/template/__... > I haven't tested it, I don't know if it works, I don't even know if it > makes sense. > > On May 4, 10:51 pm, gregf <[EMAIL PROTECTED]> wrote: > > > Thanks for the reply. > > > I'm working on a system that, for lack of a better term, is "pull > > based', where the designer can mix content however he/she sees fit. > > In this type of a system, the developer does not assume what will be > > on a page. The designer can decide to, on a single page, pull out a > > list of entries one month old, another list of popular entries, a > > list of products matching a certain criteria, a list of upcoming > > events from the events module, a list of recent polls from the poll > > module, etc, and put all that on the same page. > > > This puts a lot of power in the hands of the designer, but I don't > > think it qualifies as logic. The designer is just saying explicitly > > what content he wants, just as if it was placed in the context. This > > kind of system is not appropriate for all applications, but for web > > publishing it makes sense, and encourages better decoupling of coding > > with page design. But for certain tags to be useful, and because only > > a few variables are supplied in context, some of the tags need to have > > more parameters than would be necessary in a system where everything > > was provided by context. > > > The popularity of the Expression Engine product is, to a large > > degree, due to the flexibility this type of system affords the > > designer. Users love it and rave about because of the flexibility and > > comprehensiveness of the module tags. There are no assumptions about > > what needs to be on a page. The template designer does not have to ask > > a developer to add to the context each time something new needs to be > > put on a page. > > > I think you probably have to have worked with this type of tag- > > centric, pull-based templating system, where the designer has a large > > number of tags available from different modules, to fully appreciate > > its flexibility. > > > At any rate, I think Django is a marvelous system, and look forward to > > continuing development with it. I will have to work around this > > limitation, or have designers use long single line tags. > > > Respectfully, > > --Greg > > > On May 4, 10:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> > > wrote: > > > > On Mon, May 5, 2008 at 9:38 AM, gregf <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I would like to be able to have custom template tags span across > > > > multiple lines. The following example shows why this would be > > > > desirable for tags with lots of options: > > > ... > > > > I've googled and searched the forum, but nothing turns up. Does anyone > > > > know if there's any way to do this? > > > > In short - No. > > > > Keeping tags short was an intentional design decision, specifically to > > > prevent the sort of thing you are doing with that tag. Using options > > > like "days=30, limit=15, categories='4,5,6,9' " looks disturbingly > > > like you're putting logic into the template, which is something the > > > Django template language goes to great lengths to prevent. That sort > > > of element selection should be in your view, and your template tag > > > should just be the rendering of everything that was selected in your > > > view. Options will be necessary, but not as many as you need in your > > > example. > > > > Yours, > > > Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangoAMF: django and flash
Hi If you are using a 64bit arch, there is a bug with a write function. You can find the reported bug and a patch here: http://sourceforge.jp/tracker/?atid=9591&group_id=2585&func=browse Kind Regards, Sebastian.- On 3 mayo, 08:30, Lorenzo <[EMAIL PROTECTED]> wrote: > Hi, > I need to link a flash movie with Django, so I userddjangoAMF. > I followed the tutorial > (http://djangoamf.sourceforge.jp/index.php?UserManual_en) and seems to > work fine, but when I put the results inside a textbox in my flash > application, it understand data as a float number! > > In django I use a simple helloworld function: > - > def HelloWorld(req): > return "HelloWorld" > -- > In flash I followed the so the handleResult function is: > - > function handleResult(re:ResultEvent):Void { > this.message_txt.text = re.result;} > > - > > The result is that in message_txt I find a strange number like > "4.432432e-123" that seems somehow related to the string (if I change > string the number change! otherwise it remain the same). > > Someone has experience with this kind of problem? > > Thanks, > > Lorenzo --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Template tags spanning multiple lines
You *might* be able to make it work by adding the re.DOT_ALL flag to this re: http://code.djangoproject.com/browser/django/trunk/django/template/__init__.py#L90 I haven't tested it, I don't know if it works, I don't even know if it makes sense. On May 4, 10:51 pm, gregf <[EMAIL PROTECTED]> wrote: > Thanks for the reply. > > I'm working on a system that, for lack of a better term, is "pull > based', where the designer can mix content however he/she sees fit. > In this type of a system, the developer does not assume what will be > on a page. The designer can decide to, on a single page, pull out a > list of entries one month old, another list of popular entries, a > list of products matching a certain criteria, a list of upcoming > events from the events module, a list of recent polls from the poll > module, etc, and put all that on the same page. > > This puts a lot of power in the hands of the designer, but I don't > think it qualifies as logic. The designer is just saying explicitly > what content he wants, just as if it was placed in the context. This > kind of system is not appropriate for all applications, but for web > publishing it makes sense, and encourages better decoupling of coding > with page design. But for certain tags to be useful, and because only > a few variables are supplied in context, some of the tags need to have > more parameters than would be necessary in a system where everything > was provided by context. > > The popularity of the Expression Engine product is, to a large > degree, due to the flexibility this type of system affords the > designer. Users love it and rave about because of the flexibility and > comprehensiveness of the module tags. There are no assumptions about > what needs to be on a page. The template designer does not have to ask > a developer to add to the context each time something new needs to be > put on a page. > > I think you probably have to have worked with this type of tag- > centric, pull-based templating system, where the designer has a large > number of tags available from different modules, to fully appreciate > its flexibility. > > At any rate, I think Django is a marvelous system, and look forward to > continuing development with it. I will have to work around this > limitation, or have designers use long single line tags. > > Respectfully, > --Greg > > On May 4, 10:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > > On Mon, May 5, 2008 at 9:38 AM, gregf <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I would like to be able to have custom template tags span across > > > multiple lines. The following example shows why this would be > > > desirable for tags with lots of options: > > ... > > > I've googled and searched the forum, but nothing turns up. Does anyone > > > know if there's any way to do this? > > > In short - No. > > > Keeping tags short was an intentional design decision, specifically to > > prevent the sort of thing you are doing with that tag. Using options > > like "days=30, limit=15, categories='4,5,6,9' " looks disturbingly > > like you're putting logic into the template, which is something the > > Django template language goes to great lengths to prevent. That sort > > of element selection should be in your view, and your template tag > > should just be the rendering of everything that was selected in your > > view. Options will be necessary, but not as many as you need in your > > example. > > > Yours, > > Russ Magee %-) > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Template tags spanning multiple lines
Thanks for the reply. I'm working on a system that, for lack of a better term, is "pull based', where the designer can mix content however he/she sees fit. In this type of a system, the developer does not assume what will be on a page. The designer can decide to, on a single page, pull out a list of entries one month old, another list of popular entries, a list of products matching a certain criteria, a list of upcoming events from the events module, a list of recent polls from the poll module, etc, and put all that on the same page. This puts a lot of power in the hands of the designer, but I don't think it qualifies as logic. The designer is just saying explicitly what content he wants, just as if it was placed in the context. This kind of system is not appropriate for all applications, but for web publishing it makes sense, and encourages better decoupling of coding with page design. But for certain tags to be useful, and because only a few variables are supplied in context, some of the tags need to have more parameters than would be necessary in a system where everything was provided by context. The popularity of the Expression Engine product is, to a large degree, due to the flexibility this type of system affords the designer. Users love it and rave about because of the flexibility and comprehensiveness of the module tags. There are no assumptions about what needs to be on a page. The template designer does not have to ask a developer to add to the context each time something new needs to be put on a page. I think you probably have to have worked with this type of tag- centric, pull-based templating system, where the designer has a large number of tags available from different modules, to fully appreciate its flexibility. At any rate, I think Django is a marvelous system, and look forward to continuing development with it. I will have to work around this limitation, or have designers use long single line tags. Respectfully, --Greg On May 4, 10:02 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Mon, May 5, 2008 at 9:38 AM, gregf <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I would like to be able to have custom template tags span across > > multiple lines. The following example shows why this would be > > desirable for tags with lots of options: > ... > > I've googled and searched the forum, but nothing turns up. Does anyone > > know if there's any way to do this? > > In short - No. > > Keeping tags short was an intentional design decision, specifically to > prevent the sort of thing you are doing with that tag. Using options > like "days=30, limit=15, categories='4,5,6,9' " looks disturbingly > like you're putting logic into the template, which is something the > Django template language goes to great lengths to prevent. That sort > of element selection should be in your view, and your template tag > should just be the rendering of everything that was selected in your > view. Options will be necessary, but not as many as you need in your > example. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Need some slightly advanced routing help
On Sun, May 4, 2008 at 9:21 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote: > > Hi Chris > > or, if you want it more specific: > > (r'^(?P\w+)/(?P\d{4}-\d{2}-\d{2})/$', 'myview'), > > > Personally I'd go with the last example in this case. > That one worked perfectly. I had a brain cramp about the dashes in the date format. Thanks! -- Chris Hartjes --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Get first_name from User Model in to my Model
Maybe are wanting to populate that field automatically and you are looking for a custom save() method? This would do the trick: ... def save(self): self.first_name = self.user.first_name super(Student, self).save() You will also want to add blank=True or editable=False to the CharField arguments, probably the latter, since if you are doing this the the prepopulation from the user.first_name field is going to override anything that is input in a form anyway... On May 4, 6:18 pm, chiefmoamba <[EMAIL PROTECTED]> wrote: > Hi, > > I am having a problem getting data from the user model in to my model > (below). I can get the usernames easy enough using "user = > models.ForeignKey(User)", but how then do I get the first_name & > last_name in to my model from the user model? > > Any ideas appreciated, > > Thanks, > > Ed > > class Student(models.Model): > user = models.ForeignKey(User) > first_name = models.CharField(maxlength=40) > age = models.IntegerField() > location = models.CharField(maxlength=40) > > def __str__(self): > return self.first_name > > class Admin: > list_display = ('user', 'age', 'location',) > list_filter = ('user', 'location',) > ordering = ('-user',) > search_fields = ('user',) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Template tags spanning multiple lines
On Mon, May 5, 2008 at 9:38 AM, gregf <[EMAIL PROTECTED]> wrote: > > Hi, > > I would like to be able to have custom template tags span across > multiple lines. The following example shows why this would be > desirable for tags with lots of options: ... > I've googled and searched the forum, but nothing turns up. Does anyone > know if there's any way to do this? In short - No. Keeping tags short was an intentional design decision, specifically to prevent the sort of thing you are doing with that tag. Using options like "days=30, limit=15, categories='4,5,6,9' " looks disturbingly like you're putting logic into the template, which is something the Django template language goes to great lengths to prevent. That sort of element selection should be in your view, and your template tag should just be the rendering of everything that was selected in your view. Options will be necessary, but not as many as you need in your example. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Default Pluralize logic
On Mon, May 5, 2008 at 1:16 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Is it? Maybe. I don't know if anyone has proposed smartening-up Django's > > pluralization rules in the past > > I had a look through the mailing-list archive and couldn't spot > anything directly related. Then you haven't looked too hard. Pluralization comes up regularly, both in the context of the pluralize filter, and the verbose_name/verbose_name_plural option. And if you're calling pluralization a simple task, you _really_ haven't done your research. The short version is that pluralization is _hard_. Automatic pluralization, which seems to be what you want, is an effectively impossible task, especially in English. English doesn't have regular rules for pluralization for anything but trivial cases. About the only way to do it effectively is to have a dictionary of all possible plurals - and then you hit the religious wars over whether the plural of octopus is octopus, octopuses, or octopodes. Even if you could get English sorted out, then you get the i18n problem. A few eastern European languages have some very interesting pluralization rules which further complicates the dream of an automatic solution. So, we have settled with the a naive solution, manually assisted, with template helpers that cover 95% of cases. "Add an s" works for a good majority of cases - if that isn't correct, you can manually correct it in verbose_name_plural. The template filter can handle all the english cases (worst case being different extensions for 1 and many). This doesn't cover the needs of the previously mentioned eastern European languages, but accommodating those languages while keeping the simple case simple is almost impossible, so users of those languages can write a custom template tag if they need one. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ifnotequal strange behavior--
I am creating an event calendar, and would like to display the date of the event. Some events take place on only one day, while some take place over multiple days. I would like only one date to display for single day events, and for multiday events, I would like to display both the start date of the event and the end date. I have tried using the following statement in my template: Date:{{Event.start_DateTime|date:"l N j" }}{%ifnotequal Event.start_DateTime|date Event.end_DateTime|date %} - {{Event.end_DateTime|date:"l N j" }}{% endifnotequal %} where start_DateTime and end_DateTime are both DateTimeFields. Now, when I test it, I get some strange behavior. With "ifnotequal" and the |date filter, --both the multiday and singleday events only display one day. with "ifequal" and the |date filter --both multiday and singleday events display two days (start and end) with ifnotequal and no date filter --both multiday and single day events display two days with ifequal and no date filter --both multiday and singleday events display one day questions: why is there uniformity? Why do both act in concert? What effect does the |date filter have? (I originally used it because i figured that the two DateTime objects wouldn't have the same Time, and so would evaluate to not being equal) Is there any way to get this working the way I envision it? Thanks for your time and patience. ryan vanasse --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: urls() and request.user
On May 4, 5:42 am, "Guillaume Lederrey" <[EMAIL PROTECTED]> wrote: > I havent done any functional programming in a long time , but ... isnt > there a way to use an anonymous function (if that's what it is called) > and do the wrapper "inline" ? Something like : Yeah, something like that would work, although tying it into your example above would look pretty ugly, I'm guessing:: (r'^test/$', lambda request: HttpResponse('Hello, %s' % request.user)), If you're only trying to get the currently logged in user into the template context, it's already there as ``{{ user }}`` if you're using generic views [1]. Sorry I didn't mention that in my first reply. .. [1] http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-auth --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Template tags spanning multiple lines
Hi, I would like to be able to have custom template tags span across multiple lines. The following example shows why this would be desirable for tags with lots of options: {% get_entries as entries days_old ="30" limit="15" categories="4,5,9,5" author='djones' get_comments='false' show_drafts='false' section='23' %} If I put all this on one line, I'm able to parse it in the custom tag handler, but it is not recognized as a tag if I try to spread it across multiple lines. I've googled and searched the forum, but nothing turns up. Does anyone know if there's any way to do this? Thanks, Greg --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Need some slightly advanced routing help
\w don't match '-', so use [\w-]+ instead. but this regx is not accurate. have a look at this http://code.djangoproject.com/browser/djangoproject.com/django_website/apps/blog/urls.py On 5/5/08, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > I've been trying to do something that I *think* should be simple, > but apparently is not. Or, the more likely answer is that I am missing > something pretty obvious. I spent some time googling around for the answer > but didn't find what I was looking for. So here goes. > > I'm building a web service to return sports game information. I have > three routes: > > > / -- shows a help page on how to use the web service > // > /// > > > is the name of a team in lowercase, could be 'yankees' or > 'red+sox' > the date fields are formatted as -MM-DD. Now, I've looked at both the > Django book and the online Django documentation to try and figure out the > correct way to get the routes to work. Here's what's in my urls.py file: > > > from django.conf.urls.defaults import * > > > urlpatterns = patterns('', > (r'^(?P\w+)/(?P\w+)/$', > 'rallyhat.ws.views.team_by_date'), > (r'^(?P\w+)/(?P\w+)/(?P\w+)/$', > 'rallyhat.ws.views.team_by_date_range'), > (r'^/?$', 'rallyhat.ws.views.index'), > ) > > > Now, my index page route works just fine, but the two others won't work. > > > When I try /yankees/2008-08-15 I get this: > > > * > > Using the URLconf defined in rallyhat.urls, Django tried these URL > patterns, in this order: > > >1. ^(?P\w+)/(?P\w+)/$ > >2. ^(?P\w+)/(?P\w+)/(?P\w+)/$ > >3. ^/?$ > > > The current URL, /yankees/2008-05-18/, didn't match any of these. > * > > > I *know* it's something dumb, but I just can't see it. Any help would be > greatly appreciated. > > > -- > Chris Hartjes > > > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Need some slightly advanced routing help
Chris Hartjes wrote on 05/05/08 02:53: > I've been trying to do something that I *think* should be simple, > but apparently is not. Or, the more likely answer is that I am missing > something pretty obvious. I spent some time googling around for the answer > but didn't find what I was looking for. So here goes. > I'm building a web service to return sports game information. I have three > routes: > > / -- shows a help page on how to use the web service > // > /// > > is the name of a team in lowercase, could be 'yankees' or > 'red+sox' > the date fields are formatted as -MM-DD. Now, I've looked at both the > Django book and the online Django documentation to try and figure out the > correct way to get the routes to work. Here's what's in my urls.py file: > > from django.conf.urls.defaults import * > > urlpatterns = patterns('', > (r'^(?P\w+)/(?P\w+)/$', 'rallyhat.ws.views.team_by_date'), > (r'^(?P\w+)/(?P\w+)/(?P\w+)/$', > 'rallyhat.ws.views.team_by_date_range'), > (r'^/?$', 'rallyhat.ws.views.index'), > ) > > Now, my index page route works just fine, but the two others won't work. > > When I try /yankees/2008-08-15 I get this: > > * > > Using the URLconf defined in rallyhat.urls, Django tried these URL patterns, > in this order: > > >1. ^(?P\w+)/(?P\w+)/$ > >2. ^(?P\w+)/(?P\w+)/(?P\w+)/$ > >3. ^/?$ > > > The current URL, /yankees/2008-05-18/, didn't match any of these. > * > > I *know* it's something dumb, but I just can't see it. Any help would be > greatly appreciated. > Hi Chris \w matches [a-zA-Z0-9_] [1] The dashes there are not understood as dashes per se, but rather specify a range. I'd use either: (r'^(?P\w+)/(?P[^/]+)/$', 'myview'), or: (r'^(?P\w+)/(?P[\w-]+)/$', 'myview'), or, if you want it more specific: (r'^(?P\w+)/(?P\d{4}-\d{2}-\d{2})/$', 'myview'), Personally I'd go with the last example in this case. [1] http://docs.python.org/lib/re-syntax.html --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Default Pluralize logic
I think you are assuming too much here. The verbose name and verbose name plurals are default pulled from a class name that might not necessarily make sense to my editors in the admin. I need to have some control to how it is actually displayed to the end user; no program is going to be able to make my life easier by referencing a translation block to make my class names read better. Also you assume some standard in which class names are being written. It is my experience that people name classes by whatever makes sense at that moment and starfards are frequently developer/project based. Michael Newman On May 4, 2008, at 1:16 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >> Is it? Maybe. I don't know if anyone has proposed smartening-up >> Django's >> pluralization rules in the past > > I had a look through the mailing-list archive and couldn't spot > anything directly related. > >> (I'm not even sure if you are proposing it >> here?). > > I pretty much am proposing it here. I wanted to confirm my > understanding of how the pluralize logic currently works in Django. > >> My gut feeling is it's probably something that has lots of >> exceptions/special cases that would make it hard to get entirely >> right, >> particularly for all languages, but maybe I'm unduly pessimistic. >> > > Example of some exceptions/special cases are irregular plural nouns. > However, as default pluralize function, I believe we can handle a lot > more cases compared to the current functionality. > Also, by looking at having language specific rules files (maybe > linking this into the internationalization logic), we can quite easily > train the pluralize function to handle more exceptions/special cases > too without needing to modify the source code (decoupling the rules > from the source code, pluralize function). > > The code to enhance the pluralize function is pretty straightforward. > I have already implemented this functionality in my own code base that > I would be happy to share. (I can create a patch/diff if there would > be interest.) > > > Regards, > -Alen > > On May 3, 9:52 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: >> On Sat, May 3, 2008 at 5:39 AM, [EMAIL PROTECTED] >> <[EMAIL PROTECTED]> >> wrote: >> >>> Could someone please be kind to explain to me how the pluralize >>> logic >>> works in django? >>> a.) pluralize template filter >> >> Doc for this is >> here:http://www.djangoproject.com/documentation/templates/#pluralize >> >>> b.) Meta.verbose_name_plural >> >> Doc for this is >> here:http://www.djangoproject.com/documentation/model-api/#verbose-name-pl >> ... >> >>> As default, I am expecting the pluralize to convert "country" to >>> "countries". For exapmle, this doesn't happen in admin so I define >>> the >>> verbose_name_plural in the Meta inner class. >> >> Per the doc, the default pluralize (filter) behavior is to simply >> add an s. >> If that is not correct for the word in question, then you have to >> tell the >> filter what the correct suffix is. The doc also has an example of >> how to >> specify that pluralize should change a -y to an -ies. >> >> For the model's verbose plural name, again the doc states the default >> behavior is to add an s. If that isn't correct, then you need to >> specify >> verbose_name_plural, as you have. >> >>> Its straightforward to implement a function that can seemlessly >>> handle >>> this correctly as default, even if it was to read the pluralization >>> rules from a rules. files or something equivalent. >> >> Is it? Maybe. I don't know if anyone has proposed smartening-up >> Django's >> pluralization rules in the past (I'm not even sure if you are >> proposing it >> here?). My gut feeling is it's probably something that has lots of >> exceptions/special cases that would make it hard to get entirely >> right, >> particularly for all languages, but maybe I'm unduly pessimistic. >> >> Karen > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Need some slightly advanced routing help
I've been trying to do something that I *think* should be simple, but apparently is not. Or, the more likely answer is that I am missing something pretty obvious. I spent some time googling around for the answer but didn't find what I was looking for. So here goes. I'm building a web service to return sports game information. I have three routes: / -- shows a help page on how to use the web service // /// is the name of a team in lowercase, could be 'yankees' or 'red+sox' the date fields are formatted as -MM-DD. Now, I've looked at both the Django book and the online Django documentation to try and figure out the correct way to get the routes to work. Here's what's in my urls.py file: from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^(?P\w+)/(?P\w+)/$', 'rallyhat.ws.views.team_by_date'), (r'^(?P\w+)/(?P\w+)/(?P\w+)/$', 'rallyhat.ws.views.team_by_date_range'), (r'^/?$', 'rallyhat.ws.views.index'), ) Now, my index page route works just fine, but the two others won't work. When I try /yankees/2008-08-15 I get this: * Using the URLconf defined in rallyhat.urls, Django tried these URL patterns, in this order: 1. ^(?P\w+)/(?P\w+)/$ 2. ^(?P\w+)/(?P\w+)/(?P\w+)/$ 3. ^/?$ The current URL, /yankees/2008-05-18/, didn't match any of these. * I *know* it's something dumb, but I just can't see it. Any help would be greatly appreciated. -- Chris Hartjes --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django-contact-form, Akismet and UnicodeEncodeError
Hi folks. I'm having this annoying problem that I don't have the skill to solve. I'm using James Bennetts django-contact-form (r46 from svn) and I'm subclassing the AkismetContactForm class that's included. I have the latest revision of akismet.py too. My django version is trunk, r6626, which is post-unicode-branch-merge. I discovered that typing any form of non-ascii character into a form field gives me a UnicodeEncodeError, I've pasted the traceback I get at http://dpaste.com/48248/. What gives? I figure that if django-contact-form's AkismetContactForm class or akismet.py can't handle unicode properly (which would be surprising) or if this was a common problem, I'd be able to find some search results on it, or find something in some issue tracker somewhere, but I've got nothing. Any help would be greatly appreciated. //emil --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Get first_name from User Model in to my Model
user.firstname user.lastname ?? Is that what you are looking for? mike chiefmoamba wrote: > Hi, > > I am having a problem getting data from the user model in to my model > (below). I can get the usernames easy enough using "user = > models.ForeignKey(User)", but how then do I get the first_name & > last_name in to my model from the user model? > > Any ideas appreciated, > > Thanks, > > Ed > > > class Student(models.Model): > user = models.ForeignKey(User) > first_name = models.CharField(maxlength=40) > age = models.IntegerField() > location = models.CharField(maxlength=40) > > def __str__(self): > return self.first_name > > class Admin: > list_display = ('user', 'age', 'location',) > list_filter = ('user', 'location',) > ordering = ('-user',) > search_fields = ('user',) > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Sorry to butt in. I'm just trying to get my message out.
Google has to do something about these spam issues! Or we should band together to write a mailing list App in Django that filters out spam! On Sat, May 3, 2008 at 8:20 AM, Etienne Robillard < [EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Fri, 2 May 2008 11:49:19 -0700 (PDT) > Slayer <[EMAIL PROTECTED]> wrote: > > > > > Please come check out SaveTheWorld. It's my own group that I'm trying > > to get started. > > There's no harm in looking is there? Come see what I'm trying to do > > to change the world. > > Come to look, to laugh, to get enraged in debate, but please come. > > Actually, you're right. > Changing the world needs more than just open source projects. > > But please don't spam this list with stupidities. > > Thanks, > Etienne > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.9 (FreeBSD) > > iEYEARECAAYFAkgcgr4ACgkQ0H/Gee/mchQgkgCfRjLTwsI91hqiBWV5GzUDyydE > VBsAoJlOIGe5ydCuTNr/cFeKcZAfrV6Z > =agab > -END PGP SIGNATURE- > > > > -- http://search.goldwatches.com/?Search=Movado+Watches http://www.jewelerslounge.com http://www.goldwatches.com --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Get first_name from User Model in to my Model
Hi, I am having a problem getting data from the user model in to my model (below). I can get the usernames easy enough using "user = models.ForeignKey(User)", but how then do I get the first_name & last_name in to my model from the user model? Any ideas appreciated, Thanks, Ed class Student(models.Model): user = models.ForeignKey(User) first_name = models.CharField(maxlength=40) age = models.IntegerField() location = models.CharField(maxlength=40) def __str__(self): return self.first_name class Admin: list_display = ('user', 'age', 'location',) list_filter = ('user', 'location',) ordering = ('-user',) search_fields = ('user',) --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Getting error when using ModelForm
On Sun, May 4, 2008 at 2:47 PM, Greg <[EMAIL PROTECTED]> wrote: > > Hello, > I'm trying to use ModelForm to create a form based on one of my > models. However, I'm getting the following error: > > /// > AttributeError at /plush/theone/ > 'ModelFormOptions' object has no attribute 'many_to_many' > /// > For the future, it would be more helpful if you included the full traceback, not just the last bit, when asking about errors like this. Below is my code: > > /// > Views.py File > > def theone(request): >a = TestForm() >if request.POST: >b = TestForm(data=request.POST, instance=a) The instance parameter to a ModelForm is supposed to be an instance of the model. You are passing an instance of the ModelForm. >if b.is_valid(): >b.save() >else: >assert False, "Errors" >else: >form = TestForm(instance=a) >return render_to_response('plush_mytest.htm', {'theform': form}) > /// > > /// > Models.py File > > class MyTest(models.Model): >myfirst = models.CharField(max_length=100) > /// > > /// > myform.py file > > class TestForm(ModelForm): > >class Meta: >model = MyTest > /// > > /// > plush_mytest.htm File > > > {{ theform.myfield }} > > > /// > > > The error occurs when I get to the following line in my views.py file > 'form = TestForm(instance=a)'. > > Anybody have any suggestions? Your code needs to make a an instance of the model, if you want to edit an existing model instance. If you don't need to edit an existing model instance, than you don't need to use the instance model parameter at all. Karen --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Suggestions on building a "Grouped" RadioSelect
I thought I'd mention that my temporary brute force solution is to simulate the Form rendering behaviour. I pass filtered querysets containing tapeFormats and dataFormats (Tape and Data being the two Mediums) form the view into the render_to_response. I then just use {% for %} loops to iterate over both and manually render the tags exactly how the RadioSelect does; same naming convention, same IDs, etc. But this seems really messy compared to working with form fields directly, and it also requires that I do a lot of index tracking using {% with %} blocks. A Widget approach would be much cleaner, but it would have to have access to the field's queryset to determine if its a Tape or Data medium at render time. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
OneToOne relations generates many UNIQUE indexes on MySQL
Creating the following very simple model : class Interactable(models.Model): pass class News(Interactable): title = models.CharField(max_length = 50) excerpt = models.CharField(max_length = 100) text = models.TextField() And then synchronizing the database reveals that 2 unique indexes and 1 primary key refers to interactable_ptr_id in the news table : - PRIMARY - interactable_ptr_id (unique) - files_news_interactable_ptr_id (unique) The SQL transaction looks like this : BEGIN; CREATE TABLE `files_news` ( `interactable_ptr_id` integer NOT NULL UNIQUE PRIMARY KEY, `title` varchar(50) NOT NULL, `excerpt` varchar(100) NOT NULL, `text` longtext NOT NULL ) ; CREATE TABLE `files_interactable` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY ) ; ALTER TABLE `files_news` ADD CONSTRAINT interactable_ptr_id_refs_id_71833d78 FOREIGN KEY (`interactable_ptr_id`) REFERENCES `files_interactable` (`id`); CREATE UNIQUE INDEX `files_news_interactable_ptr_id` ON `files_news` (`interactable_ptr_id`); COMMIT; I think there should be only ONE index (or maybe two ?), but not three. Though I'm not sure about which one to keep : the primary key is essential, but the reference to the parent table too, when using InnoDB... any idea ? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Getting error when using ModelForm
Hello, I'm trying to use ModelForm to create a form based on one of my models. However, I'm getting the following error: /// AttributeError at /plush/theone/ 'ModelFormOptions' object has no attribute 'many_to_many' /// Below is my code: /// Views.py File def theone(request): a = TestForm() if request.POST: b = TestForm(data=request.POST, instance=a) if b.is_valid(): b.save() else: assert False, "Errors" else: form = TestForm(instance=a) return render_to_response('plush_mytest.htm', {'theform': form}) /// /// Models.py File class MyTest(models.Model): myfirst = models.CharField(max_length=100) /// /// myform.py file class TestForm(ModelForm): class Meta: model = MyTest /// /// plush_mytest.htm File {{ theform.myfield }} /// The error occurs when I get to the following line in my views.py file 'form = TestForm(instance=a)'. Anybody have any suggestions? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
cursor.cursor.fetchall() dict version?
is there a dict returning version of cursor.cursor.fetchall() ? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Default Pluralize logic
> Is it? Maybe. I don't know if anyone has proposed smartening-up Django's > pluralization rules in the past I had a look through the mailing-list archive and couldn't spot anything directly related. > (I'm not even sure if you are proposing it > here?). I pretty much am proposing it here. I wanted to confirm my understanding of how the pluralize logic currently works in Django. > My gut feeling is it's probably something that has lots of > exceptions/special cases that would make it hard to get entirely right, > particularly for all languages, but maybe I'm unduly pessimistic. > Example of some exceptions/special cases are irregular plural nouns. However, as default pluralize function, I believe we can handle a lot more cases compared to the current functionality. Also, by looking at having language specific rules files (maybe linking this into the internationalization logic), we can quite easily train the pluralize function to handle more exceptions/special cases too without needing to modify the source code (decoupling the rules from the source code, pluralize function). The code to enhance the pluralize function is pretty straightforward. I have already implemented this functionality in my own code base that I would be happy to share. (I can create a patch/diff if there would be interest.) Regards, -Alen On May 3, 9:52 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, May 3, 2008 at 5:39 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > Could someone please be kind to explain to me how the pluralize logic > > works in django? > > a.) pluralize template filter > > Doc for this is > here:http://www.djangoproject.com/documentation/templates/#pluralize > > > b.) Meta.verbose_name_plural > > Doc for this is > here:http://www.djangoproject.com/documentation/model-api/#verbose-name-pl... > > > As default, I am expecting the pluralize to convert "country" to > > "countries". For exapmle, this doesn't happen in admin so I define the > > verbose_name_plural in the Meta inner class. > > Per the doc, the default pluralize (filter) behavior is to simply add an s. > If that is not correct for the word in question, then you have to tell the > filter what the correct suffix is. The doc also has an example of how to > specify that pluralize should change a -y to an -ies. > > For the model's verbose plural name, again the doc states the default > behavior is to add an s. If that isn't correct, then you need to specify > verbose_name_plural, as you have. > > > Its straightforward to implement a function that can seemlessly handle > > this correctly as default, even if it was to read the pluralization > > rules from a rules. files or something equivalent. > > Is it? Maybe. I don't know if anyone has proposed smartening-up Django's > pluralization rules in the past (I'm not even sure if you are proposing it > here?). My gut feeling is it's probably something that has lots of > exceptions/special cases that would make it hard to get entirely right, > particularly for all languages, but maybe I'm unduly pessimistic. > > Karen --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Lock-In
Question, I work in a company that is adopting the agile method, scrum. They are doing implementing it using c#, which I think is funny. How does a company decide to switch its development language? We have very long development cycle's, and I would have thought they would have looked at the language they are using, but they laugh when that is suggested. Has anyone seen a company pull off a switch from a .Net / Sql based environment to a Python / MySql sucefully? Where benifits seen? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjangoFriendly?
You may recognize my name from that forum topic. I've been working for over a week to get PostGIS installed correctly for my hosting at WebFaction. The support team is very responsive and helpful and we have worked through a lot of issues. That said, it still doesn't work correctly. This is definitely not something they seem to do a lot, so there's no set process to actually get everything working. It seems to be a one-off thing with a slightly different process for every user. I'd be glad to share what I've done to get thus far in the process, if you're interested. I want to reiterate that the support guys at WebFaction have really worked hard on this and have been very helpful. It just seems like it's something that's somewhat non-standard for them. Of course, if you have a slice at SliceHost, you can install anything you want. The limit is only your knowledge and capabilities. /alex On Sun, May 4, 2008 at 9:43 AM, Justin Bronn <[EMAIL PROTECTED]> wrote: > > > Anyone have experience/opinions on hosting GeoDjango with PostGIS on > > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > > I'm wondering if WebFaction shared account allows you enough freedom > > to install all the geodjango dependencies... > > While I don't personally use WebFaction and/or Slicehost, others have > mentioned they've had success running on WebFaction: > http://forum.webfaction.com/viewtopic.php?id=957 > > Because I'm not familiar w/the way WebFaction sets things up I'd try > the GeoDjango installation instructions first over what is posted in > that forum topic: > http://code.djangoproject.com/wiki/GeoDjangoInstall > > -Justin > > > > > --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjangoFriendly?
> Anyone have experience/opinions on hosting GeoDjango with PostGIS on > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > I'm wondering if WebFaction shared account allows you enough freedom > to install all the geodjango dependencies... While I don't personally use WebFaction and/or Slicehost, others have mentioned they've had success running on WebFaction: http://forum.webfaction.com/viewtopic.php?id=957 Because I'm not familiar w/the way WebFaction sets things up I'd try the GeoDjango installation instructions first over what is posted in that forum topic: http://code.djangoproject.com/wiki/GeoDjangoInstall -Justin --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can I use Django to display data form a legacy database?
> Thanks. To be sure, when I do the python manage.py syncdb, that > doesn't alter my existing database does it? What is syncdb doing in > this case? It is typically worth the effort to search the docs: http://www.djangoproject.com/documentation/django-admin/#syncdb Particularly, read the highlighted section entitled "Syncdb will not alter existing tables." -Justin --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can I use Django to display data form a legacy database?
On May 4, 12:22 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, May 3, 2008 at 11:55 PM, jmDesktop <[EMAIL PROTECTED]> wrote: > > > If all I want to do is display a row(s) from a legacy database, one > > that I did not create with Django and syncdb, will Django do that? Do > > I have to alter my legacy database in any way (assume it's a pre- > > existing MySQL, Oracle, or SQL Server database)? > > > Thank you. > > Search the docs on legacy and you'll find this: > > http://www.djangoproject.com/documentation/legacy_databases/ > > Karen Thanks. To be sure, when I do the python manage.py syncdb, that doesn't alter my existing database does it? What is syncdb doing in this case? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjangoFriendly?
I don't know about specifically GeoDjango dependencies, but the Webfaction guys have been very responsive to my requests for additional Python module installations. Richard On May 4, 12:20 pm, Tyler Erickson <[EMAIL PROTECTED]> wrote: > Anyone have experience/opinions on hosting GeoDjango with PostGIS on > WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? > I'm wondering if WebFaction shared account allows you enough freedom > to install all the geodjango dependencies... --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: [newforms-admin] using multiple AdminSites
On Sat, May 3, 2008 at 11:05 PM, derek.hoy <[EMAIL PROTECTED]> wrote: > - if you register models to basic-admin, they won't show automatically > in advanced-admin and vice-versa Looks like you can register a model with more than one AdminSite. Derek --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: urls() and request.user
2008/5/2 Nathaniel Whiteinge <[EMAIL PROTECTED]>: > > On May 1, 10:04 am, "Guillaume Lederrey" > > <[EMAIL PROTECTED]> wrote: > > This of course doesnt work because the request isnt in the scope. I > > could redefine a view in my views.py and do the work on the request > > manually, but i have a feeling there is a solution to do that directly > > in my urls.py. > > Sorry, there isn't a way to get at the request object in your urlconf. > You'll have to make a wrapper around the generic view -- when the > wrapper is small, I often just put it in my ``urls.py``:: > > from django.conf.urls.defaults import * > from whereever.youput.create_update import update_object > > urlpatterns = patterns('', > ('^pattern/$', 'path.to.this.urlconf.mywrapper'), > ) > > def mywrapper(request): > ... > return update_object(request, ...) I havent done any functional programming in a long time , but ... isnt there a way to use an anonymous function (if that's what it is called) and do the wrapper "inline" ? Something like : urlpatterns = patterns('', ('^pattern/$', lambda(request)( return update_object(request, ...) ), ) Thanks for your help ! -- Jabber : [EMAIL PROTECTED] Skype : Guillaume.Lederrey Projects : * http://rwanda.ledcom.ch/ --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: absolute url overrides
I read that doc many times :) Missed that little detail every time though. Thanks for the help! --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
GeoDjangoFriendly?
Anyone have experience/opinions on hosting GeoDjango with PostGIS on WebFaction or Slicehost (or any other of the DjangoFriendly hosts)? I'm wondering if WebFaction shared account allows you enough freedom to install all the geodjango dependencies... --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: child edit causes duplication with model inheritance
On Sun, May 4, 2008 at 3:29 AM, bobhaugen <[EMAIL PROTECTED]> wrote: > Does that mean newforms-admin includes qs-ref? That is, newforms- > admin includes all of the most current svn trunk? The ideal way to find out this sort of information is to watch the development timeline: http://code.djangoproject.com/timeline And specifically the log of the newforms-admin branch: http://code.djangoproject.com/log/django/branches/newforms-admin -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Suggestions on building a "Grouped" RadioSelect
I have a form, on that form is a ModelChoiceField named MediumFormat. It points to a MediumFormat table in my database which acts as an entity relationship between a Medium table and a Format table. I need to display a single radio button collection, that is, it is being driven by a single Form field. But I need to group the radios based on the medium they represent. This is basically just a visual thing, I need more than one unordered list encapsulating different items in the field based on their relationship. I've been looking into writing a custom widget, but it would be nice to just do this as a one-off in the template for now. Is there any way to gain access to the queryset for a form field from the template? For example: {{ form.mediumFormat.queryset.medium.id }} I tried that approach but it renders blank. My other option is a custom widget, but I don't think the widget has direct access to the queryset either, just a choices list. --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: child edit causes duplication with model inheritance
On May 4, 2:49 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > As a slight addendum to what James said, it will be implemented in the > newforms-admin branch, and will be available in trunk after the > merge(you can of course use the newforms-admin branch if you need > this). Does that mean newforms-admin includes qs-ref? That is, newforms- admin includes all of the most current svn trunk? --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: child edit causes duplication with model inheritance
As a slight addendum to what James said, it will be implemented in the newforms-admin branch, and will be available in trunk after the merge(you can of course use the newforms-admin branch if you need this). On May 4, 2:41 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, May 4, 2008 at 12:58 AM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > if you add an "A" object then edit it and hit save it duplicates > > itself. Does anyone else have this trouble with model inheritance? > > The admin does not currently support model inheritance. This is a > known and documented issue, and is being worked on. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: child edit causes duplication with model inheritance
On Sun, May 4, 2008 at 12:58 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > if you add an "A" object then edit it and hit save it duplicates > itself. Does anyone else have this trouble with model inheritance? The admin does not currently support model inheritance. This is a known and documented issue, and is being worked on. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---