Re: Integrating Selenium web tests with django test suite
On Jun 4, 4:15 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 6/2/07,Almad<[EMAIL PROTECTED]> wrote: > I haven't played with Selenium integration extensively; however, the > broad use case (tests against a live server) is one that I am > interested in supporting. > #2879 contains a patch that is intended to make selenium-type tests > easier. Any comments or feedback on that patch, or any other > suggestions, are welcome. I'll give it a shot and provide feedback soon. > Yours, > Russ Magee %-) Almad --~--~-~--~~~---~--~~ 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: edit_inline causing problems with multiple relations
On Tue, 2007-06-05 at 13:01 -0400, James Punteney wrote: > I'm having this issue as well. > > Anyone know if a ticket was filed for this or have any fixes been > done? I looked in Trac and didn't anything. > > If not I'll go ahead and submit a ticket. As far as I know, there is no open ticket for this, so it won't have been looked at. No ticket => bug does not exist, in practice -- the mailing list is too high volume to remember which problems are user errors and which might be core bugs. A repeatable small example would be ideal, since without being able to repeat the problem, it's going to be hard to debug. Thanks, Malcolm --~--~-~--~~~---~--~~ 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: Using login_required with direct_to_template?
On Wed, 2007-06-06 at 04:12 +, [EMAIL PROTECTED] wrote: > I'm trying to use the login_required decorator with the > direct_to_template generic view. I've read through the "Extending > Generic Views" section of DjangoBook (as recommended in a similar post > in this group) but I must be missing something. > > Here's my best attempt: > > urlpatterns = patterns('', > url(r'^$', 'django.views.generic.simple.direct_to_template', > {'template': 'main.html', 'login_required': 'True'}), > ) > > What am I missing? An explanation of what you expect to happen and what is actually happening for a start, along with any error message. How are your trying to use login_required in your template? Your initial paragraph says you are trying to use the login_required *decorator*, but that is something that applies to Python code, not inside a template. Regards, Malcolm --~--~-~--~~~---~--~~ 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: QuerySet Question - Selecting a Single Field
On 6/6/07, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > > This will grab _all_ score objects, and sort them by baseball score. > > If there isn't a baseball score, then 'baseball' will have a value of > > None, which is still a sortable value. > > Alright, so just to be safe, I really shouldn't be showing the values > for all players, since that risks showing values for the other sports > as well? Based on what I know about your model (which isn't much), I'd say yes. > Grabbing and sorting like this isn't an expensive task is it? Depends what the alternative is. However, I would doubt that this would be the bottleneck on your application. > Would I use the same order_by functionality if I wanted to say... > compare a person's score to the highest? Like a percentile thing? That's a different question, and one to which Django doesn't have a complete answer as yet. order_by is literally just a sorting operation. It doesn't do comparisons. To do in-database comparisons, you need to use aggregate clauses, which don't currently have a representation in Django (this is one area I've been wanting to work on for some time now). There are other ways to do the comparsions (both in SQL and in your view). Discovering those is left as an exercise to the reader :-) 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: Form input to csv + file upload
On 6/6/07, Vincent Nijs <[EMAIL PROTECTED]> wrote: > > I have been searching for examples but everything that I see has a link to a > database. How to you 'get' the data from a form in django? What is the > equivalent of 'data = cgi.FieldStorage(keep_blank_values=1)' I would use > with a Python cgi script? The form has an attribute called 'cleaned_data', which can be subscripted using the name of the field. Typos notwithstanding, your code will end up looking something like: class MyForm(Form): field1 = CharField(max_length=20) field2 = BooleanField() def myview(request): if request.method == "POST": form = MyForm(request.POST) if form.is_valid(): do_something_with(form.cleaned_data['field1']) return HttpResponseRedirect('/some/url') else: form = MyForm() return render_to_response('template.html', { 'form': form }) 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: QuerySet Question - Selecting a Single Field
> This will grab _all_ score objects, and sort them by baseball score. > If there isn't a baseball score, then 'baseball' will have a value of > None, which is still a sortable value. Alright, so just to be safe, I really shouldn't be showing the values for all players, since that risks showing values for the other sports as well? Grabbing and sorting like this isn't an expensive task is it? Would I use the same order_by functionality if I wanted to say... compare a person's score to the highest? Like a percentile thing? --~--~-~--~~~---~--~~ 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: Form input to csv + file upload
I have been searching for examples but everything that I see has a link to a database. How to you 'get' the data from a form in django? What is the equivalent of 'data = cgi.FieldStorage(keep_blank_values=1)' I would use with a Python cgi script? Thanks, Vincent On 6/5/07 7:22 PM, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > > On 6/6/07, Vincent Nijs <[EMAIL PROTECTED]> wrote: >> >> Question: If I want to save the file to a directory and information about >> the submitter (e.g., name and time of submission) directly to a csv file, >> how would I do that in Django? Do you need 'newforms' to do that? In the >> documentation it seems that if you use newforms you would have to save >> everything to a database. Is that really necessary? For some of my forms I >> want to save information in a dbase that but probably not for all. > > Newforms is a tool for constructing HTML forms. One obvious source of > forms is to create a form that matches a database object, so newforms > provides tools to assist in creating forms for database objects, with > an easy method for saving objects that are created/modified using that > form. However, forms don't have to be bound to a database object. You > can create a form, gather data using that form, and then just use the > data, rather than using it to populate a database object. > > It looks like what you need to do is: > - write a custom form that gathers the data you need > - write a custom view that displays the form, validates the data, then > outputs the CSV file if the form data is valid. > > Yours, > Russ Magee %-) > > > -- Vincent R. Nijs Assistant Professor of Marketing Kellogg School of Management, Northwestern University 2001 Sheridan Road, Evanston, IL 60208-2001 Phone: +1-847-491-4574 Fax: +1-847-491-2498 E-mail: [EMAIL PROTECTED] Skype: vincentnijs --~--~-~--~~~---~--~~ 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: QuerySet Question - Selecting a Single Field
On 6/6/07, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > > Score.objects.order_by('-baseball') > > > > will return all the objects in reverse order. > > Does this only grab the baseball scores? Or grabs all of them and THEN > sorts them by score? > (Just for future reference.) This will grab _all_ score objects, and sort them by baseball score. If there isn't a baseball score, then 'baseball' will have a value of None, which is still a sortable value. 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: QuerySet Question - Selecting a Single Field
> Score.objects.order_by('-baseball') > > will return all the objects in reverse order. Does this only grab the baseball scores? Or grabs all of them and THEN sorts them by score? (Just for future reference.) > However, it looks like your table is intended to be at least partially > sparse (i.e., every score object doesn't have all the values). If > this is the case, you may want to exclude some data from the list of > objects: > > Score.objects.filter(baseball__isnull=False).order_by('baseball') > > will get all the objects that have a baseball score (i.e., the > baseball score _isn't_ None), and orders them by the value of the > baseball field. This looks like what I need, I'll try it out! Thanks Russell! --~--~-~--~~~---~--~~ 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: QuerySet Question - Selecting a Single Field
On 6/6/07, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > Alright, new problem for you guys. Here's an example model in an app > called "scores", which contains all the scores for a particular > player: > > # Baseball > baseball= models.PositiveIntegerField('Baseball Skill > Level', blank=True, null=True, maxlength=4) > # Bowling > bowling = models.PositiveIntegerField('Bowling Skill > Level', blank=True, null=True, maxlength=4) > # Boxing > boxing = models.PositiveIntegerField('Boxing Skill > Level', blank=True, null=True, maxlength=4) > > (etc.) > > Now, right now all the scores are lumped within this model. My > question comes in when trying to call these items in my views. Say if > I want to gather all the baseball scores and sort them. What would the > queryset call for that be? It sounds like you're looking for a query like: Score.objects.order_by('baseball') That is, get all the Person objects, and sort them by the value of the 'baseball' score ( Score.objects.order_by('-baseball') will return all the objects in reverse order. However, it looks like your table is intended to be at least partially sparse (i.e., every score object doesn't have all the values). If this is the case, you may want to exclude some data from the list of objects: Score.objects.filter(baseball__isnull=False).order_by('baseball') will get all the objects that have a baseball score (i.e., the baseball score _isn't_ None), and orders them by the value of the baseball field. Hope this helps, 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: Another Django Site with Source Code
Wow! Thanks Kelvin! That's awesome!! Sincerely, -Warren - Original Message - From: "Kelvin Nicholson" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 05, 2007 10:14 PM Subject: Another Django Site with Source Code > > Dear all Djangoers: > > When I first started learning Django I found the docs > better-than-average, yet looking at code was the way for me to really > grasp certain concepts. Cheeserater (thanks Jacob!) was great to look > at a way to do voting, Cab (thanks James!) was great to look at how to > deal with Newforms, Lost-Theories (thanks Jeff!) was great to look at > the commenting system, and rossp.org's blog tutorials (thanks Ross!) > were a great starting place. > > In order to hopefully help somebody out, I wanted to quickly create a > site with the sole intention of distributing the source code. Let me > take this time to introduce http://www.colddirt.com -- the sinful > aggregator. > > Nothing is too complex, so if you've just started learning Django, feel > free to look through this code. Some of the the things I've touched on: > > -Django's syndication framework (both simple and a little complex) > -Sitemap creation > -Generic views > -Newforms > -Searching stuff > -AJAX usage (one simple and one using JSON serialization) > -Tagcloud creation > -FreeComment > > To supplement the code I wrote up a five part explanation (maybe I'll > add more later): > > http://www.kelvinism.com/tech-blog/colddirt-information/ > > If you are just learning, maybe this can help. If you are a Django > guru, and see me breaking any best practices, please let me know! > > Thanks Django Community, > > Kelvin > > > > > --~--~-~--~~~---~--~~ 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 login_required with direct_to_template?
I'm trying to use the login_required decorator with the direct_to_template generic view. I've read through the "Extending Generic Views" section of DjangoBook (as recommended in a similar post in this group) but I must be missing something. Here's my best attempt: urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'main.html', 'login_required': 'True'}), ) What am I missing? --~--~-~--~~~---~--~~ 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: yearless date
On 6/6/07, dailer <[EMAIL PROTECTED]> wrote: > > looking for ideas on the best way to handle this. I have a need to set > up date ranges not tied to a particular year, like Jan 1 - Feb 12. I > like that the admin interface provides a date selector so I'm tempted > to just use a DateField and ignore the fact that I would be selecting > a specific year. I'm thinking the other option is to use a CharField > to hold values like "Jan 1" and maybe try to rework the javascript for > the date selector. Sounds like you already know what needs to be done. The first approach would be very low effort, but could be misleading from a UI point of view; the second approach required writing a customized widget. This isn't hard to do, but it does require more effort. 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 -~--~~~~--~~--~--~---
Another Django Site with Source Code
Dear all Djangoers: When I first started learning Django I found the docs better-than-average, yet looking at code was the way for me to really grasp certain concepts. Cheeserater (thanks Jacob!) was great to look at a way to do voting, Cab (thanks James!) was great to look at how to deal with Newforms, Lost-Theories (thanks Jeff!) was great to look at the commenting system, and rossp.org's blog tutorials (thanks Ross!) were a great starting place. In order to hopefully help somebody out, I wanted to quickly create a site with the sole intention of distributing the source code. Let me take this time to introduce http://www.colddirt.com -- the sinful aggregator. Nothing is too complex, so if you've just started learning Django, feel free to look through this code. Some of the the things I've touched on: -Django's syndication framework (both simple and a little complex) -Sitemap creation -Generic views -Newforms -Searching stuff -AJAX usage (one simple and one using JSON serialization) -Tagcloud creation -FreeComment To supplement the code I wrote up a five part explanation (maybe I'll add more later): http://www.kelvinism.com/tech-blog/colddirt-information/ If you are just learning, maybe this can help. If you are a Django guru, and see me breaking any best practices, please let me know! Thanks Django Community, Kelvin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
yearless date
looking for ideas on the best way to handle this. I have a need to set up date ranges not tied to a particular year, like Jan 1 - Feb 12. I like that the admin interface provides a date selector so I'm tempted to just use a DateField and ignore the fact that I would be selecting a specific year. I'm thinking the other option is to use a CharField to hold values like "Jan 1" and maybe try to rework the javascript for the date selector. --~--~-~--~~~---~--~~ 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: noob minlength question
thx, that's what I thought but wasn't sure if I was missing something. I don't really like that you then have.. maxlength=3, validator_list=... I guess I could subclass CharField On Jun 5, 10:33 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > seems silly but how do I specify minimum length for a > > CharField. Would that require customer validation? > > I suspect you just want a custom validator in your > validator_list...something like > > def is_longer_than(n): >def result(field_data, all_data): > if len(field_data) <= n: >raise django.core.validators.CriticalValidationError, \ > 'Must be more than %i character(s)' % n >return result > > class Whatever(Model): >myfield = CharField(... > validator_list = [is_longer_than(10)], > > ) > > -tim --~--~-~--~~~---~--~~ 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: form_for_model, DecimalFIeld, and decimal_places
OK, I wasn't really sure how to do this correctly, but I just filed ticket #4486 ( http://code.djangoproject.com/ticket/4486 ) -- hopefully in a useful form! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Welcome to my Blog.
Welcome to my Blog. http://myfdc.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 -~--~~~~--~~--~--~---
QuerySet Question - Selecting a Single Field
Alright, new problem for you guys. Here's an example model in an app called "scores", which contains all the scores for a particular player: # Baseball baseball= models.PositiveIntegerField('Baseball Skill Level', blank=True, null=True, maxlength=4) # Bowling bowling = models.PositiveIntegerField('Bowling Skill Level', blank=True, null=True, maxlength=4) # Boxing boxing = models.PositiveIntegerField('Boxing Skill Level', blank=True, null=True, maxlength=4) (etc.) Now, right now all the scores are lumped within this model. My question comes in when trying to call these items in my views. Say if I want to gather all the baseball scores and sort them. What would the queryset call for that be? I've found things such as order_by and such, but I usually just see ".all()", so would an easier way to do this include splitting these up into separate models (which then boggles my mind when I'm thinking of showing all of the inputs for every model on a single page)? This seems like my only roadblock before really getting somewhere with this. So any and all help is apprecaited! --~--~-~--~~~---~--~~ 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: form_for_model, DecimalFIeld, and decimal_places
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > > > 1) This sounds like it could be a bug. If your model defines 2 decimal > > places, my initial reaction is that the form should show 2 decimal > > places by default. > > Well, I figured that with currency being such a common use, if it were > a bug it would already have been found and squashed. But maybe what > I'm doing is unusual -- I'm feeding the field an initial value of > 25.00, and the form is displaying "25.0" Newforms is, as the name suggests, new. The distinction between Decimal and Floatfields is even newer. I'm not surprised that there are still a few kinks. > > Is that info any use? It would be even more useful on a bug report :-) 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: Django + mod_python
> but I dont know where to add that config, another thing I've noticed > is that my httpd.conf is located at /etc/apache2/ and the size of the > file is 0 bytes, is this normal? As Deryck noted, httpd.conf is referenced in apache2.conf; instead of putting virtualhosts in apache2.conf though, you can consider adding each individual site to sites-available. After it is added there, you can type: # a2ensite And it will list all the sites, select the one you want enabled. Or you can just create a symlink from sites-available/yoursite.conf -> sites-enabled/yoursite.conf Kelvin --~--~-~--~~~---~--~~ 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: form_for_model, DecimalFIeld, and decimal_places
> 1) This sounds like it could be a bug. If your model defines 2 decimal > places, my initial reaction is that the form should show 2 decimal > places by default. Well, I figured that with currency being such a common use, if it were a bug it would already have been found and squashed. But maybe what I'm doing is unusual -- I'm feeding the field an initial value of 25.00, and the form is displaying "25.0" > 2) You can override an individual element using the formfield_callback > on form_for_model. The idea here is to provide a function that returns > the form field when provided with a model field. The default > implementation calls the formfield() method on the model field; If you > want to use a different widget for just one field, you can provide an > implementation for formfield_callback that overrides just one field. Ah, OK, I think I'm starting to understand how this newforms stuff works now -- thanks! So I just overrode the field with a callback (it's working, since the label override is working) and did a few more tests of initial data values: value: 25.0 displayed: 25.0 value: 25.01 displayed: 25.01 value: 25 displayed: 25 value: 25.001 displayed: 25.001 value: 25.000 displayed: 25.0 Is that info any use? --~--~-~--~~~---~--~~ 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: Form input to csv + file upload
On 6/6/07, Vincent Nijs <[EMAIL PROTECTED]> wrote: > > Question: If I want to save the file to a directory and information about > the submitter (e.g., name and time of submission) directly to a csv file, > how would I do that in Django? Do you need 'newforms' to do that? In the > documentation it seems that if you use newforms you would have to save > everything to a database. Is that really necessary? For some of my forms I > want to save information in a dbase that but probably not for all. Newforms is a tool for constructing HTML forms. One obvious source of forms is to create a form that matches a database object, so newforms provides tools to assist in creating forms for database objects, with an easy method for saving objects that are created/modified using that form. However, forms don't have to be bound to a database object. You can create a form, gather data using that form, and then just use the data, rather than using it to populate a database object. It looks like what you need to do is: - write a custom form that gathers the data you need - write a custom view that displays the form, validates the data, then outputs the CSV file if the form data is valid. 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: form_for_model, DecimalFIeld, and decimal_places
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote: > > Hello again -- > > I'm creating a form using form_for_model. The model in question has a > decimal field with 2 decimal places. The form, however, is displaying > the field with one decimal place. I've googled and poked through the > tests, but I can't figure out how to override this without creating an > entire custom form, which seems like overkill. I'm sure I'm missing > something, but... what? 1) This sounds like it could be a bug. If your model defines 2 decimal places, my initial reaction is that the form should show 2 decimal places by default. 2) You can override an individual element using the formfield_callback on form_for_model. The idea here is to provide a function that returns the form field when provided with a model field. The default implementation calls the formfield() method on the model field; If you want to use a different widget for just one field, you can provide an implementation for formfield_callback that overrides just one field. The newforms docs contain a description for how this works. 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 -~--~~~~--~~--~--~---
[Announcement]: WebHelpers for Django
Greetings! To boost my Django skills and show that Django can be JavaScript-ready from the start, I started porting Pylons Webhelpers[1] to Django, implementing them as templatetags. It is hosted on Google projects[2]. To show how it works, I created small Django project that implements basic Webhelpers features. You can find it in project's Download section [3] For starters I plan to port existing functions, but I have some ideas what has to be done more. Any suggestions and ideas welcome. [1] http://pylonshq.com/WebHelpers/module-index.html [2] http://code.google.com/p/django-helpers/ [3] http://django-helpers.googlecode.com/files/helpers.zip -- Arvis http://viestards.tosteris.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 -~--~~~~--~~--~--~---
form_for_model, DecimalFIeld, and decimal_places
Hello again -- I'm creating a form using form_for_model. The model in question has a decimal field with 2 decimal places. The form, however, is displaying the field with one decimal place. I've googled and poked through the tests, but I can't figure out how to override this without creating an entire custom form, which seems like overkill. I'm sure I'm missing something, but... what? Any suggestions? Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Earn $2000 a few times a week
If you are tired of not making money on the Net and want something that really works, then go to: http://www.tellmemoresite.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 -~--~~~~--~~--~--~---
Django on MySQL Cluster
The mysql ndb (cluster) and MyISAM engines do not support referential integrity, and neither does sqlite. In looking around on this list and the web, i've noticed that django actually handles many of these reference features on its own. However, in the docs on django/mysql at http://www.djangoproject.com/documentation/databases/ it is mentioned that "Django expects the database to support transactions, referential integrity, and Unicode support (UTF-8 encoding)". Are there any features that might not work in django when using an engine such as ndb? Has anyone tried using django with MySQL cluster? Should there be any _other_ issues anyone can think of that might come up when using django with MySQL Cluster? thankyou -Richard Stevens --~--~-~--~~~---~--~~ 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: custom menus with ul,li
hi, i did the same. My solution is not as elegant but works ok for me: model: class Menu(models.Model): createdate = models.DateTimeField(auto_now_add='True') islive = models.BooleanField(default=True, help_text="Untick if you do not want this to be live.") position = models.IntegerField(help_text="enter a digit for manual sorting, 0 is 1st.") name = models.CharField(_("Name"), core=True, maxlength=19) httplink = models.CharField(maxlength=250, blank = True, null=True) parent = models.ForeignKey('self', limit_choices_to = { 'parent__isnull':'True' }, editable=True, blank = True, null=True, related_name='child') def __str__(self): return self.name class Admin: list_display = ( 'position', 'name', 'parent') pass parent can point to it self, with the limit_choices_to i made it so that you can only chose menu points with out a parent i.e. Root menu, so this goes 2 levels deep. Than i use a template tag to call the menu: register = template.Library() @register.inclusion_tag('cms/menu.html') def menugroup(parent): menu = Menu.objects.filter(parent__isnull=parent, islive=True).order_by('position') return {'menu': menu} @register.inclusion_tag('cms/submenu.html') def submenugroup(parentid): menu = Menu.objects.filter(parent=parentid, islive=True).order_by('position') return {'menu': menu} and here is the template: menu.html (put the UL tag around it in the main template that calls this tag, i use some fancy CSS to make it all look nice, its a vertical flyout menu) {% load menu %} {% for menu in menu %} {% if forloop.first %} {% else %} {% if forloop.last %} {% else %} {% endif %} {% endif %} {{ menu.name }} {% submenugroup menu.id %} {% endfor %} submenu.html {% for menu in menu %} {{ menu.name }} {% endfor %} much more elegant would be to build the menu in the templeate tag completly, if you look at the django ecommece shop Satchmo, there is a much nicer example. http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/views <- i thinks in there some where. I did this when i started with django and python, so my skills were very limited, still not much better ;) but getting there. On Jun 5, 10:42 pm, tyman26 <[EMAIL PROTECTED]> wrote: > I am trying to build dynamic menus that are brought in from a > database. I set up the table in this structure: > CREATE TABLE auth_menu > ( > menu_id serial NOT NULL, > group_id int4 NOT NULL, > parent_id int4, > auth_permission_id int4, > title varchar(35) NOT NULL, > url varchar(100), > order_index int4 NOT NULL, > .) > > The top level menu is known by the fact that menu_id and group_id are > the same with a null parent_id, and then it goes parent, child If > the menu_id and group_id are the same, then we know its also a top > level menu, but still underneath the main_menu. If its a bottom level > leaf, then none are the same. I am stuck on how to build html with ul/ > li lists or if it's even possible. I am certain recursion is needed. > Does anyone have an idea where to look for a solution to this problem? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Form input to csv + file upload
Below is an example of the type form I used to process with a python cgi script. Now I am trying to move everything over to Django. Question: If I want to save the file to a directory and information about the submitter (e.g., name and time of submission) directly to a csv file, how would I do that in Django? Do you need 'newforms' to do that? In the documentation it seems that if you use newforms you would have to save everything to a database. Is that really necessary? For some of my forms I want to save information in a dbase that but probably not for all. I am getting the hang of templates and authentication in Django but forms look a bit more complicated. Thanks, Vincent Name: John Sue Assignment: Assignment 1 Assignment 2 Word document: --~--~-~--~~~---~--~~ 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: syncdb fails for auth and other "built-in" apps
On 5 Juni, 17:18, "Deryck Hodge" <[EMAIL PROTECTED]> wrote: > On 6/4/07, Psamathos <[EMAIL PROTECTED]> wrote: > > > Anyone with an idea what this could be? > > > Error: Couldn't install apps, because there were errors in one or more > > models: > > django.contrib.admin: > > django.contrib.sites: > > django.contrib.contenttypes: > > django.contrib.sessions: > > django.contrib.auth: > > Hi, Magnus. > > What does running `./manage.py validate` say? Is that error above the > same as what validate says? > > Cheers, > deryck It does. I installed version 0.96 and it works there, but then I'd have to change all my form.cleaned_data to form.clean_data, not a lot of work but a tad annoying since I'll have to change back when 0.97 is released :) $ python manage.py validate django.contrib.admin: django.contrib.sites: django.contrib.contenttypes: django.contrib.sessions: django.contrib.auth: regards, Magnus --~--~-~--~~~---~--~~ 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: problems using django on lighttpd with fastcig
Thanks! -- Jordi Funollet --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
custom menus with ul,li
I am trying to build dynamic menus that are brought in from a database. I set up the table in this structure: CREATE TABLE auth_menu ( menu_id serial NOT NULL, group_id int4 NOT NULL, parent_id int4, auth_permission_id int4, title varchar(35) NOT NULL, url varchar(100), order_index int4 NOT NULL, .) The top level menu is known by the fact that menu_id and group_id are the same with a null parent_id, and then it goes parent, child If the menu_id and group_id are the same, then we know its also a top level menu, but still underneath the main_menu. If its a bottom level leaf, then none are the same. I am stuck on how to build html with ul/ li lists or if it's even possible. I am certain recursion is needed. Does anyone have an idea where to look for a solution to this problem? --~--~-~--~~~---~--~~ 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: Problem with postgres transactions
Joshua D. Drake skrev: > Nis Jørgensen wrote: >> [...] anytime a >> database error occurs, all subsequent calls to the database fails with >> the error message "ProgrammingError: current transaction is aborted, >> commands ignored until end of transaction block". >> > > That is how PostgreSQL works. Your only option at that point is to > rollback and start again. Unless you change your isolation level. > I (kind of) know that. But I would expect Django to take care of rolling back the transaction in case of failure. >> This causes unittesting to break, since the tearDown will try to use the >> existing database connection, as well as giving me strange error >> messages at other times. You vcan see an example of the latter at the >> bottom of my mail. >> >> I have found that I can eliminate the problem by substituting this line >> self.connection.set_isolation_level(1) # make transactions >> transparent to all cursors >> > > This will work fine. > From a quick glance at the source+documentation, it seems like this (replacing with 0 in the line above) would basically revert everything to autocommit - and thus remove the ability to use for instance commit_on_success. But since I don't have any need for transaction management at the moment, I will leave it as is. /Nis --~--~-~--~~~---~--~~ 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: Problem with postgres transactions
Nis Jørgensen wrote: > Hello all > > I am using Django 0.96 with postgresql 8.1 and psycopg2. The error > handling does not work as I would expect it to. Specifically, anytime a > database error occurs, all subsequent calls to the database fails with > the error message "ProgrammingError: current transaction is aborted, > commands ignored until end of transaction block". That is how PostgreSQL works. Your only option at that point is to rollback and start again. Unless you change your isolation level. > > This causes unittesting to break, since the tearDown will try to use the > existing database connection, as well as giving me strange error > messages at other times. You vcan see an example of the latter at the > bottom of my mail. > > I have found that I can eliminate the problem by substituting this line > self.connection.set_isolation_level(1) # make transactions > transparent to all cursors This will work fine. Joshua D. Drake > with this one > self.connection.set_isolation_level(0) > in django/db/backends/postgresql_psycopg2/base.py > > However, I am worried that whoever wrote that code did so for a reason ;-) > > Can anyone tell me: > > - If this is intended behavior or a bug. > - If my change is likely to break anything, and if so, if there is > another recommended solution > > Yours, > > u'Nis J\xf8rgensen' > > Appendix: > > As an example of the problem, see the following interactive session > > ./manage.py shell > Python 2.4.4 (#2, Apr 5 2007, 20:11:18) > [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) from spider.models import Language Language.objects.create(isocode='xx') > Language.objects.create(isocode='xx') > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", > line 79, in create > return self.get_query_set().create(**kwargs) > File "/usr/lib/python2.4/site-packages/django/db/models/query.py", > line 262, in create > obj.save() > File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line > 238, in save > ','.join(placeholders)), db_values) > File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", > line 12, in execute > return self.cursor.execute(sql, params) > IntegrityError: duplicate key violates unique constraint > "spider_language_isocode_key" Language.objects.create(isocode='yy') > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", > line 79, in create > return self.get_query_set().create(**kwargs) > File "/usr/lib/python2.4/site-packages/django/db/models/query.py", > line 262, in create > obj.save() > File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line > 238, in save > ','.join(placeholders)), db_values) > File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", > line 12, in execute > return self.cursor.execute(sql, params) > ProgrammingError: current transaction is aborted, commands ignored until > end of transaction block > > > > > > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with postgres transactions
Hello all I am using Django 0.96 with postgresql 8.1 and psycopg2. The error handling does not work as I would expect it to. Specifically, anytime a database error occurs, all subsequent calls to the database fails with the error message "ProgrammingError: current transaction is aborted, commands ignored until end of transaction block". This causes unittesting to break, since the tearDown will try to use the existing database connection, as well as giving me strange error messages at other times. You vcan see an example of the latter at the bottom of my mail. I have found that I can eliminate the problem by substituting this line self.connection.set_isolation_level(1) # make transactions transparent to all cursors with this one self.connection.set_isolation_level(0) in django/db/backends/postgresql_psycopg2/base.py However, I am worried that whoever wrote that code did so for a reason ;-) Can anyone tell me: - If this is intended behavior or a bug. - If my change is likely to break anything, and if so, if there is another recommended solution Yours, u'Nis J\xf8rgensen' Appendix: As an example of the problem, see the following interactive session ./manage.py shell Python 2.4.4 (#2, Apr 5 2007, 20:11:18) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from spider.models import Language >>> Language.objects.create(isocode='xx') >>> Language.objects.create(isocode='xx') Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", line 79, in create return self.get_query_set().create(**kwargs) File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 262, in create obj.save() File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 238, in save ','.join(placeholders)), db_values) File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", line 12, in execute return self.cursor.execute(sql, params) IntegrityError: duplicate key violates unique constraint "spider_language_isocode_key" >>> Language.objects.create(isocode='yy') Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/django/db/models/manager.py", line 79, in create return self.get_query_set().create(**kwargs) File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 262, in create obj.save() File "/usr/lib/python2.4/site-packages/django/db/models/base.py", line 238, in save ','.join(placeholders)), db_values) File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", line 12, in execute return self.cursor.execute(sql, params) ProgrammingError: current transaction is aborted, commands ignored until end of transaction block --~--~-~--~~~---~--~~ 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: django admin users
I just fixed it, the symlink I created for the admin media directory was incorrect. Thanks anyways! On Jun 5, 10:58 am, "Justin Lilly" <[EMAIL PROTECTED]> wrote: > based on user, user portion... did your database change at all? Is there two > user columns? > > On 6/5/07, tyman26 <[EMAIL PROTECTED]> wrote: > > > > > > > I saw a previous post about this same thing a couple weeks ago, but > > there was no response to it. Whenever I use the admin site and try to > > access a user, I get this error message: > > > "TypeError at /admin/auth/user/3/" > > "Cannot resolve keyword 'user' into field. Choices are: permissions, > > user, user, id, name" > > > I recently converted the old login form with newforms and I'm thinking > > that may have something to do with it, but I don't see why this would > > conflict with anything. I login basically the same exact way. If > > anyone has any ideas I would much appreciate it, thanks. > > > -Tyson > > -- > Justin Lilly > University of South Carolina --~--~-~--~~~---~--~~ 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: any django users in Cuba?
You may perioticaly check the django frappr map. Right now, it doesn't seem as though any cuban django users have been pinned. http://www.frappr.com/django/map On 6/5/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote: > > there is any django users in Cuba or just a cuban user? > > -- > Lic. José M. Rodriguez Bacallao > Cupet > > > -- J.P. --~--~-~--~~~---~--~~ 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: dynamic fields in models
problem resolved, here is how I did it, just a little change to my original code, setattr by add_to_class, with this, I can add common attributes to a lot of models without having to inherit more than once or having a base class for all of them, beside, it just create one table, not two: def common_attrs(cls, common): attrs = dir(common) for attr in attrs: if isinstance( getattr(common, attr), models.Field ): #setattr( cls, attr, getattr(common, attr) ) cls.add_to_class(attr, getattr(common, attr) ) return cls class Content: title = models.CharField( maxlength = 50 ) description = models.CharField( maxlength = 100 ) created_by = models.ForeignKey( User ) creation_date = models.DateTimeField( auto_now_add = True ) pub_date = models.DateTimeField() exp_date = models.DateTimeField() class NewsItem(models.Model): text = models.TextField() def __str__(self): return self.title class Admin: pass NewsItem = common_attrs(NewsItem, Content) On 6/5/07, Branton Davis <[EMAIL PROTECTED]> wrote: > > > Cool! > > > > > -- Lic. José M. Rodriguez Bacallao Cupet --~--~-~--~~~---~--~~ 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: dynamic fields in models
problem resolved, here is how I did it, just a little change to my original code, setattr by add_to_class, with this, I can add common attributes to lot of models without having to inherit more than once or having a base class for all my models : def common_attrs(cls, common): attrs = dir(common) for attr in attrs: if isinstance( getattr(common, attr), models.Field ): #setattr( cls, attr, getattr(common, attr) ) cls.add_to_class(attr, getattr(common, attr) ) return cls class Content: title = models.CharField( maxlength = 50 ) description = models.CharField( maxlength = 100 ) created_by = models.ForeignKey( User ) creation_date = models.DateTimeField( auto_now_add = True ) pub_date = models.DateTimeField() exp_date = models.DateTimeField() class NewsItem(Content, models.Model): text = models.TextField() def __str__(self): return self.title class Admin: pass NewsItem = common_attrs(News, Content) On 6/5/07, Branton Davis <[EMAIL PROTECTED]> wrote: > > > Cool! > > > > > -- Lic. José M. Rodriguez Bacallao Cupet --~--~-~--~~~---~--~~ 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: "Powered by Django" directory - Designer Wanted!
Hi Frédéric, i think you missed the point, this will not be a resource page for modules/apps. It will be a showroom where you can post your websites you have made with django. See http://code.djangoproject.com/wiki/DjangoPoweredSites On 5 Jun., 19:21, Frédéric Roland <[EMAIL PROTECTED]> wrote: > Hi, > > nice idea. > > Just some thought: > > There is a great resource where people look for solutions: Python Cheese > Shop. I see some turbogear module there but very few Django related > modules. > > FR > > Ross Poulton a ?crit : > > > Hi all, > > > I've been using Django for quite a while now, some of you may know my > > name from occasional blog posts on the Django community aggregator. > > > I've been working on a website to showcase websites that are Powered > > by Django. In a similar vein to djangosnippets.org the site lets > > people sign up, submit sites, tag them, leave comments, etc etc. > > Screenshots are automatically grabbed for each site, and everything is > > displayed nicely. As much as I don't wish to compare or be seen to > > copy, this is somewhat similar to the RoR camps HappyCodr > > (www.happycodr.com) > > > I see this being a 'replacement' for the DjangoPoweredSites wiki page, > > which is growing and becoming less useful every day (IMO). > > > The site is basically all working nicely now, but I'm no good at the > > graphics side of things. I'm currently using a template from > >www.freecsstemplates.combut my hacking away has made it look like > > ass :) > > > Is anybody interested in volunteering a few hours time for this > > project? I would assume in the vein of other django community sites > > it'd stay ad-free, I'm happy to host and maintain it, with links to > > the designers website. > > > Anybody have any interest or other feedback? > > > Ross --~--~-~--~~~---~--~~ 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: "Powered by Django" directory - Designer Wanted!
Hi, nice idea. Just some thought: There is a great resource where people look for solutions: Python Cheese Shop. I see some turbogear module there but very few Django related modules. FR Ross Poulton a �crit : > Hi all, > > I've been using Django for quite a while now, some of you may know my > name from occasional blog posts on the Django community aggregator. > > I've been working on a website to showcase websites that are Powered > by Django. In a similar vein to djangosnippets.org the site lets > people sign up, submit sites, tag them, leave comments, etc etc. > Screenshots are automatically grabbed for each site, and everything is > displayed nicely. As much as I don't wish to compare or be seen to > copy, this is somewhat similar to the RoR camps HappyCodr > (www.happycodr.com) > > I see this being a 'replacement' for the DjangoPoweredSites wiki page, > which is growing and becoming less useful every day (IMO). > > The site is basically all working nicely now, but I'm no good at the > graphics side of things. I'm currently using a template from > www.freecsstemplates.com but my hacking away has made it look like > ass :) > > Is anybody interested in volunteering a few hours time for this > project? I would assume in the vein of other django community sites > it'd stay ad-free, I'm happy to host and maintain it, with links to > the designers website. > > Anybody have any interest or other feedback? > > Ross > > > > > > --~--~-~--~~~---~--~~ 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: "Powered by Django" directory - Designer Wanted!
So here is my first shot. 1024x768 http://img131.imagevenue.com/img.php?image=63063_djpr1_122_506lo.jpg 800x600 http://img157.imagevenue.com/img.php?image=63064_djpr2_122_796lo.jpg Let me know if you think its worth moving on. On 5 Jun., 17:04, wathi <[EMAIL PROTECTED]> wrote: > I´ll send you some screenshots later today of what i would do. --~--~-~--~~~---~--~~ 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: edit_inline causing problems with multiple relations
I'm having this issue as well. Anyone know if a ticket was filed for this or have any fixes been done? I looked in Trac and didn't anything. If not I'll go ahead and submit a ticket. Thanks, --James On 4/4/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-04-04 at 01:13 -0700, mh wrote: > > > I thought we fixed this a bit before 0.96 was released. Are you using > > > the latest release or some older code? > > > > Upgraded to 0.96 before I posted here, hoping it'd fix it but it > > didn't :/. > > Hmmm. :-( > > That's annoying. Could you drop your model example in a new ticket > please and mark it as a version 0.96 problem (so that nobody accidently > closes it thinking it was the thing James Bennett fixed just before the > release). We need to look at this some more. > > Thanks, > Malcolm > > > > > --~--~-~--~~~---~--~~ 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: robots.txt?
Yes, you'd set in something like: SetHandler None (which is exactly what I've done) -joe On 6/5/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > I'm not using mod_rewrite currently (and may even have it turned off > in Apache to save memory). Is there another solution? > > I have my static media folder set in Apache with: > > > SetHandler None > > > Can you do the same for single files? > > Thanks, > Rob > > On Jun 4, 8:12 am, KpoH <[EMAIL PROTECTED]> wrote: > > You can "mod_rewrite" /robots.txt to /static/robots.txt for example > > > > > > > --~--~-~--~~~---~--~~ 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: robots.txt?
You can always put a urlconf that will match "robots.txt" and return a simple http response... On Jun 5, 6:24 pm, "Deryck Hodge" <[EMAIL PROTECTED]> wrote: > On 6/5/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > > > SetHandler None > > > > > Can you do the same for single files? > > You can, and probably would be better than the mod_rewrite overhead in > this case. > > Cheers, > deryck --~--~-~--~~~---~--~~ 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: Django + mod_python
On 6/5/07, Gerard M <[EMAIL PROTECTED]> wrote: > > Hello dear django users community. > I have a little question, I've been digging for the past weeks trying > to get together all the technologies I need to host a django powered > app, and this is what I've managed to do: > I'm running Linux Ubuntu 7.04 Feitsy Fawn distro, I have Apache/2.2.3 > mod_python/3.2.10 Python/2.5.1 running well together, at least that is > what it says when I type http://localhost, the big question is, how do > I tell Apache or mod python that I'm using django and that I want > django to process my pages, I know there is something that I have to > add to httpd.conf according to the tutorial at www.djangoproject.com, > but I dont know where to add that config, another thing I've noticed > is that my httpd.conf is located at /etc/apache2/ and the size of the > file is 0 bytes, is this normal?, I'm a newbie with apache, so I would > really appreciate if you guys could detail your answer as much as you > can :), thanks Hi, Gerard. For Ubuntu, they use /etc/apache2/apache2.conf as the main config and include whatever is in /etc/apache2/httpd.conf as additional directives. This is why httpd.conf is blank on an initial install. You can add the directives from the Django docs in httpd.conf or apache2.conf on Ubuntu. It's really just your preference which you want to use. Cheers, deryck --~--~-~--~~~---~--~~ 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 + mod_python
Hello dear django users community. I have a little question, I've been digging for the past weeks trying to get together all the technologies I need to host a django powered app, and this is what I've managed to do: I'm running Linux Ubuntu 7.04 Feitsy Fawn distro, I have Apache/2.2.3 mod_python/3.2.10 Python/2.5.1 running well together, at least that is what it says when I type http://localhost, the big question is, how do I tell Apache or mod python that I'm using django and that I want django to process my pages, I know there is something that I have to add to httpd.conf according to the tutorial at www.djangoproject.com, but I dont know where to add that config, another thing I've noticed is that my httpd.conf is located at /etc/apache2/ and the size of the file is 0 bytes, is this normal?, I'm a newbie with apache, so I would really appreciate if you guys could detail your answer as much as you can :), thanks --~--~-~--~~~---~--~~ 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: django admin users
based on user, user portion... did your database change at all? Is there two user columns? On 6/5/07, tyman26 <[EMAIL PROTECTED]> wrote: > > > I saw a previous post about this same thing a couple weeks ago, but > there was no response to it. Whenever I use the admin site and try to > access a user, I get this error message: > > "TypeError at /admin/auth/user/3/" > "Cannot resolve keyword 'user' into field. Choices are: permissions, > user, user, id, name" > > I recently converted the old login form with newforms and I'm thinking > that may have something to do with it, but I don't see why this would > conflict with anything. I login basically the same exact way. If > anyone has any ideas I would much appreciate it, thanks. > > -Tyson > > > > > -- Justin Lilly University of South Carolina --~--~-~--~~~---~--~~ 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: robots.txt?
On 6/5/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > SetHandler None > > > Can you do the same for single files? > You can, and probably would be better than the mod_rewrite overhead in this case. Cheers, deryck --~--~-~--~~~---~--~~ 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 admin users
I saw a previous post about this same thing a couple weeks ago, but there was no response to it. Whenever I use the admin site and try to access a user, I get this error message: "TypeError at /admin/auth/user/3/" "Cannot resolve keyword 'user' into field. Choices are: permissions, user, user, id, name" I recently converted the old login form with newforms and I'm thinking that may have something to do with it, but I don't see why this would conflict with anything. I login basically the same exact way. If anyone has any ideas I would much appreciate it, thanks. -Tyson --~--~-~--~~~---~--~~ 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: syncdb fails for auth and other "built-in" apps
On 6/4/07, Psamathos <[EMAIL PROTECTED]> wrote: > Anyone with an idea what this could be? > > Error: Couldn't install apps, because there were errors in one or more > models: > django.contrib.admin: > django.contrib.sites: > django.contrib.contenttypes: > django.contrib.sessions: > django.contrib.auth: > Hi, Magnus. What does running `./manage.py validate` say? Is that error above the same as what validate says? Cheers, deryck --~--~-~--~~~---~--~~ 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: proper and easy way to urlencode unicode string?
On Tue, 2007-06-05 at 17:47 +0300, Andrey Khavryuchenko wrote: > > MT> Have a look at the iriencode filter (only in the unicode branch, so > MT> you'll need to read docs/templates.txt from the source). This handles > MT> the last stage of encoding to ASCII. > > Thanks for pointer. > > MT> You cannot necessarily skip the urlencode portion, but you may be able > MT> to. The reason is that the IRI -> URI conversion algorithm does _not_ > MT> encode things like '%', so it is safe to apply to something that has > MT> already been partially encoded. However, if your proto-URL string > MT> contains a '%' that should be encoded (e.g. "100%-guaranteed"), you will > MT> need to pass it through urlencode first. > > MT> So {{ tagname|urlencode|iriencode }} is completely safe, although > MT> possibly redundant (and even incorrect if tagname was something that had > MT> already been URL encoded). > > Well, I think here you've missed the point. Python fails *before* > iriencode - during urlencode. Check the traceback again: Ah, I see. For some reason I forgot to switch the urlencode filter over to use django.utils.http.urlquote(). I'll fix that in the morning. Regards, Malcolm --~--~-~--~~~---~--~~ 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: robots.txt?
I'm not using mod_rewrite currently (and may even have it turned off in Apache to save memory). Is there another solution? I have my static media folder set in Apache with: SetHandler None Can you do the same for single files? Thanks, Rob On Jun 4, 8:12 am, KpoH <[EMAIL PROTECTED]> wrote: > You can "mod_rewrite" /robots.txt to /static/robots.txt for example > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
integrity error silently failing
Hi, i got a simple example where a Model.save() that should raise integrity/operational errors is not: class one(models.Model): fk_field = models.ForeignKey('two') class two(models.Model): description = models.CharField(maxlength=10) In [1]: from webfi.sd.models import * In [2]: One(fk_field_id=1) Out[2]: In [3]: One(fk_field_id=1).save() The last line should have raised an integrity error but it does not. Db log (PostgreSQL) shows: STATEMENT: INSERT INTO "sd_one" ("fk_field_id") VALUES (1) 2007-06-05 16:55:38 [30666] LOG: duration: 0.345 ms statement: SELECT CURRVAL('"sd_one_id_seq"') STATEMENT: SELECT CURRVAL('"sd_one_id_seq"') 2007-06-05 16:55:38 [30666] ERROR: insert or update on table "sd_one" violates foreign key constraint "$1" DETAIL: Key (fk_field_id)=(1) is not present in table "sd_two". a second 'save' results in: In [4]: One(fk_field_id=1).save() --- psycopg2.OperationalError Traceback (most recent call last) /home/sandro/src/fossati/webfi/ /misc/src/django/trunk/django/db/models/base.py in save(self) 241 cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ 242 (backend.quote_name(self._meta.db_table), ','.join(field_names), --> 243 ','.join(placeholders)), db_values) 244 else: 245 # Create a new record with defaults for everything. /misc/src/django/trunk/django/db/backends/util.py in execute(self, sql, params) 10 start = time() 11 try: ---> 12 return self.cursor.execute(sql, params) 13 finally: 14 stop = time() OperationalError: insert or update on table "sd_one" violates foreign key constraint "$1" DETAIL: Key (fk_field_id)=(1) is not present in table "sd_two". And that's ok, but too late... It seems to me too big a mistake so I hope I'm just missing something, if not I'll file a new ticket for this. I think in no way a db error should be ignored... I tried with a fresh svn co of rel 5427. Any comments? sandro *:-) -- Sandro Dentella *:-) e-mail: [EMAIL PROTECTED] http://www.tksql.orgTkSQL Home page - My GPL work --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
any django users in Cuba?
there is any django users in Cuba or just a cuban user? -- Lic. José M. Rodriguez Bacallao Cupet --~--~-~--~~~---~--~~ 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 meetup in Munich
Hi devs in Munich, we are a team of a couple django users and would be interested in meeting up with other django/python/webX.X devs from around Munich (Germany). So lets meet next thursday 14th June 2007, at 20:00 lets say there: http://tinyurl.com/36l4yf Max Emanuel Brauerei, Adalbertstr. 33 They have a nice beer garden :-) if we have good weather -- cu Wolfram --~--~-~--~~~---~--~~ 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: "Powered by Django" directory - Designer Wanted!
Hi Ross, i read your blog posts with great interest. Very helpful stuff. The idea for a djangopowered sites replacement is also great. Looking at happycodr that seems to be quite simple and fast done. I´ll send you some screenshots later today of what i would do. I have a design laying around which I currently don´t use anymore because the site for this design went down. Its quite similar to the idea from happycodr, so i could rework this for your project if you like it. Just let me know. :) On 5 Jun., 08:35, Ross Poulton <[EMAIL PROTECTED]> wrote: > Anybody have any interest or other feedback? --~--~-~--~~~---~--~~ 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: strange template-rendering with \xef\xbb\xbf
Am 05.06.2007 um 16:38 schrieb Malcolm Tredinnick: > > On Tue, 2007-06-05 at 16:10 +0200, va:patrick.kranzlmueller wrote: >> after doing a django-update yesterday, we have \xef\xbb\xbf at the >> beginning of every rendered template which leads to strange display >> errors in IE and older firefox-versions. >> >> I figured out that it´s a byte order mark (BOM), but I´m not sure how >> to avoid it ... > > Nothing in Django has changed recently that would do that (it would > have > had to be something in the template/ directory). > > How long since you last did a Django update? I guess it´s been a month ... > > What else might have changed? It sounds like the template files are > now > being loaded as UTF-16 data from disk. Is that possible? If so, you'll > have to re-encode them yourself (or switch to using the unicode branch > which handles different file encoding from output encoding). this might be a stupid question, but how can I check the file- encoding using the shell? thanks, patrick > > Regards, > Malcolm > > > > > --~--~-~--~~~---~--~~ 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: proper and easy way to urlencode unicode string?
MT> Have a look at the iriencode filter (only in the unicode branch, so MT> you'll need to read docs/templates.txt from the source). This handles MT> the last stage of encoding to ASCII. Thanks for pointer. MT> You cannot necessarily skip the urlencode portion, but you may be able MT> to. The reason is that the IRI -> URI conversion algorithm does _not_ MT> encode things like '%', so it is safe to apply to something that has MT> already been partially encoded. However, if your proto-URL string MT> contains a '%' that should be encoded (e.g. "100%-guaranteed"), you will MT> need to pass it through urlencode first. MT> So {{ tagname|urlencode|iriencode }} is completely safe, although MT> possibly redundant (and even incorrect if tagname was something that had MT> already been URL encoded). Well, I think here you've missed the point. Python fails *before* iriencode - during urlencode. Check the traceback again: > {{ tagname|urlencode }} > > But when the 'tagname' contains non-ascii symbols, urlencode barfs: > > KeyError at / > u'\u0420' > Request Method: GET > Request URL: http://localhost:8088/ > Exception Type: KeyError > Exception Value: u'\u0420' > Exception Location: /usr/lib/python2.4/urllib.py in quote, line 1117 > Template error MT> You might also want to read the section call "URI and IRI handling" in MT> docs/unicode.txt because urllib.quote() is not the most bullet-proof MT> choice when working with unicode strings. Reading your email, I just MT> realised I have forgotten to mention the urlencode and iriencode filters MT> in that section, but that will be fixed when I next sit down to commit MT> bug fixes. Yes, I've read this document (again) but {{ tagname | urlencode | iriencode }} won't work due to the same error. -- Andrey V Khavryuchenko http://www.kds.com.ua --~--~-~--~~~---~--~~ 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: strange template-rendering with \xef\xbb\xbf
On Tue, 2007-06-05 at 16:10 +0200, va:patrick.kranzlmueller wrote: > after doing a django-update yesterday, we have \xef\xbb\xbf at the > beginning of every rendered template which leads to strange display > errors in IE and older firefox-versions. > > I figured out that it´s a byte order mark (BOM), but I´m not sure how > to avoid it ... Nothing in Django has changed recently that would do that (it would have had to be something in the template/ directory). How long since you last did a Django update? What else might have changed? It sounds like the template files are now being loaded as UTF-16 data from disk. Is that possible? If so, you'll have to re-encode them yourself (or switch to using the unicode branch which handles different file encoding from output encoding). Regards, Malcolm --~--~-~--~~~---~--~~ 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: noob minlength question
> seems silly but how do I specify minimum length for a > CharField. Would that require customer validation? I suspect you just want a custom validator in your validator_list...something like def is_longer_than(n): def result(field_data, all_data): if len(field_data) <= n: raise django.core.validators.CriticalValidationError, \ 'Must be more than %i character(s)' % n return result class Whatever(Model): myfield = CharField(... validator_list = [is_longer_than(10)], ) -tim --~--~-~--~~~---~--~~ 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 users in Turkey
Hi, Are there any Turkish speaking Django enthusiasts in this group? I would like to invite them to a group I have just created: http://groups.google.com/group/django-tr This group will be dedicated to making Django known better in Turkey and help spread its usage among Turkish speaking developers by providing references and a basis for discussion. Thanks... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
strange template-rendering with \xef\xbb\xbf
after doing a django-update yesterday, we have \xef\xbb\xbf at the beginning of every rendered template which leads to strange display errors in IE and older firefox-versions. I figured out that it´s a byte order mark (BOM), but I´m not sure how to avoid it ... patrick --~--~-~--~~~---~--~~ 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: problems using django on lighttpd with fastcig
> It is in the fastcgi Django docs > (http://www.djangoproject.com/documentation/fastcgi/), although I've > heard similar things said about PHP+Fastcgi. When I did my setup ~8 months ago, I discovered the module load order from the Lighttpd docs about the 'server.modules()' directive: http://trac.lighttpd.net/trac/wiki/server.modulesDetails. > But not after mod_accesslog. Yup. I thought I posted a response yesterday to this effect, but I guess it didn't take. However, in my setup 'mod_accesslog' is first, and it hasn't caused any problems (in fact, I think I had problems with it being last -- I'll have to see if I can reproduce this). I think its a recommendation rather than a hard requirement, whereas placing mod_fcgi before mod_auth would cause problems. Regards, -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: "Powered by Django" directory - Designer Wanted!
Sadly also not an offer for help (directly at least), but you might check out http://www.oswd.org Open Source Web Design. Lots of good site templates there that are typically standards based and look quite nice. -justin On 6/5/07, Ross Poulton <[EMAIL PROTECTED]> wrote: > > > Hi all, > > I've been using Django for quite a while now, some of you may know my > name from occasional blog posts on the Django community aggregator. > > I've been working on a website to showcase websites that are Powered > by Django. In a similar vein to djangosnippets.org the site lets > people sign up, submit sites, tag them, leave comments, etc etc. > Screenshots are automatically grabbed for each site, and everything is > displayed nicely. As much as I don't wish to compare or be seen to > copy, this is somewhat similar to the RoR camps HappyCodr > (www.happycodr.com) > > I see this being a 'replacement' for the DjangoPoweredSites wiki page, > which is growing and becoming less useful every day (IMO). > > The site is basically all working nicely now, but I'm no good at the > graphics side of things. I'm currently using a template from > www.freecsstemplates.com but my hacking away has made it look like > ass :) > > Is anybody interested in volunteering a few hours time for this > project? I would assume in the vein of other django community sites > it'd stay ad-free, I'm happy to host and maintain it, with links to > the designers website. > > Anybody have any interest or other feedback? > > Ross > > > > > -- Justin Lilly University of South Carolina --~--~-~--~~~---~--~~ 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, manytomany, default value.
> I'm not sure what "a patch in the development tree" means here. Current > subversion trunk doesn't seem to have anything like that. Sorry for not being clear -- I'm (obviously) not familiar with the mechanism of open source / django development. What I was referring to is the ticket you mentioned (4001) and the "patch" is the file attached to that ticket (save_instance_m2m.patch). > Remember that the situation where a form maps precisely onto a model is > a very specialised case. In the general case, you need to build the > objects you are going to save manually anyway (since one form provides > information for many models). So the workaround that springs to mind in > this case is to forget about using form_for_model() and just build the > form by hand and construct the save objects in your view. It's only a > few lines of code. That sounds great (in fact, I was forced to combine two tables into one in order to coerce the data into something that can be easily used by form_for_model). However, I'm not sure where to start to come to grips with the concepts of "objects you are going to save", "build the form by hand", and "construct the save objects". I'm guessing that this means instantiating models, creating the form bound to data from several different model classes, then (on POST) instantiating new model instances, somehow unpacking the data from the form into the appropriate model classes, and saving the instances. If you can direct me to a simple example of a view that does this (including a many-to-many field in one of the models if such a field requires any special handling in the view) it would be greatly appreciated. I guess my three sticking points are 1) how to create a form from _several_ objects, 2) how to create the form from several _models_ when the user is trying to add new information and 3) how to instantiate the multiple save objects from the POSTed form. Many thanks for your kind assistance in what I know must be quite a simple operation. -- Larry Lustig --~--~-~--~~~---~--~~ 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: "Powered by Django" directory - Designer Wanted!
Hi Ross, Sorry, not an offer of help but a request for more info. Can you tell me what you use to do the screen grabs? Regards, Dave. Ross Poulton wrote: > Hi all, > > I've been using Django for quite a while now, some of you may know my > name from occasional blog posts on the Django community aggregator. > > I've been working on a website to showcase websites that are Powered > by Django. In a similar vein to djangosnippets.org the site lets > people sign up, submit sites, tag them, leave comments, etc etc. > Screenshots are automatically grabbed for each site, and everything is > displayed nicely. As much as I don't wish to compare or be seen to > copy, this is somewhat similar to the RoR camps HappyCodr > (www.happycodr.com) > > I see this being a 'replacement' for the DjangoPoweredSites wiki page, > which is growing and becoming less useful every day (IMO). > > The site is basically all working nicely now, but I'm no good at the > graphics side of things. I'm currently using a template from > www.freecsstemplates.com but my hacking away has made it look like > ass :) > > Is anybody interested in volunteering a few hours time for this > project? I would assume in the vein of other django community sites > it'd stay ad-free, I'm happy to host and maintain it, with links to > the designers website. > > Anybody have any interest or other feedback? > > Ross > > > > > --~--~-~--~~~---~--~~ 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: Import, save and render issue?
On Tue, 2007-06-05 at 06:05 -0700, jj wrote: > I have added a feature to my Django app which allows me to import data > from an external database. The data is in XML. I iterate over the XML > to import book descriptions. After each book is processed, I save() > it. Then I call render_response() to display the list of books just > imported. > > However, the list has holes, i.e. not all fields are displayed. If I > refresh the page, all book fields are now displayed. So they were > there previously and some background process has now completed. > > # view > def import_xml(request): > if request.method == 'POST': > post_data = request.POST.copy() > post_data.update(request.FILES) > form = forms.XmlUploadForm(post_data) > if form.is_valid(): > list, log = form.save() > return render_to_response('book_list.html', {'log': log, > 'list': list}) > form = forms.XmlUploadForm() > return home_page(request, form) > > # form.save() > def save(self): > xmldata = self.clean_data['xml_file']['content'] > xml = ElementTree.fromstring(xmldata) > return do_import_xml(xml) Everything you are doing here is single-threaded and it doesn't even query the database, as far as I can see. However, you should look closeley at the do_import_xml() function, since that is the invisible part of the code samples you have posted. Try checking the return values from the save() method very carefully to see that they match what you expect. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Import, save and render issue?
I have added a feature to my Django app which allows me to import data from an external database. The data is in XML. I iterate over the XML to import book descriptions. After each book is processed, I save() it. Then I call render_response() to display the list of books just imported. However, the list has holes, i.e. not all fields are displayed. If I refresh the page, all book fields are now displayed. So they were there previously and some background process has now completed. # view def import_xml(request): if request.method == 'POST': post_data = request.POST.copy() post_data.update(request.FILES) form = forms.XmlUploadForm(post_data) if form.is_valid(): list, log = form.save() return render_to_response('book_list.html', {'log': log, 'list': list}) form = forms.XmlUploadForm() return home_page(request, form) # form.save() def save(self): xmldata = self.clean_data['xml_file']['content'] xml = ElementTree.fromstring(xmldata) return do_import_xml(xml) The issue goes away if I rebuild the book list manually before calling render_response(): # revised view def import_xml(request): if request.method == 'POST': post_data = request.POST.copy() post_data.update(request.FILES) form = forms.XmlUploadForm(post_data) if form.is_valid(): list, log = form.save() # NEW list = Book.objects.filter(pk__in=[b.id for b in list]) # END NEW return render_to_response('book_list.html', {'log': log, 'list': list}) form = forms.XmlUploadForm() return home_page(request, form) Why the different behaviour? Am I doing anything wrong? Is there a cache concurrency issue? I use Django v0.96 and sqlite3. Both the development server and Apache+mod_py exhibit the same behaviour. I have tried using @commit_manually and @never_cache, without success. JJ. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
noob minlength question
seems silly but how do I specify minimum length for a CharField. Would that require customer validation? --~--~-~--~~~---~--~~ 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: proper and easy way to urlencode unicode string?
On Tue, 2007-06-05 at 14:34 +0300, Andrey Khavryuchenko wrote: > Folks, > > I'm working on multiligual app using unicode branch and hit an interesting > bit yesterday. > > I'm trying to present a (cyrillic) tag in url-ready form. Usually this is > solved by > > {{ tagname|urlencode }} > > But when the 'tagname' contains non-ascii symbols, urlencode barfs: > > KeyError at / > u'\u0420' > Request Method: GET > Request URL: http://localhost:8088/ > Exception Type: KeyError > Exception Value: u'\u0420' > Exception Location: /usr/lib/python2.4/urllib.py in quote, line 1117 > Template error > > My current (temporary) solution is to encode this manually, in python: > > urllib.quote(tagname.encode('utf8') > > But this is not DRY and makes me think there's a better way. > > Or it's time to add a custom filter? Have a look at the iriencode filter (only in the unicode branch, so you'll need to read docs/templates.txt from the source). This handles the last stage of encoding to ASCII. You cannot necessarily skip the urlencode portion, but you may be able to. The reason is that the IRI -> URI conversion algorithm does _not_ encode things like '%', so it is safe to apply to something that has already been partially encoded. However, if your proto-URL string contains a '%' that should be encoded (e.g. "100%-guaranteed"), you will need to pass it through urlencode first. So {{ tagname|urlencode|iriencode }} is completely safe, although possibly redundant (and even incorrect if tagname was something that had already been URL encoded). You might also want to read the section call "URI and IRI handling" in docs/unicode.txt because urllib.quote() is not the most bullet-proof choice when working with unicode strings. Reading your email, I just realised I have forgotten to mention the urlencode and iriencode filters in that section, but that will be fixed when I next sit down to commit bug fixes. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
proper and easy way to urlencode unicode string?
Folks, I'm working on multiligual app using unicode branch and hit an interesting bit yesterday. I'm trying to present a (cyrillic) tag in url-ready form. Usually this is solved by {{ tagname|urlencode }} But when the 'tagname' contains non-ascii symbols, urlencode barfs: KeyError at / u'\u0420' Request Method: GET Request URL:http://localhost:8088/ Exception Type: KeyError Exception Value:u'\u0420' Exception Location: /usr/lib/python2.4/urllib.py in quote, line 1117 Template error My current (temporary) solution is to encode this manually, in python: urllib.quote(tagname.encode('utf8') But this is not DRY and makes me think there's a better way. Or it's time to add a custom filter? -- Andrey V Khavryuchenko http://www.kds.com.ua --~--~-~--~~~---~--~~ 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: issue with ifequal in a base template
> > {% for catetory in categorylist %} > If this is a cut-and-paste of your template, here's your error. Learn to > spell "category". :-) Oh how blind was that. Of course that was the problem, thanks a lot :) After fixing that i got an "always false" instead of "always true". The debug line with the == shows "News == News", but the won't appear. I think i'm going to check for other stupid typos now. Bye Sven --~--~-~--~~~---~--~~ 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: issue with ifequal in a base template
On Tue, 2007-06-05 at 11:45 +0200, Sven Broeckling wrote: > Hi everyone, > > i use django for a small fun website, and it's really fun to create > applications with it. Now i'm stuck with a behaviour i can't > comprehend. > > I have a category list in my base template : > > --[snip]-- > {% if categorylist %} > Buckets > > > {% for catetory in categorylist %} If this is a cut-and-paste of your template, here's your error. Learn to spell "category". :-) > {% ifequal > category.name active_category %}{% endifequal %}{{ catetory.name > }}{% ifequal category.name active_category %}{% endifequal > %} > > {% endfor %} > > > {% endif %} > --[snip]-- Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
issue with ifequal in a base template
Hi everyone, i use django for a small fun website, and it's really fun to create applications with it. Now i'm stuck with a behaviour i can't comprehend. I have a category list in my base template : --[snip]-- {% if categorylist %} Buckets {% for catetory in categorylist %} {% ifequal category.name active_category %}{% endifequal %}{{ catetory.name }}{% ifequal category.name active_category %}{% endifequal %} {% endfor %} {% endif %} --[snip]-- categorylist and active_category are supplied by a context processor named categorylist : --[snip]-- def categorylist(request): active_category = None if hasattr (request, "session"): if "category" in request.session: try: active_category = Category.objects.get (pk=request.session['category']) except: active_category = None c = Category.objects.all() return { 'categorylist' : c, 'active_category' : active_category} --[snip]-- Both the category list and the active category appear in the template, and the values are right. What fails is the ifequal statement in the base template. The tags appear in the output if {{ active_category }} is None. If i choose a category the ifequal test fails even if both values are the same. Any Ideas? TIA Sven --~--~-~--~~~---~--~~ 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: Big app, big db, all users are authenticated
Thanks Marcin. I will try your ideas. --- On Mon 06/04, [EMAIL PROTECTED] < [EMAIL PROTECTED] > wrote: From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] To: django-users@googlegroups.com Date: Mon, 04 Jun 2007 09:09:30 -0700 Subject: Re: Big app, big db, all users are authenticated Hi,On Jun 4, 3:48 pm, "and_ltsk" <[EMAIL PROTECTED]> wrote:> 1. 100MB per request - is it normal?not likely. I have apache processes serving a couple of differentsites within separate python interpreters and they are all somewherein the 10-30MB memory range.Common gotcha: make sure you have DEBUG set to False, otherwise Djangostores all executed SQL queries in memory.> 2. I can't use cache because one user receives cached response for another user. Did you know any solution for authenticated cache?You can set up caching per-session, look for "vary_on_headers" and"Cookie" in the cache documentation. But that greatly increases thecache size, of course.I prefer to cache template fragments, see http://code.djangoproject.com/ticket/1065-- this way the parts that don't depend on logged-in user can becached only once for the whole site and I still can cache fragmentsper-session.> 3. While any table growing, the responses became slower to 2-10 minutes. How to avoid the big dicts or use another another solution?Make sure you have indexes in the database. Also, check yourtemplates and code for "if big_queryset" instead of "ifbig_queryset.count" -- the former pulls all the data from thequeryset, the latter does not.> For any performance tip thanks in advance.Point 3. looks like a hint there is something wrong with the way youpull data from the database. Look into the queries, perhaps there isa large number of them or some of the queries download too much data.-mk ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! --~--~-~--~~~---~--~~ 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: Big app, big db, all users are authenticated
Thanks Joseph. Middleware is very useful. --- On Mon 06/04, Joseph Heck < [EMAIL PROTECTED] > wrote: From: Joseph Heck [mailto: [EMAIL PROTECTED] To: django-users@googlegroups.com Date: Mon, 4 Jun 2007 09:41:29 -0700 Subject: Re: Big app, big db, all users are authenticated Another thing to keep an eye out for is referencing one model fromanother - when loading up the choices for something that has > 1000possible associated objects, then system will take a while to pull allthose into place. Setting "raw_admin_id" in the model will helpalleviate this, but you loose some additional functionality as aconsequence.Fundamentally, look at your queries to see how what's going on andtaking time. Maybe just a few indexes are needed, or it might help youidentify a coding mistake.I frequently use the middleware snippet athttp://www.djangosnippets.org/snippets/264/ to assist here (had aproblem with our sitemap setup over the weekend I diagnosed withthat). I didn't create that middleware originally - found it on thislist. Sorry I can't tell you who created it originally.-joeOn 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:>> Hi,>> On Jun 4, 3:48 pm, "and_ltsk" <[EMAIL PROTECTED]> wrote:> > 1. 100MB per request - is it normal?>> not likely. I have apache processes serving a couple of different> sites within separate python interpreters and they are all somewhere> in the 10-30MB memory range.>> Common gotcha: make sure you have DEBUG set to False, otherwise Django> stores all executed SQL queries in memory.>> > 2. I can't use cache because one user receives cached response for another user. Did you know any solution for authenticated cache?>> You can set up caching per-session, look for "vary_on_headers" and> "Cookie" in the cache documentation. But that greatly increases the> cache size, of course.>> I prefer to cache template fragments, see http://code.djangoproject.com/ticket/1065> -- this way the parts that don't depend on logged-in user can be> cached only once for the whole site and I still can cache fragments> per-session.>> > 3. While any table growing, the responses became slower to 2-10 minutes. How to avoid the big dicts or use another another solution?>> Make sure you have indexes in the database. Also, check your> templates and code for "if big_queryset" instead of "if> big_queryset.count" -- the former pulls all the data from the> queryset, the latter does not.>> > For any performance tip thanks in advance.>> Point 3. looks like a hint there is something wrong with the way you> pull data from the database. Look into the queries, perhaps there is> a large number of them or some of the queries download too much data.>> -mk >> ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! --~--~-~--~~~---~--~~ 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: dynamic fields in models
Cool! --~--~-~--~~~---~--~~ 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 custom field clean method
On Tue, 2007-06-05 at 07:33 +, simonbun wrote: > I'm having some trouble solving a newforms problem that other people > must have run into as well. Feel free to share solutions or > workarounds if any. > > Let's say I have a RegistrationForm that is used for registering new > users. It has the usual 'name', 'email', ... etc fields. When a new > user registers, my custom 'clean_email' method is called that checks > if the entered email address is already in use. If it is, this user > has probably already registered, so i raise a validation exception. > All this works as expected for registering new users. > > Now I want to provide the possibility for registered users to change > their data. So I create the form instance, passing the user > object's .__dict__ as data (form_for_model is not a viable solution in > my case). The form is rendered with the correct data prefilled and the > user can edit his data. The problem however, is that the emailfield is > validated again, and the validationerror is raised saying that the > email address is already in use. This time around i would need a > different clean_email method. I think you're trying to do the work at the wrong point in the process. If you want to use the same form object for creation and updating, the asertion that "email is unique" is not a property of your form. Don't check it in clean_email, because it isn't universally true. If you already have a way of differentiating between "new" and "existing", then make your main form class be the "existing" case (does not check email uniqueness) and then subclass it for "new" and all the subclass does is add the new clean_email() method. You "create a new person" view then instantiates the sub-classed version. All code is only written once; no repetition. If you want to use exactly the same for object and act differently based on whether this is a creation or an update, it sounds like you need to add an "is new" flag to the form. You may want to randomise and encrypt this slightly to avoid spoofing, but it would certainly work around your problem easily enough: have the is_new field early in the process, clean_is_new will decrypt and unscramble the value and then clean_email, which comes later, can use that value to decide how to validate. I think the first solution is probably the most straightforward, though both will work. > How do I solve this problem? I could create a subclass of my form that > overrides the clean_email method, but there must be a better way. Why do you assume this isn't a good way? Subclassing of classes is designed for *precisely* this type of use case: you want to override a small portion of the functionality. > What would solve my problem is bound newforms not validating when > rendered unless .is_valid was called or .errors was accessed in the > view. There's probably a downside to this approach that I'm not seeing > though. I don't like that idea. How can you hope to get away without validating your data in the long term, or giving the user feedback on their errors? You don't have to display the errors at rendering time if you don't want to, although it sounds a bit fragile. You can even dive in and modify Form._errors if you want to, but it doesn't seem necessary in this case. Regards, Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
newforms custom field clean method
I'm having some trouble solving a newforms problem that other people must have run into as well. Feel free to share solutions or workarounds if any. Let's say I have a RegistrationForm that is used for registering new users. It has the usual 'name', 'email', ... etc fields. When a new user registers, my custom 'clean_email' method is called that checks if the entered email address is already in use. If it is, this user has probably already registered, so i raise a validation exception. All this works as expected for registering new users. Now I want to provide the possibility for registered users to change their data. So I create the form instance, passing the user object's .__dict__ as data (form_for_model is not a viable solution in my case). The form is rendered with the correct data prefilled and the user can edit his data. The problem however, is that the emailfield is validated again, and the validationerror is raised saying that the email address is already in use. This time around i would need a different clean_email method. How do I solve this problem? I could create a subclass of my form that overrides the clean_email method, but there must be a better way. I don't think my use case is a once-off either. What would solve my problem is bound newforms not validating when rendered unless .is_valid was called or .errors was accessed in the view. There's probably a downside to this approach that I'm not seeing though. Are there previous discussions on this topic that I've missed? Thanks, Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---