Re: Tree from the model.
2008/4/11 Dmitriy Sodrianov <[EMAIL PROTECTED]>: > Is it possible to use only Django's built-in functions? Yes, but you will end up essentially re-implementing all the code in the application Alex suggested. When an application exists that helps you to do what you want, it's quite silly to go duplicating all the code. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Tree from the model.
Is it possible to use only Django's built-in functions? On 11 апр, 04:21, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Try to use this very good applicationhttp://code.google.com/p/django-mptt/. > > On Apr 10, 11:15 pm, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote: > > > Hi to all. > > > I have a model that can be described briefly as follows: > > > class Task(models.Model): > > title = models.CharField(max_length = 250) > > subtasks = models.ManyToManyField('Task', null=True, blank=True) > > > How can I build atreeof task and subtask with level greater than > > two? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
proxy sites
Hi Getting pissed off with site blocking at work and University. Here is the complete list of all the proxy servers. Enjoy !! www.proserver.co.nr --~--~-~--~~~---~--~~ 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 based full fledged forum app
I already have seen those, but never had the demo. Do you know any site which implements this Django forum app. This way I can get the overview of features used. On Apr 10, 10:23 pm, "Tane Piper" <[EMAIL PROTECTED]> wrote: > A simple browse on Django Forum would have brought you to this: > > http://djangoplugables.com/projects/django-forum/ > > > > On Thu, Apr 10, 2008 at 6:12 PM, myst3rious <[EMAIL PROTECTED]> wrote: > > > Hi, > > I am working on a Django project for Intranet. and I took a lots time > > in developing apps, just opposite to the Django philosophy of quick > > but clean development. That is completely my fault, and overtime in > > requirement analysis and application architecture design. > > Now, I need to create/integrate a good Forum application. I don't > > think it feasible to start working a new way, and neither do I respect > > reinventing the Wheel. > > I looked into google and google-code, there are some listed as Django > > based forum. But I could not find the exact what I am looking for. > > > I am looking for a full-fledged forum, something like vBulletine > > (because discussion about it rated vBulletine as best). > > I am preferring Django based app. > > Otherwise, I would go with SimpleMachineForum (SMF). So if the django- > > app for forum is not available, please tell me how to integrate the > > SMF with django (session and authetication sharing). > > Thanks a lot in advance. > > -- > Tane Piper > Blog -http://digitalspaghetti.me.uk > Skype: digitalspaghetti > > This email is: [ ] blogable [ x ] ask first [ ] private --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Admin meta ordering not case-insensitive
Hi all-- I'd like my categories to be ordered reverse alphabetically, so I've done the following: class Category (models.Model): name = models.CharField(max_length=50) slug = models.SlugField(prepopulate_from=("name",)) supercategory = models.ManyToManyField(Supercategory, blank=True, null=True, filter_interface=models.HORIZONTAL) def __unicode__(self): return self.name class Meta: verbose_name_plural = "Categories" ordering = ('-name',) class Admin: pass ...works fine, but it's not case-insensitive. From what research I've done, it looks like this is probably a Postgres (my backend database) locale issue, & fixing it would require me to backup, reinitialize, & restore my Postgres database. Please, someone, tell me there's an easier way...? --~--~-~--~~~---~--~~ 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: ModelMultipleChoiceField updating HTML choices after 2nd reload
In the __init__ method of the newforms.forms.BaseForm object, the initialized fields are copied as the fields as seen below # The base_fields class attribute is the *class-wide* definition of # fields. Because a particular *instance* of the class might want to # alter self.fields, we create self.fields here by copying base_fields. # Instances should always modify self.fields; they should not modify # self.base_fields. self.fields = deepcopy(self.base_fields) When I updated the attributes queryset like this: form.base_fields['tasks'].queryset = tasks, it was making the change to a stale copy of list. Once I changed my code to say: form.fields['tasks'].queryset = tasks, everything worked out exactly how I planned. Also, after the form has been submitted, you'll have to update the queryset again like: form = TestForm(request.POST) form.fields['tasks'].queryset = Task.objects.filter(project=project) if form.is_valid(): This way, it will validate against the same queryset that the selection was made from, otherwise, it'll throw a ValidationError On Apr 10, 1:05 pm, Justin <[EMAIL PROTECTED]> wrote: > You can also just call > > form.base_fields['tasks'].queryset = tasks > > which will do this: > > form.base_fields['tasks']._set_queryset( tasks ) > > How I found it? I actually looked at the django code. As you said in > your post, I've never seen it documented anywhere. I came across it > after I found it in a few bug reports because apparently, there were > similar issues. I posted that ticket in my first post. > > When you use this, are you having the same issues with the page > reloading without the set queryset until it's reloaded a second time? > > On Apr 10, 3:36 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote: > > > I would like to get an answer for this too. Just reading through > > Justin's code, I have figured out the solution to a problem I was > > stuck on for a few days (I am new to Django so reading and learning > > about the _set_queryset function was a godsend). > > > Also, I was wondering if someone can point me in the direction of any > > documentation which describes other *obscure* function calls like > > _set_queryset etc. I didn't see it anywhere in the main documentation > > section. Had I seen it, I probably would have saved myself a few hours > > of pulling my hair out. > > > Best, > > > ROn Wed, Apr 9, 2008 at 11:19 PM, Justin <[EMAIL PROTECTED]> wrote: > > > > I noticed when looking at some code that after setting the queryset, > > > it appears in the form. I can call ._get_queryset() or .queryset and > > > it looks updated. > > > > The problem occurs in the actual form rendered. > > > > form.as_ul() does not have the updated choices for the checkbox. I'm > > > digging through django code but still nothing. > > > > On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]> wrote: > > > > I have a form: > > > > > class TestForm(forms.Form): > > > > name = forms.CharField(max_length=128, label="Test name") > > > > tasks = forms.ModelMultipleChoiceField(required=False, > > > > label="Tasks", widget=forms.CheckboxSelectMultiple, > > > > queryset=Task.objects.none()) > > > > > The goal is to have checkboxes for a set of models easy enough. I > > > > initialize it to none because my goal is to update the queryset from > > > > within the views based on specific conditions. > > > > > Inside my views.py, I have this: > > > > > >>After clicking link to create project > > > > > tasks = Task.objects.filter(project=project) > > > > form = TestForm() > > > > form.base_fields['tasks']._set_queryset( tasks ) > > > > data = { "form": form, "project":project } > > > > return render_to_response("projects/create.html", data) > > > > > When I click a link to this page from another, the checkboxes are not > > > > there because the tasks queryset is still set to Task.objects.none(). > > > > If I hit F5 to reload, the correct tasks based on the project show > > > > up. I can hit F5 infinitely and it's correct. It's only on that > > > > first load. > > > > > More weird... I click back out to a different project page. When I > > > > click the link, I expect it to show the form with a new set of tasks > > > > based on the second project as choices. Instead of the correct > > > > choices or even none, it shows the choices from the first project. > > > > When I hit F5, it shows the correct choices. > > > > > It's almost like it's caching the previous state between forwards. > > > > > I also tried overriding __init__ in the form. It followed the exact > > > > same behavior. I'm using the most recent development version of the > > > > source. > > > > > This ticket:http://code.djangoproject.com/ticket/4787looksrelated > > > > but it seems to have been resolved. > > > > > Can I update the queryset like this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use
Tricky newforms problem
I have run into an interesting problem with newforms. I am trying to create an arbitrary number of fields on a form based on model data. This works fine. class SonglistForm(forms.Form): def __init__(self, *args, **kwargs): super(SonglistForm, self).__init__(*args, **kwargs) for song in Song.objects.all()[:100]: self.fields['song_%s' % song.id] = forms.BooleanField(label='%s (%s)' % (song.title, " & ".join([str(artist) for artist in song.artists.all()]))) The problem occurs in the template. I am trying to differentiate these fields from the other normal fields on the form for presentation purposes. I have tried assigning a custom property to each of the dynamic fields. field = forms.BooleanField(label='%s (%s)' % (song.title, " & ".join([str(artist) for artist in song.artists.all()]))) field.is_song = True self.fields['song_%s' % song.id] = field However, this custom property is not accessible in the template. How can I differentiate these dynamic fields from the others in the template (with limited access to Python code)? --~--~-~--~~~---~--~~ 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: Link that performs an action
Thanks for the replies, but I guess I didn't make myself clear enough. Counter was just as an example, I don't want an actual page counter. I guess part of my question is: Yes, I can use AJAX-y XMLHttpRequest to send info to the server in the background, but has someone done this already in django somewhere and posted code that can be plugged in? The idea is to have a view like this: def my_view(request,num=0): counter = Counter.objects.get(id=someid) counter.count += num counter.save() # setup view stuff but without specifying num in the URL or having to use a in my template. Thanks On Apr 10, 6:34 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote: > Taylor wrote: > > Does something exist so that a link on a page performs an action > > rather than just showing a view? > > For example: I have a counter saved to the db, and every time a user > > clicks the link, the counter increases by a certain number and saves. > > > without even visiting the page that the link > > is on by visiting the URL directly. > > They can only visit the page if you provide an url it. Just don't make > any url that displays page without your counter > > I don't think I understand what you want, since what I think you want is > super trivial. But... > > def my_view(request): > counter = Counter.objects.get(id=someid) > counter.count += 1 > counter.save() > # Or seehttp://www.djangoproject.com/documentation/request_response/if > you want > to use different value/counter based on what page led them to current view. > # referer is unreliable > refer = request.META.get( "HTTP_REFERER", None) > counter = Counter.objects.get(refer=refer) > counter.count += 1 > counter.save() > # do whatever to show view > > Which is not a great way of doing it (db hit every page view, fails when > you start caching results) but those don't matter unless your site is > real busy. > > another option parsing apache/nginx/whatever logs for whenever > particular url(s) where responded to. > > -- > Norman J. Harman Jr. 512 912-5939 > Technology Solutions Group, Austin American-Statesman > > ___ > Get out and about this spring with the Statesman! In print and online, > the Statesman has the area's Best Bets and recreation events. > Pick up your copy today or go to statesman.com 24/7. --~--~-~--~~~---~--~~ 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: translation Django DB-API into raw SQL
In [19]: def show_sql(query): : clauses = query._get_sql_clause() : return 'SELECT %s %s' % (', '.join(clauses[0]), clauses[1]) : In [21]: show_sql(Page.objects.all()) Out[21]: 'SELECT "main_page"."id", "main_page"."title", "main_page"."slug", "main_page"."content" FROM "main_page" ORDER BY "main_page"."id" ASC' On Apr 10, 7:10 pm, [EMAIL PROTECTED] wrote: > I need to translate django db-api query code like > modelobject.objects.all() to a raw SQL from a shell, is it possible > without using connection.queries (which is logging all SQL - i just > need one for a particular line of code) --~--~-~--~~~---~--~~ 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: app engine db backend project
On Wed, Apr 9, 2008 at 1:24 PM, binaryj <[EMAIL PROTECTED]> wrote: > > i plan to help on doing this but right now i dont have the time and a > working app account to do this. I can get you developer access on an account when you have time, just let me know off list. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
translation Django DB-API into raw SQL
I need to translate django db-api query code like modelobject.objects.all() to a raw SQL from a shell, is it possible without using connection.queries (which is logging all SQL - i just need one for a particular line of code) --~--~-~--~~~---~--~~ 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: Has anyone made an MS excel exporter in a django site yet?
lol I actually have a job that use my programming skills (lol lack of), but when I view some of your code out there, lol you guys are programming circles around me. On Apr 10, 6:53 pm, Roboto <[EMAIL PROTECTED]> wrote: > whoa! > > Lots of great answers here. Thanks for the help, I'm going to go > through all these answers one by one and figure out which is best for > me. > I won't be doing a straight dump, so it's gonna be interesting =p > > It's easy to do in C# though! But hopefully a solution listed here > will be just as painless > > Once again, thanks > > On Apr 10, 8:39 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > On Apr 10, 3:22 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > > > > yeah but the thing is XLS spreadsheets have a lot more > > > > meta-data than CVS can handle > > > > I've found the easiest way for us was to use the "XML > > > Spreadsheet" option (available via the Save As->Type drop-down in > > > at least Excel 2003 if not 2000, and readable in 2007 too). It's > > > fairly easy to reverse-engineer from an exported example, and > > > much cleaner than OOXML or pure XLS format. It's pretty easy to > > > turn into a Django template too. Most importantly for my uses, > > > it's possible to do things like keep leading zeros, which Excel > > > likes to dump from CSV/Tab files. > > > I generate OpenXML docs from within the admin app. They're fairly easy > > to store in the db as well. I do this as then I can edit them online > > and then zip them up when I need them. I'd recommend spending the time > > to get your head around OpenXML, though that does depend on whether > > you're looking for CSV+abitofmetadata or an actual Excel document. > > > Regards, > > > Felix --~--~-~--~~~---~--~~ 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: Has anyone made an MS excel exporter in a django site yet?
whoa! Lots of great answers here. Thanks for the help, I'm going to go through all these answers one by one and figure out which is best for me. I won't be doing a straight dump, so it's gonna be interesting =p It's easy to do in C# though! But hopefully a solution listed here will be just as painless Once again, thanks On Apr 10, 8:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Apr 10, 3:22 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > > > yeah but the thing is XLS spreadsheets have a lot more > > > meta-data than CVS can handle > > > I've found the easiest way for us was to use the "XML > > Spreadsheet" option (available via the Save As->Type drop-down in > > at least Excel 2003 if not 2000, and readable in 2007 too). It's > > fairly easy to reverse-engineer from an exported example, and > > much cleaner than OOXML or pure XLS format. It's pretty easy to > > turn into a Django template too. Most importantly for my uses, > > it's possible to do things like keep leading zeros, which Excel > > likes to dump from CSV/Tab files. > > I generate OpenXML docs from within the admin app. They're fairly easy > to store in the db as well. I do this as then I can edit them online > and then zip them up when I need them. I'd recommend spending the time > to get your head around OpenXML, though that does depend on whether > you're looking for CSV+abitofmetadata or an actual Excel document. > > Regards, > > Felix --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Translation problem
Hi, I'm translating an application from French to English and everything was going smoothly until I began work on a particular form. The code looks like this: # -*- coding: utf-8 -*- from django import newforms as forms from django.conf import settings from django.utils.translation import ugettext_lazy as _ from apparto.building import models class BuildingForm(forms.Form): #~ contact = forms.ChoiceField() civic_number = forms.IntegerField(label=_('Numéro')) # Other fields omitted... When I navigate to this form, I get the following: DjangoUnicodeDecodeError at /apparto/account/addbuilding/ 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in range(128). You passed in () Request Method: GET Request URL:http://127.0.0.1/apparto/account/addbuilding/ Exception Type: DjangoUnicodeDecodeError Exception Value:'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in range(128). You passed in () Exception Location: C:\Python25\Lib\site-packages\django\django\utils \encoding.py in force_unicode, line 60 Python Executable: C:\Python25\python.exe Python Version: 2.5.1 Unicode error hint The string that could not be encoded/decoded was: Num?ro I made sure all my templates had {% load i18n %} I tried to reverse the French and English strings in the .po file and recompiled: no error when I switch languages. Did I simply forget something obvious? I'm a Django noob, any help would be appreciated, -G- --~--~-~--~~~---~--~~ 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: Link that performs an action
Taylor wrote: > Does something exist so that a link on a page performs an action > rather than just showing a view? > For example: I have a counter saved to the db, and every time a user > clicks the link, the counter increases by a certain number and saves. > > > without even visiting the page that the link > is on by visiting the URL directly. They can only visit the page if you provide an url it. Just don't make any url that displays page without your counter I don't think I understand what you want, since what I think you want is super trivial. But... def my_view(request): counter = Counter.objects.get(id=someid) counter.count += 1 counter.save() # Or see http://www.djangoproject.com/documentation/request_response/ if you want to use different value/counter based on what page led them to current view. # referer is unreliable refer = request.META.get( "HTTP_REFERER", None) counter = Counter.objects.get(refer=refer) counter.count += 1 counter.save() # do whatever to show view Which is not a great way of doing it (db hit every page view, fails when you start caching results) but those don't matter unless your site is real busy. another option parsing apache/nginx/whatever logs for whenever particular url(s) where responded to. -- Norman J. Harman Jr. 512 912-5939 Technology Solutions Group, Austin American-Statesman ___ Get out and about this spring with the Statesman! In print and online, the Statesman has the area's Best Bets and recreation events. Pick up your copy today or go to statesman.com 24/7. --~--~-~--~~~---~--~~ 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: Running Django and a socket server
Hello Ralf, A possible third option would be to bypass using sockets and use something like XML-RPC instead (which can still use the same server running) and have your 'client' issue XML-RPC requests. There's a Google code project that makes this absolutely trivial through Django, http://code.google.com/p/django-xmlrpc/ Likely that you have a specific requirement for sockets though, but I'll put it out there anyway. Cheers. On Apr 11, 7:18 am, Ralf Kistner <[EMAIL PROTECTED]> wrote: > > If you plan on communicating between these two types of services over > > TCP sockets, I don't see why that would be easier with option #2 than > > with option #1. Socket communication shouldn't have to care if the end > > points of the socket belong to the same process or two different > > processes. > > With option #2, communication could be done with direct method calls instead > of using TCP sockets. > > Anyway, I think I'll stick with option #1. > > Thanks, > Ralf --~--~-~--~~~---~--~~ 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: Tree from the model.
Try to use this very good application http://code.google.com/p/django-mptt/. On Apr 10, 11:15 pm, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote: > Hi to all. > > I have a model that can be described briefly as follows: > > class Task(models.Model): > title = models.CharField(max_length = 250) > subtasks = models.ManyToManyField('Task', null=True, blank=True) > > How can I build a tree of task and subtask with level greater than > two? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Get timestamp of when a page was added to the cache? (And delete it from the cache?)
Is it possible to get the timestamp of a page cached using the @cache_page decorator (decorating a view)? I'd like to display 'Last updated: %s' on the cached page, and provide an "Update now" link (that would delete it from the cache). -- Daryl Spitzer --~--~-~--~~~---~--~~ 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: Running Django and a socket server
> > If you plan on communicating between these two types of services over > TCP sockets, I don't see why that would be easier with option #2 than > with option #1. Socket communication shouldn't have to care if the end > points of the socket belong to the same process or two different > processes. > With option #2, communication could be done with direct method calls instead of using TCP sockets. Anyway, I think I'll stick with option #1. Thanks, Ralf --~--~-~--~~~---~--~~ 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: Link that performs an action
Look into AJAX On Thu, Apr 10, 2008 at 5:09 PM, Taylor <[EMAIL PROTECTED]> wrote: > > Does something exist so that a link on a page performs an action > rather than just showing a view? > For example: I have a counter saved to the db, and every time a user > clicks the link, the counter increases by a certain number and saves. > > I know that I could create a URL that takes in a parameter and update > the counter in the view, so the link points to /count/3 and the view > then updates the counter by 3. This is a bad solution because the > counter would update even if the user refreshes the page, and the user > could update the counter without even visiting the page that the link > is on by visiting the URL directly. > > It seems that the other option I can find is to make every link into a > POST form and include a hidden control that contains the number I want > to update by. However, if the page has 12 links on it, all with > different numbers, this means that it would have at least 12 forms and > it isn't as elegant to wrap all of these links in forms and deal with > the javascript hoops that allow a link to submit a form. > > While the second option works, I'm hoping there's something better out > there. Maybe an add-on or application or something I can import or > look at the code. Does anyone know of anything that does this? > > I realize that this isn't natively supported by HTTP so it isn't easy > since it would probably require some background javascript and > HttpRequest magic or something, but I was wondering if anyone has > solved this problem. > > If not, I think this would be a great addition to django. Many > frameworks are adding things like this, and I would gladly fill out a > ticket requesting this. > > Thanks a bunch, > Taylor > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Link that performs an action
Does something exist so that a link on a page performs an action rather than just showing a view? For example: I have a counter saved to the db, and every time a user clicks the link, the counter increases by a certain number and saves. I know that I could create a URL that takes in a parameter and update the counter in the view, so the link points to /count/3 and the view then updates the counter by 3. This is a bad solution because the counter would update even if the user refreshes the page, and the user could update the counter without even visiting the page that the link is on by visiting the URL directly. It seems that the other option I can find is to make every link into a POST form and include a hidden control that contains the number I want to update by. However, if the page has 12 links on it, all with different numbers, this means that it would have at least 12 forms and it isn't as elegant to wrap all of these links in forms and deal with the javascript hoops that allow a link to submit a form. While the second option works, I'm hoping there's something better out there. Maybe an add-on or application or something I can import or look at the code. Does anyone know of anything that does this? I realize that this isn't natively supported by HTTP so it isn't easy since it would probably require some background javascript and HttpRequest magic or something, but I was wondering if anyone has solved this problem. If not, I think this would be a great addition to django. Many frameworks are adding things like this, and I would gladly fill out a ticket requesting this. Thanks a bunch, Taylor --~--~-~--~~~---~--~~ 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: order_by on foreign key not working
On Apr 10, 1:40 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Apr 10, 3:58 pm, Mojave <[EMAIL PROTECTED]> wrote: > > > > > Given: > > > class Topic(models.Model): > > title = models.CharField(maxlength=200) > > link = models.CharField(maxlength=200) > > > class Item(models.Model): > > topic = models.ForeignKey(Topic) > > user = models.ForeignKey(User) > > > I want to get a list of Items ordered by the title of their Topic: > > > item_list = Item.objects.order_by('topics_topic.title') > > > That's straight out of the > > documentationhttp://www.djangoproject.com/documentation/db-api/#limiting-querysets > > but I get an exception: "Unknown table 'topics_topic' in order clause" > > I believe the query on Item objects is not joining in your > topics_topic table at all. Try: > > item_list = > Item.objects.select_related().order_by('topics_topic.title') > > -Rajesh D Thanks! That did it - reading up on that method now. --~--~-~--~~~---~--~~ 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: order_by on foreign key not working
On Apr 10, 3:58 pm, Mojave <[EMAIL PROTECTED]> wrote: > Given: > > class Topic(models.Model): > title = models.CharField(maxlength=200) > link = models.CharField(maxlength=200) > > class Item(models.Model): > topic = models.ForeignKey(Topic) > user = models.ForeignKey(User) > > I want to get a list of Items ordered by the title of their Topic: > > item_list = Item.objects.order_by('topics_topic.title') > > That's straight out of the > documentationhttp://www.djangoproject.com/documentation/db-api/#limiting-querysets > but I get an exception: "Unknown table 'topics_topic' in order clause" I believe the query on Item objects is not joining in your topics_topic table at all. Try: item_list = Item.objects.select_related().order_by('topics_topic.title') -Rajesh D --~--~-~--~~~---~--~~ 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: extra_context and DoesNotExist exception
Okay, solved this. It was the offending latest(). I thought it returned a QuerySet, but I was badly mistaken. I don't even know how I got the idea... :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
order_by on foreign key not working
Given: class Topic(models.Model): title = models.CharField(maxlength=200) link = models.CharField(maxlength=200) class Item(models.Model): topic = models.ForeignKey(Topic) user = models.ForeignKey(User) I want to get a list of Items ordered by the title of their Topic: item_list = Item.objects.order_by('topics_topic.title') That's straight out of the documentation http://www.djangoproject.com/documentation/db-api/#limiting-querysets but I get an exception: "Unknown table 'topics_topic' in order clause" What am I doing wrong? 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: How to get detailed tracebacks if DEBUG=False?
> > If you enter a valid email address in the ADMINS tuple of your > settings.py, any tracebacks will be emailed to you. > -- Yes, sorry, I should have been clearer. I'm not having a problem getting the tracebacks by email, but they contain much less data than the traceback screens do with DEBUG=True. I have since found a snippet at: http://www.djangosnippets.org/snippets/631/ that's labeled "more informative error emails." I will give that a try. --~--~-~--~~~---~--~~ 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 Django with appengine - Port of the django tutorial for appengine
shabda wrote: > I have tried to write a Django tutorial for Appengine. > A live install of this can be seen at http://blogango.appspot.com I get a 403 Forbidden when I try to vote... Kent --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
http://ccpdz.sarl.tk
http://ccpdz.sarl.tk --~--~-~--~~~---~--~~ 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: How to get detailed tracebacks if DEBUG=False?
On 10 Apr, 20:03, "Hancock, David (dhancock)" <[EMAIL PROTECTED]> wrote: > We've got a Django system deployed, and we set DEBUG=False in the settings > file. What I'd still like to be able to do, though, is get the full > traceback for viewing if needed. (The one that shows up with DEBUG=True.) > > The expandible/collapsible parts, local variables, etc., are helpful for > troubleshooting, but I don't want the whole world to see them, of course. In > another framework we use (Webware for Python), the fancy tracebacks get > saved to disk, and we can view them securely. > > Do I need (to write) special middleware for this? Is there a solution I'm > overlooking? > > Cheers! > -- > David Hancock | [EMAIL PROTECTED] If you enter a valid email address in the ADMINS tuple of your settings.py, any tracebacks will be emailed to you. -- DR. --~--~-~--~~~---~--~~ 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: How to get detailed tracebacks if DEBUG=False?
I believe that the last e-mail was spam. Anyway django can send you an email whenever there is an error: http://www.djangoproject.com/documentation/settings/#error-reporting-via-e-mailThis is very helpful. Of course you need all the settings set up right and an e-mail server on your server or elsewhere. I also seem to remember a django snippet middleware not too long ago that took those errors and wrote them to a file if you didn't/couldn't want the email. I can't seem to find it right now though. Hope that helps, Michael On Thu, Apr 10, 2008 at 3:05 PM, mustapha aymen <[EMAIL PROTECTED]> wrote: > http://ccpdz.sarl.tk > > 2008/4/10, Hancock, David (dhancock) <[EMAIL PROTECTED]>: > > > We've got a Django system deployed, and we set DEBUG=False in the > > settings file. What I'd still like to be able to do, though, is get the full > > traceback for viewing if needed. (The one that shows up with DEBUG=True.) > > > > The expandible/collapsible parts, local variables, etc., are helpful for > > troubleshooting, but I don't want the whole world to see them, of course. In > > another framework we use (Webware for Python), the fancy tracebacks get > > saved to disk, and we can view them securely. > > > > Do I need (to write) special middleware for this? Is there a solution > > I'm overlooking? > > > > Cheers! > > -- > > David Hancock | [EMAIL PROTECTED] > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
salam
salut --~--~-~--~~~---~--~~ 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: Tree from the model.
http://membres.lycos.fr/ccpfordz --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tree from the model.
Hi to all. I have a model that can be described briefly as follows: class Task(models.Model): title = models.CharField(max_length = 250) subtasks = models.ManyToManyField('Task', null=True, blank=True) How can I build a tree of task and subtask with level greater than two? --~--~-~--~~~---~--~~ 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: How to get detailed tracebacks if DEBUG=False?
http://ccpdz.sarl.tk 2008/4/10, Hancock, David (dhancock) <[EMAIL PROTECTED]>: > > We've got a Django system deployed, and we set DEBUG=False in the settings > file. What I'd still like to be able to do, though, is get the full > traceback for viewing if needed. (The one that shows up with DEBUG=True.) > > The expandible/collapsible parts, local variables, etc., are helpful for > troubleshooting, but I don't want the whole world to see them, of course. In > another framework we use (Webware for Python), the fancy tracebacks get > saved to disk, and we can view them securely. > > Do I need (to write) special middleware for this? Is there a solution I'm > overlooking? > > Cheers! > -- > David Hancock | [EMAIL PROTECTED] > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to get detailed tracebacks if DEBUG=False?
We've got a Django system deployed, and we set DEBUG=False in the settings file. What I'd still like to be able to do, though, is get the full traceback for viewing if needed. (The one that shows up with DEBUG=True.) The expandible/collapsible parts, local variables, etc., are helpful for troubleshooting, but I don't want the whole world to see them, of course. In another framework we use (Webware for Python), the fancy tracebacks get saved to disk, and we can view them securely. Do I need (to write) special middleware for this? Is there a solution I'm overlooking? Cheers! -- David Hancock | [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: model with ForeignKey(User) running REALLY slow
Ahh Rajesh you are a wonderful person and a life saver. May thousands of glorious blessings come to you this day! Thanks -- matthew On Apr 10, 12:20 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Apr 10, 1:39 pm, mthorley <[EMAIL PROTECTED]> wrote: > > > Greetings, I've got a django installation with 259,535 auth_user > > records, (not that many), but the admin is running REALLY slow. > > set raw_id_admin=true wherever you have a ForeignKey to the auth User > table. > > See the description for "raw_id_admin" > here:http://www.djangoproject.com/documentation/model-api/#relationships > > -Rajesh D --~--~-~--~~~---~--~~ 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: files xls
I used xlrd to import form excel, it did everything i wanted it to do On Apr 9, 9:56 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote: > On Wed, Apr 9, 2008 at 5:44 PM, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > There's also xlrd: > > >http://www.lexicon.net/sjmachin/xlrd.htm > > XLRD seems to have had more active development. However, pyExcelerator > does both reading and writing of XLS which is nice. > > They both have their place. > > Particularly nice was some code on the pyExcelerator site that turns > an Excel sheet into a list very easily. That was a great help to me. > > /alex > > p.s. If either of these modules, or some newer module had support for > the new .xlsx files, that would be cool. Though, I guess I could just > deal with parsing the XML that Microsoft creates. :( > > > On Wed, Apr 9, 2008 at 1:23 PM, Claudio Escudero <[EMAIL PROTECTED]> wrote: > > > > Thanks, > > > > I liked it. > > > =) > > > > I did that tips for using pyExcelerator with the django > > > Http://www.developer.com/lang/other/article.php/3727616 > > > > On Wed, Apr 9, 2008 at 2:05 PM, Alex Ezell <[EMAIL PROTECTED]> wrote: > > > > > On Wed, Apr 9, 2008 at 12:02 PM, Claudio Escudero <[EMAIL PROTECTED]> > > wrote: > > > > > > Anyone knows there is a script to do with manipulation files xls > > (Excel)? > > > > > Hi Claudio, > > > > This is not Django specific, but there is a python module called > > > > pyExcelerator, that while old, seems to work for me. > > > > >http://sourceforge.net/projects/pyexcelerator > > > > > /alex > > > > -- > > > Claudio Escudero --~--~-~--~~~---~--~~ 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 + lighttpd + fastcgi = no logs and no clues
Hi Rajesh, Thanks. This was a dumb-dumb mistake I did. I think I never realized that I was using the wrong port. ( My mind turned a blind spot to this :) The whole lighttpd setup is working smoothly. Thanks, Venkat On Apr 10, 11:41 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi Venkat, > > > > > My fastcgi config is (added at the end of conf file), > > fastcgi.debug = 1 > > fastcgi.server = ( > > "/django.fcgi" => ( > > "main" => ( > > "host" => "127.0.0.1", > > "port" => 3456, > >) > > > When I request the home page like, > > links 'http://127.0.0.1:3456/' > > You shouldn't use that port number through your web browser because > you have defined it as the FCGI port which is used by lighttpd > *internally* to communicate with your Django process. In other words, > it's not an HTTP port. Just tryhttp://127.0.0.1/instead or > tryhttp://127.0.0.1:nn/where nn is the port number defined as your > lighttpd listener port (it's defined by the server.port parameter in > your lighttpd.conf) > > -Rajesh D --~--~-~--~~~---~--~~ 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 + lighttpd + fastcgi = no logs and no clues
Hi Venkat, > > My fastcgi config is (added at the end of conf file), > fastcgi.debug = 1 > fastcgi.server = ( > "/django.fcgi" => ( > "main" => ( > "host" => "127.0.0.1", > "port" => 3456, > ) > > When I request the home page like, > links 'http://127.0.0.1:3456/' You shouldn't use that port number through your web browser because you have defined it as the FCGI port which is used by lighttpd *internally* to communicate with your Django process. In other words, it's not an HTTP port. Just try http://127.0.0.1/ instead or try http://127.0.0.1:nn/ where nn is the port number defined as your lighttpd listener port (it's defined by the server.port parameter in your lighttpd.conf) -Rajesh D --~--~-~--~~~---~--~~ 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 Django with appengine - Port of the django tutorial for appengine
Oops, gave wrong link. The correct link is http://www.42topics.com/dumps/django/docs.html . That one I wrote yesterday for people who already know Django. On Apr 10, 11:35 pm, shabda <[EMAIL PROTECTED]> wrote: > I have tried to write a Django tutorial for Appengine. This can be > found herehttp://www.42topics.com/dumps/appengine/doc.html. This is a > port of the django tutorial > fromhttp://www.djangoproject.com/documentation/tutorial01/ > to use Appengine. A live install of this can be seen > athttp://blogango.appspot.com > . > This is released under a creative commons attribution, license, so > feel free to modify it. The reStructured text doc source can be found > athttp://www.42topics.com/dumps/django/docs.txt > > If you need any help with this, please ask in this thread, and I will > try to help. > > Also I would love to get you feedback about this tutorial, and how can > I make this better. --~--~-~--~~~---~--~~ 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: Running Django and a socket server
Hi, > I'm creating an application containing two interfaces: a socket server > and a web interface. Both interfaces require access to the same > database, and there will be a small amount of communication between > the two interfaces. > > I want to use Django for the web interface, as well as the ORM for the > socket server. > > I see two options for implementing this: > > 1 - Run the two interfaces as separate processes. The socket server > will import the Django code from the web interface for the ORM. Inter- > process communication can be done via sockets. > > 2 - Run both interfaces in the same process. This will require the > socket server to be started by the Django web interface. > > The first option seems like the cleaner solution. Will it cause any > concurrency issues with the ORM? > > The second option seems easier to implement (especially the > communication between the two interfaces), but I don't really like the > idea of the web server starting the socket server. > > Which option would work better? > > For the second option, what is the best way to start the socket server > from Django? The second option doesn't look clean. You are essentially providing two types of services. So you should consider running them as two separate processes (say your application requires a lot of scalability in the future: wouldn't you then want to be able to run all these services on separate boxes let alone in separate processes?) There should be no ORM concurrency issues because as it is you can run your Django app on multiple frontend servers all going to a common DB server for scalability reasons. Django's "share-nothing" architecture already supports that. Your option #1 above is similar to that arrangement where one of the frontends happens to be a different type of a server than a regular web server. If you plan on communicating between these two types of services over TCP sockets, I don't see why that would be easier with option #2 than with option #1. Socket communication shouldn't have to care if the end points of the socket belong to the same process or two different processes. Hope this helps, -Rajesh D --~--~-~--~~~---~--~~ 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 Django with appengine - Port of the django tutorial for appengine
I have tried to write a Django tutorial for Appengine. This can be found here http://www.42topics.com/dumps/appengine/doc.html. This is a port of the django tutorial from http://www.djangoproject.com/documentation/tutorial01/ to use Appengine. A live install of this can be seen at http://blogango.appspot.com . This is released under a creative commons attribution, license, so feel free to modify it. The reStructured text doc source can be found at http://www.42topics.com/dumps/django/docs.txt If you need any help with this, please ask in this thread, and I will try to help. Also I would love to get you feedback about this tutorial, and how can I make this better. --~--~-~--~~~---~--~~ 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: model with ForeignKey(User) running REALLY slow
On Apr 10, 1:39 pm, mthorley <[EMAIL PROTECTED]> wrote: > Greetings, I've got a django installation with 259,535 auth_user > records, (not that many), but the admin is running REALLY slow. set raw_id_admin=true wherever you have a ForeignKey to the auth User table. See the description for "raw_id_admin" here: http://www.djangoproject.com/documentation/model-api/#relationships -Rajesh D --~--~-~--~~~---~--~~ 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: middleware that works with Ajax
Jarek Zgoda wrote: > Chris Hoeppner napisał(a): > > >> This is new to me. Dojo will be the official js toolkit for django? >> Above jQuery? How come? >> > > No. It was stated many times: Django would not have any "official js > toolkit" and will not "be bound to" or "embrace" any single toolkit. You > are free to use the toolkit of your choice. > OK, sorry. it was something I read a few months ago and must have misunderstood. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
model with ForeignKey(User) running REALLY slow
Greetings, I've got a django installation with 259,535 auth_user records, (not that many), but the admin is running REALLY slow. The user index pulls up fast, but when I click a record to see it in detail, it takes forever and ever! In fact, I haven't been able to get an individual record to display yet (firefox starts to hang). Furthermore, every other model (e.g PersonalityProfile) that has a ForeignKey(User) exhibits the same behavior. If I comment out the ForeignKey(User) in the model, then records for that model open quickly. For whatever reason, the auth_users table is painfully slow. To test my database I tried joining the two tables. I can execute a join from auth_user to profiler_personalityprofile at the mysql prompt and get a result quickly. But again, the admin is slow. Has any one else seen this? Does any one know a possible solution? Thanks much -- matthew mysql> select count(id) from auth_user; +---+ | count(id) | +---+ |259535 | +---+ mysql> show index from auth_user; +---++--+--+- +---+-+--++--+ +-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | +---++--+--+- +---+-+--++--+ +-+ | auth_user | 0 | PRIMARY |1 | id | A | 266071 | NULL | NULL | | BTREE | | | auth_user | 0 | username |1 | username| A | 266071 | NULL | NULL | | BTREE | | +---++--+--+- +---+-+--++--+ +-+ 2 rows in set (0.00 sec) mysql> select * from auth_user u, profiler_personalityprofile p where p.creator_id = u.id order by u.id desc limit 10; ...snip... 10 rows in set (3.74 sec) --~--~-~--~~~---~--~~ 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: [OT] Django based full fledged forum app
A simple browse on Django Forum would have brought you to this: http://djangoplugables.com/projects/django-forum/ On Thu, Apr 10, 2008 at 6:12 PM, myst3rious <[EMAIL PROTECTED]> wrote: > > Hi, > I am working on a Django project for Intranet. and I took a lots time > in developing apps, just opposite to the Django philosophy of quick > but clean development. That is completely my fault, and overtime in > requirement analysis and application architecture design. > Now, I need to create/integrate a good Forum application. I don't > think it feasible to start working a new way, and neither do I respect > reinventing the Wheel. > I looked into google and google-code, there are some listed as Django > based forum. But I could not find the exact what I am looking for. > > I am looking for a full-fledged forum, something like vBulletine > (because discussion about it rated vBulletine as best). > I am preferring Django based app. > Otherwise, I would go with SimpleMachineForum (SMF). So if the django- > app for forum is not available, please tell me how to integrate the > SMF with django (session and authetication sharing). > Thanks a lot in advance. > > > -- Tane Piper Blog - http://digitalspaghetti.me.uk Skype: digitalspaghetti This email is: [ ] blogable [ x ] ask first [ ] private --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[OT] Django based full fledged forum app
Hi, I am working on a Django project for Intranet. and I took a lots time in developing apps, just opposite to the Django philosophy of quick but clean development. That is completely my fault, and overtime in requirement analysis and application architecture design. Now, I need to create/integrate a good Forum application. I don't think it feasible to start working a new way, and neither do I respect reinventing the Wheel. I looked into google and google-code, there are some listed as Django based forum. But I could not find the exact what I am looking for. I am looking for a full-fledged forum, something like vBulletine (because discussion about it rated vBulletine as best). I am preferring Django based app. Otherwise, I would go with SimpleMachineForum (SMF). So if the django- app for forum is not available, please tell me how to integrate the SMF with django (session and authetication sharing). Thanks a lot in advance. --~--~-~--~~~---~--~~ 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: ModelForm Dynamic Filter
I used a similar technique as well. Instead of adding another parameter , I used "initial=" parameters in view which is passed through **kwargs. form = NewCaseForm(initial={'my_group': data}). and my solution seems more hack than yours. But it works too. Passing through *args, bind the form and trigger the validation, so that does not work. Wish Django had better documentation. Looks like they are waiting for 1.0 to write more docs so that they do not have redo docs and the best practices. I guess I will write a e-book when I am done with my App as my token of appreciation for Django team and the support on the online forum. The django book is good but really does not add much to the online docs. Ashish On Apr 10, 9:15 am, Dan <[EMAIL PROTECTED]> wrote: > ok I seem to have been able to make it work by passing in an extra > parameter in through the __init__ is this the best solution?? even > though it works it feels like i am doing something incorrect... > > class AddMemberForm(forms.ModelForm): > def __init__(self, obj, *args, **kwargs): > super(AddMemberForm, self).__init__(*args, **kwargs) > self.fields['member'].queryset = > Member.objects.filter(userprofile=obj) > > class Meta: > model = ProductMember > exclude = ('product') > > On Apr 11, 12:29 am, Dan <[EMAIL PROTECTED]> wrote: > > > Hi > > > I am trying to create a ModelForm with a ModelChoiceField which has a > > should have a limited queryset that is filtered by the userprofile > > logged in, so far i have this: > > > class AddMemberForm(forms.ModelForm): > > member = > > forms.ModelChoiceField(Member.objects.filter(userprofile=userprofile)) > > class Meta: > > model = ProductMember > > exclude = ('product') > > > How do I go about getting the 'userprofile' varible in to this class? > > Or is there some better other way to do this? > > > Thanks in advance > > > Dan --~--~-~--~~~---~--~~ 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: ModelMultipleChoiceField updating HTML choices after 2nd reload
You can also just call form.base_fields['tasks'].queryset = tasks which will do this: form.base_fields['tasks']._set_queryset( tasks ) How I found it? I actually looked at the django code. As you said in your post, I've never seen it documented anywhere. I came across it after I found it in a few bug reports because apparently, there were similar issues. I posted that ticket in my first post. When you use this, are you having the same issues with the page reloading without the set queryset until it's reloaded a second time? On Apr 10, 3:36 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote: > I would like to get an answer for this too. Just reading through > Justin's code, I have figured out the solution to a problem I was > stuck on for a few days (I am new to Django so reading and learning > about the _set_queryset function was a godsend). > > Also, I was wondering if someone can point me in the direction of any > documentation which describes other *obscure* function calls like > _set_queryset etc. I didn't see it anywhere in the main documentation > section. Had I seen it, I probably would have saved myself a few hours > of pulling my hair out. > > Best, > > ROn Wed, Apr 9, 2008 at 11:19 PM, Justin <[EMAIL PROTECTED]> wrote: > > > I noticed when looking at some code that after setting the queryset, > > it appears in the form. I can call ._get_queryset() or .queryset and > > it looks updated. > > > The problem occurs in the actual form rendered. > > > form.as_ul() does not have the updated choices for the checkbox. I'm > > digging through django code but still nothing. > > > On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]> wrote: > > > I have a form: > > > > class TestForm(forms.Form): > > > name = forms.CharField(max_length=128, label="Test name") > > > tasks = forms.ModelMultipleChoiceField(required=False, > > > label="Tasks", widget=forms.CheckboxSelectMultiple, > > > queryset=Task.objects.none()) > > > > The goal is to have checkboxes for a set of models easy enough. I > > > initialize it to none because my goal is to update the queryset from > > > within the views based on specific conditions. > > > > Inside my views.py, I have this: > > > > >>After clicking link to create project > > > > tasks = Task.objects.filter(project=project) > > > form = TestForm() > > > form.base_fields['tasks']._set_queryset( tasks ) > > > data = { "form": form, "project":project } > > > return render_to_response("projects/create.html", data) > > > > When I click a link to this page from another, the checkboxes are not > > > there because the tasks queryset is still set to Task.objects.none(). > > > If I hit F5 to reload, the correct tasks based on the project show > > > up. I can hit F5 infinitely and it's correct. It's only on that > > > first load. > > > > More weird... I click back out to a different project page. When I > > > click the link, I expect it to show the form with a new set of tasks > > > based on the second project as choices. Instead of the correct > > > choices or even none, it shows the choices from the first project. > > > When I hit F5, it shows the correct choices. > > > > It's almost like it's caching the previous state between forwards. > > > > I also tried overriding __init__ in the form. It followed the exact > > > same behavior. I'm using the most recent development version of the > > > source. > > > > This ticket:http://code.djangoproject.com/ticket/4787looks related > > > but it seems to have been resolved. > > > > Can I update the queryset like this? --~--~-~--~~~---~--~~ 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 + lighttpd + fastcgi = no logs and no clues
I tried spawn-fcgi, doesn't work for me :( The worst part is, even wget times out, and no clue is present anywhere. I guess I will have to try Njinx. Regards, Venkat On Apr 10, 7:22 pm, Etienne Robillard <[EMAIL PROTECTED]> wrote: > On Thu, 10 Apr 2008 06:06:16 -0700 (PDT) > > > > annacoder <[EMAIL PROTECTED]> wrote: > > > Hi, > > I am trying hard to figure out why my lighttpd + fastcgi + django > > setup is not working. > > First, I have verified my django project is OK by running it with the > > local web server provided by django. > > > To setup lighttpd, I followed the setup instructions from here: > >http://wiki.slicehost.com/doku.php?id=install_django > > > and lighttpd is running as, > > /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > > > manage.py running as (started with sudo), > > python manage.py runfcgi method=prefork host=127.0.0.1 port=3456 > > pidfile=django.pid maxchildren=1 maxspare=1 outlog=/home/venkat/tmp/ > > fcgi.out errlog=/home/venkat/tmp/fcgi.err --traceback > > Have you tried using spawn-fcgi(8) ? This binary should have been installed > by lighttpd. > > Example, to start your FastCGI process on the socket 127.0.0.1:8801 (TCP/IP): > > $ spawn-fcgi -f 127.0.0.1 -p 8801 -- dispatch.fcgi > > I must also say that setting up lighttpd and Django can generates a lots > of nervosity and my affect your blood pressure quite considerably. I'd > therefore recommend > also that you consider Nginx, which works like a breeze for me. > > Etienne --~--~-~--~~~---~--~~ 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 Django-error
Nianbig schrieb: > Anyone know whats causing this error message? I get several of them > per day, now from diffrent IP-addresses. > >> Traceback (most recent call last): >> >> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", >> line 68, in get_response >>callback, callback_args, callback_kwargs = >> resolver.resolve(request.path) >> >> TypeError: unpack non-sequence I rarely get the same error :( But only, if a client request directly the dispatcher file: e.g.: Traceback with: www.domain.tld/index.fcgi no Traceback with.: www.domain.tld Any idea? -- Mfg. Jens Diemer A django powered CMS: http://www.pylucid.org --~--~-~--~~~---~--~~ 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: ModelForm Dynamic Filter
ok I seem to have been able to make it work by passing in an extra parameter in through the __init__ is this the best solution?? even though it works it feels like i am doing something incorrect... class AddMemberForm(forms.ModelForm): def __init__(self, obj, *args, **kwargs): super(AddMemberForm, self).__init__(*args, **kwargs) self.fields['member'].queryset = Member.objects.filter(userprofile=obj) class Meta: model = ProductMember exclude = ('product') On Apr 11, 12:29 am, Dan <[EMAIL PROTECTED]> wrote: > Hi > > I am trying to create a ModelForm with a ModelChoiceField which has a > should have a limited queryset that is filtered by the userprofile > logged in, so far i have this: > > class AddMemberForm(forms.ModelForm): > member = > forms.ModelChoiceField(Member.objects.filter(userprofile=userprofile)) > class Meta: > model = ProductMember > exclude = ('product') > > How do I go about getting the 'userprofile' varible in to this class? > Or is there some better other way to do this? > > Thanks in advance > > Dan --~--~-~--~~~---~--~~ 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: store user as owner automaticaly
I usually do it via JavaScript [1]. However, this only works in an environment when you trust the person editing the content (i.e. the Admin). -Mike 1: http://mike.axiak.net/media/js/admin_overrides.js --~--~-~--~~~---~--~~ 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: store user as owner automaticaly
> Whoa, > You can just overwrite save in the models and/or the form and get the person > who created the object. If you want to limit access to these models it gets > more complicated as the other users told you, but to get the original > creator just: > > class Article(models.Model): > > owner = models.ForeignKey(User, null=True, blank=True, editable=False) > > def save(self): > if not self.owner: > self.owner = request.user And how do you get access to a request instance here? > super(Article, self).save() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ModelForm Dynamic Filter
Hi I am trying to create a ModelForm with a ModelChoiceField which has a should have a limited queryset that is filtered by the userprofile logged in, so far i have this: class AddMemberForm(forms.ModelForm): member = forms.ModelChoiceField(Member.objects.filter(userprofile=userprofile)) class Meta: model = ProductMember exclude = ('product') How do I go about getting the 'userprofile' varible in to this class? Or is there some better other way to do this? Thanks in advance Dan --~--~-~--~~~---~--~~ 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: store user as owner automaticaly
Whoa, You can just overwrite save in the models and/or the form and get the person who created the object. If you want to limit access to these models it gets more complicated as the other users told you, but to get the original creator just: class Article(models.Model): owner = models.ForeignKey(User, null=True, blank=True, editable=False) def save(self): if not self.owner: self.owner = request.user super(Article, self).save() On Wed, Apr 9, 2008 at 10:15 AM, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > > Hi, > > On Apr 9, 9:46 am, Manuel Meyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > in a model Article i want to store the user who created the article. > > As Felix suggested, the newforms-admin method is the ideal/recommended > method for accomplishing this in the admin. If you can not switch to > the newforms-admin branch at the moment, there is an interim admin > solution described here: > > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser > > Be aware that it's a hack that defeats the clean separation between > your model and view/request layers. > > -Rajesh D > > > --~--~-~--~~~---~--~~ 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: OneToOneField unchangeable
On Thu, Apr 10, 2008 at 10:31 AM, Manuel Meyer <[EMAIL PROTECTED]> wrote: > > Hey, > > I have a type Article in which i hold a Type HeaderImage within an > OneToOneField-Relationship. > When adding an article via contrib.admin interface everything works > as expected. > But if I edit an existing article, the drop-down list doesn't appear > anymore. > > class Article(models.Model): > title = models.CharField(_("Full Name"), maxlength=255) > header = models.OneToOneField(HeaderImage) > > > class HeaderImage(models.Model): > picture = models.ImageField(null=True, upload_to='./ > images/',core=True) > class Admin: > pass > > What is wrong? Did I miss an option? > No, that's they way it is documented as working. The one-to-one field acts as the primary key for the model, and primary keys can't be edited. From http://www.djangoproject.com/documentation/model-api/#one-to-one-relationships : This OneToOneField will actually replace the primary key id field (since one-to-one relations share the same primary key), and will be displayed as a read-only field when you edit an object in the admin interface: Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
OneToOneField unchangeable
Hey, I have a type Article in which i hold a Type HeaderImage within an OneToOneField-Relationship. When adding an article via contrib.admin interface everything works as expected. But if I edit an existing article, the drop-down list doesn't appear anymore. class Article(models.Model): title = models.CharField(_("Full Name"), maxlength=255) header = models.OneToOneField(HeaderImage) class HeaderImage(models.Model): picture = models.ImageField(null=True, upload_to='./ images/',core=True) class Admin: pass What is wrong? Did I miss an option? Thanks, Manuel --~--~-~--~~~---~--~~ 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 when using raw_id_admin=True in ManyToManyField
On Thu, Apr 10, 2008 at 4:54 AM, firtzel <[EMAIL PROTECTED]> wrote: > > > > A few details on what "does not seems to work properly" looks like might > > help people help you. > > Thanks for your reply. You're absolutely right. Here are some more > details: > In the admin, when I try to save a catalog with more than one BadItem, > I get the following error: > > Exception Value:ERROR: IN types character varying and integer > cannot be matched SELECT "testapp_baditem"."name" FROM > "testapp_baditem" WHERE "testapp_baditem"."name" IN (12,34) > Exception Location: c:\Python25\Lib\site-packages\django\db\backends > \postgresql\base.py in execute, line 43 > > I added the djangologging application, and saw that the first > problematic SELECT is in main.change_stage, line 325. > > djangologging's relevant log output: > > SQL 11:49:35,187main.change_stage:325 SELECT " > testapp_baditem"."name" FROM "testapp_baditem" WHERE " > testapp_baditem"."name" IN (12,34) 0 ms > SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem > "."name" FROM "testapp_baditem" WHERE "testapp_baditem"." > name" IN (12,34) 0 ms > SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem > "."name" FROM "testapp_baditem"0 ms > SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem > "."name" FROM "testapp_baditem" WHERE "testapp_baditem"." > name" IN (12,34) 0 ms > > ("main" is file django/contrib/admin/views/main.py) > > This is all with django-0.96.1, although django trunk version causes > the same problems. > > I found something that may be related to this problem here: > > http://code.djangoproject.com/changeset/5647 > > The problem is, this is a bug fix in django-0.91, and the discussed > file in this changeset (/django/core/meta/__init__.py) no longer > exists. > > If there is more data that can help which I neglected, please let me > know. > > > One thing I find odd is that you decided to limit your > > CharField to only digits -- if you are going to do that, why not just > > convert it to a numeric field instead? That would make it more like the > > default primary key field, so might fix the problem. (Though I'm also > not > > sure how wise it is to be trying to use the name field as a primary key > in > > the first place.) > > When I did not limit the field to digits, and tried to add a single > BadItem to the catalog, the add form gave me this error: > "Enter only digits separated by commas." > I guess It's related to the previous problem, since the admin may > refer to these ID's as numeric instead of their real type, CharField > in this example. > > This example is indeed a bit strange, but it's a simplified version of > the original models. > OK, there seems to be an assumption in the old manipulator/validator code that raw_ids are numeric. You ran into this first when you tried to add a non-numeric raw_id and were told to enter only digits. 'Fixing' that by allowing only digits in your (character) primary key field got you past that hiccup but not much further. Next problem is when the manipulator/validator code goes to retrieve the items you have listed in your many-to-many field it constructs a query that assumes your primary key field is numeric, which it isn't, so the database raises an error. (Actually only some databases raise the error. Postgres 8.3 does, MySQL 5.0 doesn't, I didn't try any others.) I do not think this will ever be made to work with the old manipulator/validator code. Good news, maybe, is it does work OK with newforms-admin. You do not even need to limit your primary key field to only digits. (You do need to be sure not to include extraneous spaces in between your comma-separated list of ids.) One big caveat: I have no idea if this works intentionally or only by accident on newforms-admin. I do not know whether allowing non-numeric primary keys in raw_id fields is something anyone ever gave any thought to. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django + lighttpd + fastcgi = no logs and no clues
On Thu, 10 Apr 2008 06:06:16 -0700 (PDT) annacoder <[EMAIL PROTECTED]> wrote: > > Hi, > I am trying hard to figure out why my lighttpd + fastcgi + django > setup is not working. > First, I have verified my django project is OK by running it with the > local web server provided by django. > > To setup lighttpd, I followed the setup instructions from here: > http://wiki.slicehost.com/doku.php?id=install_django > > and lighttpd is running as, > /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > > manage.py running as (started with sudo), > python manage.py runfcgi method=prefork host=127.0.0.1 port=3456 > pidfile=django.pid maxchildren=1 maxspare=1 outlog=/home/venkat/tmp/ > fcgi.out errlog=/home/venkat/tmp/fcgi.err --traceback Have you tried using spawn-fcgi(8) ? This binary should have been installed by lighttpd. Example, to start your FastCGI process on the socket 127.0.0.1:8801 (TCP/IP): $ spawn-fcgi -f 127.0.0.1 -p 8801 -- dispatch.fcgi I must also say that setting up lighttpd and Django can generates a lots of nervosity and my affect your blood pressure quite considerably. I'd therefore recommend also that you consider Nginx, which works like a breeze for me. Etienne --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Including ForeignKey fields in the Admin search
Hi all, I want the search in the admin site to search in reverse ForeignKey related objects' text fields. I know similar issues have been brought up before but I haven't found anything that quite fits my situation. I've tried searching quite a bit and asking on #django but haven't found any answers. For example, if I have a newspaper site, where each Issue has a title, and each Article has a title and contents and may belong to just one Issue. I want searching for an Issue to return results according the the titles and contents of all Articles related to that issue. But this doesn't work. Here is the models.py I worked up to demonstrate the problem: from django.db.models import Model, CharField, ForeignKey, TextField class Issue(Model): title = CharField(max_length=255) class Admin: list_display = ('title',) search_fields = ('title', 'article_set__contents') class Article(Model): issue = ForeignKey('Issue', null=True) title = CharField(max_length=255) contents = TextField() class Admin: list_display = ('title',) Please help! - Tal --~--~-~--~~~---~--~~ 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 + lighttpd + fastcgi = no logs and no clues
Hi, I am trying hard to figure out why my lighttpd + fastcgi + django setup is not working. First, I have verified my django project is OK by running it with the local web server provided by django. To setup lighttpd, I followed the setup instructions from here: http://wiki.slicehost.com/doku.php?id=install_django and lighttpd is running as, /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf manage.py running as (started with sudo), python manage.py runfcgi method=prefork host=127.0.0.1 port=3456 pidfile=django.pid maxchildren=1 maxspare=1 outlog=/home/venkat/tmp/ fcgi.out errlog=/home/venkat/tmp/fcgi.err --traceback My fastcgi config is (added at the end of conf file), fastcgi.debug = 1 fastcgi.server = ( "/django.fcgi" => ( "main" => ( "host" => "127.0.0.1", "port" => 3456, ) ), "/admin.fcgi" => ( "admin" => ( "host" => "127.0.0.1", "port" => 3457, ) ) ) url.rewrite-once = ( "^(/media.*)$" => "$1", "^/favicon\.ico$" => "/media/favicon.ico", "^(/.*)$" => "/django.fcgi$1", ) The modules part (at the top of the file): server.modules = ( "mod_access", "mod_alias", "mod_accesslog", "mod_compress", "mod_rewrite", "mod_fastcgi", # "mod_redirect", "mod_status", # "mod_evhost", # "mod_usertrack", # "mod_rrdtool", # "mod_webdav", # "mod_expire", # "mod_flv_streaming", # "mod_evasive" ) and the debug options: ## send unhandled HTTP-header headers to error-log #debug.dump-unknown-headers = "enable" debug.log-request-header = "enable" debug.log-request-header-on-error = "enable" debug.log-response-header = "enable" debug.log-file-not-found = "enable" debug.log-request-handling = "enable" debug.log-condition-handling = "enable" And lighttpd log files: ## where to send error-messages to server.errorlog= "/var/log/lighttpd/error.log" ### accesslog module accesslog.filename = "/var/log/lighttpd/access.log" Also, I had set debug=True in settings.py After all this, there is no log getting generated anywhere. (i.e. in any of the log files, .err file, .out file). When I request the home page like, links 'http://127.0.0.1:3456/' It says, 'Request Sent' and times out. I am totally clueless. Can someone help me? Thanks, Venkat --~--~-~--~~~---~--~~ 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: Two sites, one django project
CSS swapping via settings file seems like good idea. Thanks for that.. But when it comes storing messages in the database: I don't think it's feasible. By messages I mean almost all of the strings throughout the source; page titles, headers in templates, error messges that are added to user message set in views, even "verbose name"s of models. I think I'll have to use a custom template loader as mentioned above, but still in this case, I'll have to duplicate the templates between the two sites. Thank you all, for the suggestions. On Apr 10, 3:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Maybe I'm over simplyfying this ... but why not just swap out the css > file you are using based on a setting you can change in your > settings.py fileas well as modify the database you are calling in > your settings.py file, and store your messages in a table... where the > data would be different in each database? > > On Apr 10, 6:10 am, Tim Sawyer <[EMAIL PROTECTED]> wrote: > > > Came across this the other day, never used it. > > >http://code.google.com/p/django-databasetemplateloader/ > > > It seems to allow you to store templates in the database, so could this be > > used together with the sites framework to skin your sites differently? > > > Tim. > > > On Thursday 10 Apr 2008, Polat Tuzla wrote: > > > > Hi, > > > I'd like to build two sites, say, two polls sites, each having their > > > own domain name. Their functionalities are almost exactly the same. > > > They're different only by theme. By theme, I mean both the site design > > > (visual theme) and the site messages. For example one is for polls > > > about music and the other is about videos. > > > > I'd like to be able to use the same source code (i.e same django > > > project) for running both of these sites for the ease of maintenance. > > > This may be by running either a single instance of django, or two. But > > > again, I'd prefer single instance for the ease of administration. This > > > would also let me have a single sign-on functionality as a side > > > effect. > > > > The site message strings are scattered in models, views and template > > > files. I don't want to duplicate any of these codes just for the sake > > > of alternating between different messages. I tried to find a way out, > > > by using sites framework, but wasn't able to without actually > > > duplicating views and templates. > > > Another option was using i18n, and two different translation files > > > between two django instances. But this only works for languages other > > > than English, I guess. > > > > What exact way of achieving this would you suggest me? > > > I've been doing research on this for quite a long time, but really > > > could not come up with a solution. Any suggestion is greatly > > > appreciated, even those like "don't do this, duplicate the project" :) > > > 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: Has anyone made an MS excel exporter in a django site yet?
On Apr 10, 3:22 am, Tim Chase <[EMAIL PROTECTED]> wrote: > > yeah but the thing is XLS spreadsheets have a lot more > > meta-data than CVS can handle > > I've found the easiest way for us was to use the "XML > Spreadsheet" option (available via the Save As->Type drop-down in > at least Excel 2003 if not 2000, and readable in 2007 too). It's > fairly easy to reverse-engineer from an exported example, and > much cleaner than OOXML or pure XLS format. It's pretty easy to > turn into a Django template too. Most importantly for my uses, > it's possible to do things like keep leading zeros, which Excel > likes to dump from CSV/Tab files. I generate OpenXML docs from within the admin app. They're fairly easy to store in the db as well. I do this as then I can edit them online and then zip them up when I need them. I'd recommend spending the time to get your head around OpenXML, though that does depend on whether you're looking for CSV+abitofmetadata or an actual Excel document. Regards, Felix --~--~-~--~~~---~--~~ 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: Two sites, one django project
Maybe I'm over simplyfying this ... but why not just swap out the css file you are using based on a setting you can change in your settings.py fileas well as modify the database you are calling in your settings.py file, and store your messages in a table... where the data would be different in each database? On Apr 10, 6:10 am, Tim Sawyer <[EMAIL PROTECTED]> wrote: > Came across this the other day, never used it. > > http://code.google.com/p/django-databasetemplateloader/ > > It seems to allow you to store templates in the database, so could this be > used together with the sites framework to skin your sites differently? > > Tim. > > On Thursday 10 Apr 2008, Polat Tuzla wrote: > > > Hi, > > I'd like to build two sites, say, two polls sites, each having their > > own domain name. Their functionalities are almost exactly the same. > > They're different only by theme. By theme, I mean both the site design > > (visual theme) and the site messages. For example one is for polls > > about music and the other is about videos. > > > I'd like to be able to use the same source code (i.e same django > > project) for running both of these sites for the ease of maintenance. > > This may be by running either a single instance of django, or two. But > > again, I'd prefer single instance for the ease of administration. This > > would also let me have a single sign-on functionality as a side > > effect. > > > The site message strings are scattered in models, views and template > > files. I don't want to duplicate any of these codes just for the sake > > of alternating between different messages. I tried to find a way out, > > by using sites framework, but wasn't able to without actually > > duplicating views and templates. > > Another option was using i18n, and two different translation files > > between two django instances. But this only works for languages other > > than English, I guess. > > > What exact way of achieving this would you suggest me? > > I've been doing research on this for quite a long time, but really > > could not come up with a solution. Any suggestion is greatly > > appreciated, even those like "don't do this, duplicate the project" :) > > 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 -~--~~~~--~~--~--~---
Running Django and a socket server
Hi, I'm creating an application containing two interfaces: a socket server and a web interface. Both interfaces require access to the same database, and there will be a small amount of communication between the two interfaces. I want to use Django for the web interface, as well as the ORM for the socket server. I see two options for implementing this: 1 - Run the two interfaces as separate processes. The socket server will import the Django code from the web interface for the ORM. Inter- process communication can be done via sockets. 2 - Run both interfaces in the same process. This will require the socket server to be started by the Django web interface. The first option seems like the cleaner solution. Will it cause any concurrency issues with the ORM? The second option seems easier to implement (especially the communication between the two interfaces), but I don't really like the idea of the web server starting the socket server. Which option would work better? For the second option, what is the best way to start the socket server from Django? Regards, Ralf Kistner --~--~-~--~~~---~--~~ 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: Google App Engine & Django
There's something that I don't really grasp about appengine models. I see the similarities between them and django models, tho Django knows where to look for them, and thus knows how to manage those classes. Appengine has it's own stuff, and at the bottom of the django page it's said that you don't need to run manage.py to setup the models. How does this work then? Am I to write the models (in appengine-slang) and just place them were I used to place django models? It really makes no difference beside the import phrase if you place them elsewhere, assumedly, but perhaps AE is just looking elsewhere or uses some discovery system we should be aware of? I haven't (yet! still browsing) seen any reference to this. Okay, anything built on django models won't work. I don't care. I don't use the admin interface but in the *very* early stages, as scaffolding, and then build my own admin usually. And if AE provides consistent user auth, there I have all I need to get building on AE and scrap hosting headaches from my todo list. I recon, it's early. Beta. Probably oob (out of beta) very soon (tm). Like a couple years. But I'm in to start and get the hang of it. If everything rolls, it's on to get The Standard Django Hoster for ages. And even if it's non-free, if it once-and-forever takes the hassle of setting up some hosting for django out of my life, I'll pay them in gold bars! I will continue traversing the docs and share anything I discover (tho I'm sure not the first one, even from us on the list). And if you happen to get one of those you-gotta-wait accounts, and have the valour to try and get django up and running, please share the joy. ~ Chris El mar, 08-04-2008 a las 05:16 -0700, Marc Garcia escribió: > Well, it seems that you just need to migrate your django models to > appengine models. Anyway, I think that there is an important day for > django. I haven't enought time to check it all, but I think in a close > future we'll be able to run our django 1.0 projects on google > infrastructure. > > For know I think that it's too early to migrate, because probably > isn't a very mature project, and specially because it's working on > django 0.96 (and most django users use trunk or sometimes newforms- > admin, like me). > > Marc > > On Apr 8, 1:31 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > > On Tue, Apr 8, 2008 at 2:28 AM, Ramin Firoozye <[EMAIL PROTECTED]> wrote: > > > Caveat: there's a waiting list for signing up. > > > > Another caveat, according to that same page you linked: > > > > "Since App Engine does not support Django models, leave all DATABASE_* > > settings set to an empty string. The authentication and admin > > middleware and apps should be disabled since they require Django > > models. The functionality these provide is covered by the App Engine > > Users API and Admin Console respectively. Sessions also depend on > > Django models and must be disabled as well." > > > > Without models, the vast majority of Django apps won't run at all. > > > > -Gul > > --~--~-~--~~~---~--~~ 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: extra_context and DoesNotExist exception
Here's the custom manager code. I didn't have the latest version with me, so I try to recreate the get_hot() method below. class PublishedManager(models.Manager): def get_query_set(self): return super(PublishedManager, self).get_query_set().filter(published=True).filter(category__published=True) def get_hot(self): return self.get_query_set().filter(is_hot=True).latest('published_on') Now, I'm not sure if this was the code that returns the DoesNotExist exception, but the get_query_set() function definitely returns the same exception if there are no news items flagged as published (or if there are no news items in the DB at all). Here's how I use the custom manager: class Post(models.Model): objects = models.Manager() pub_objects = PublishedManager() # filters initial Qset to include only When I call the get_query_set() via Post.pub_objects.all(), the DoesNotExist is returned if there are no matching posts, and this shows up in the template, so I guess the same will happen if I do Post.pub_objects.get_hot(). The former problem is not important because there will always be news in the DB, but the latter is not okay since there may not be hot items at least for some time after the site is launched. The extra_context part of the URLconf looks like this: common_ec = { 'category_list': models.PostCategory.pub_objects.all(), # DoesNotExist if no posts with published = True 'latest_post_list': models.Post.pub_objects.get_latest(), 'best_rated_post_list': models.Post.pub_objects.get_best_rated(), 'most_viewed_post_list': models.Post.pub_objects.get_most_viewed(), 'hottest_post_list': models.Post.pub_objects.get_hot(), # DoesNotExist if not posts with is_hot = True } I have defined the common_ec dict separately so I can reuse it in different generic view dictionaries. -- Branko --~--~-~--~~~---~--~~ 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: extra_context and DoesNotExist exception
On Apr 10, 12:38 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Can your get_hot() method (is it manager?) use filter() instead of > get()? This way you would get QuerySet. Well, it is a custom manager method that uses filter(). I just named it get_hot (which, now that you mention it, may be a bit misleading). The DoesNotExist exception is also raised when I call a generic view w/ o extra context when I have no news items in the database (this is not a ciritical bug, though). I will double-check my custom manager code to make sure it uses filter(), but I don't think that's the problem... I'll post the custom manager code here if you don't mind taking a quick look at it. -- Branko --~--~-~--~~~---~--~~ 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: prepopulate_from
On Thu, Apr 10, 2008 at 12:13 PM, Daniel Roseman <[EMAIL PROTECTED]> wrote: > > On Apr 10, 10:50 am, "Almir Karic" <[EMAIL PROTECTED]> wrote: > > i have an error caused by the following line (which worked without > > problems on regular django trunk) > > > > slug = > models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g. > > "janez_marijan_potokar_novak" (PAZI, SUMNIKI)') > > > > any ideas what am i doing wrong? > > > > If you're using newforms-admin, you should read this page carefully: > http://code.djangoproject.com/wiki/NewformsAdminBranch > The particular bit that applies to your code is the section headed > "Changed prepopulate_from to be defined in the Admin class, not > database field classes". > As described there, take the prepopulate_from attribute out of the > model definition and move it into the Admin class, so that it reads: > prepopulated_fields = {'slug': ('name',)} thanks :-) -- error: one bad user found in front of screen --~--~-~--~~~---~--~~ 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: extra_context and DoesNotExist exception
foxbunny napisał(a): > I'm trying to shove some custom query sets into extra context for > something like 5 generic view items. One of the QSs finds all news > items that are marked as 'hot' and is used to display those item (if > they exist) in a small list on any page along with whatever content is > intended for the main column. The QS can apparently return a > DoesNotExist exception instead of a query set, since there 'hot' > objects do not necessarily exist. How would I go about handling this? > > I was thinking of doing something like this in URLconf: > > def get_hot_items(): > try: > Post.objects.get_hot() > except DoesNoExist: > return [] > > and in extra_context: > > extra_context = { > > hot_news_items: get_hot_items > } > > What do you think? Is this the correct way of doing things, or there > is a shortcut / better way? (I'm not currently near my own PC so I > can't test it, but I thought I'd collect some feedback before I get a > chance to test this.) Can your get_hot() method (is it manager?) use filter() instead of get()? This way you would get QuerySet. -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
extra_context and DoesNotExist exception
I'm trying to shove some custom query sets into extra context for something like 5 generic view items. One of the QSs finds all news items that are marked as 'hot' and is used to display those item (if they exist) in a small list on any page along with whatever content is intended for the main column. The QS can apparently return a DoesNotExist exception instead of a query set, since there 'hot' objects do not necessarily exist. How would I go about handling this? I was thinking of doing something like this in URLconf: def get_hot_items(): try: Post.objects.get_hot() except DoesNoExist: return [] and in extra_context: extra_context = { hot_news_items: get_hot_items } What do you think? Is this the correct way of doing things, or there is a shortcut / better way? (I'm not currently near my own PC so I can't test it, but I thought I'd collect some feedback before I get a chance to test this.) --~--~-~--~~~---~--~~ 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: prepopulate_from
On Apr 10, 10:50 am, "Almir Karic" <[EMAIL PROTECTED]> wrote: > i have an error caused by the following line (which worked without > problems on regular django trunk) > > slug = > models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g. > "janez_marijan_potokar_novak" (PAZI, SUMNIKI)') > > any ideas what am i doing wrong? If you're using newforms-admin, you should read this page carefully: http://code.djangoproject.com/wiki/NewformsAdminBranch The particular bit that applies to your code is the section headed "Changed prepopulate_from to be defined in the Admin class, not database field classes". As described there, take the prepopulate_from attribute out of the model definition and move it into the Admin class, so that it reads: prepopulated_fields = {'slug': ('name',)} -- DR --~--~-~--~~~---~--~~ 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: Two sites, one django project
Came across this the other day, never used it. http://code.google.com/p/django-databasetemplateloader/ It seems to allow you to store templates in the database, so could this be used together with the sites framework to skin your sites differently? Tim. On Thursday 10 Apr 2008, Polat Tuzla wrote: > Hi, > I'd like to build two sites, say, two polls sites, each having their > own domain name. Their functionalities are almost exactly the same. > They're different only by theme. By theme, I mean both the site design > (visual theme) and the site messages. For example one is for polls > about music and the other is about videos. > > I'd like to be able to use the same source code (i.e same django > project) for running both of these sites for the ease of maintenance. > This may be by running either a single instance of django, or two. But > again, I'd prefer single instance for the ease of administration. This > would also let me have a single sign-on functionality as a side > effect. > > The site message strings are scattered in models, views and template > files. I don't want to duplicate any of these codes just for the sake > of alternating between different messages. I tried to find a way out, > by using sites framework, but wasn't able to without actually > duplicating views and templates. > Another option was using i18n, and two different translation files > between two django instances. But this only works for languages other > than English, I guess. > > What exact way of achieving this would you suggest me? > I've been doing research on this for quite a long time, but really > could not come up with a solution. Any suggestion is greatly > appreciated, even those like "don't do this, duplicate the project" :) > 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: Two sites, one django project
Polat Tuzla napisał(a): > I'd like to build two sites, say, two polls sites, each having their > own domain name. Their functionalities are almost exactly the same. > They're different only by theme. By theme, I mean both the site design > (visual theme) and the site messages. For example one is for polls > about music and the other is about videos. We achieved similar results using customized template loader, but this only applied to visual design. -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ 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: Two sites, one django project
On 2008-04-10, at 0312, Polat Tuzla wrote: > > Hi, > I'd like to build two sites, say, two polls sites, each having their > own domain name. Their functionalities are almost exactly the same. > They're different only by theme. > [...] > What exact way of achieving this would you suggest me? > Thanks, http://www.djangoproject.com/documentation/sites/ "Django comes with an optional "sites" framework. It's a hook for associating objects and functionality to particular Web sites, and it's a holding place for the domain names and "verbose" names of your Django-powered sites. "Use it if your single Django installation powers more than one site and you need to differentiate between those sites in some way." --~--~-~--~~~---~--~~ 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-admin] prepopulate_from
i have an error caused by the following line (which worked without problems on regular django trunk) slug = models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g. "janez_marijan_potokar_novak" (PAZI, SUMNIKI)') any ideas what am i doing wrong? Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File "/home/redduck666/django/newforms-admin/django/core/management/__init__.py", line 272, in execute_manager utility.execute() File "/home/redduck666/django/newforms-admin/django/core/management/__init__.py", line 219, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/redduck666/django/newforms-admin/django/core/management/base.py", line 72, in run_from_argv self.execute(*args, **options.__dict__) File "/home/redduck666/django/newforms-admin/django/core/management/base.py", line 86, in execute output = self.handle(*args, **options) File "/home/redduck666/django/newforms-admin/django/core/management/base.py", line 168, in handle return self.handle_noargs(**options) File "/home/redduck666/django/newforms-admin/django/core/management/commands/validate.py", line 9, in handle_noargs self.validate(display_num_errors=True) File "/home/redduck666/django/newforms-admin/django/core/management/base.py", line 112, in validate num_errors = get_validation_errors(s, app) File "/home/redduck666/django/newforms-admin/django/core/management/validation.py", line 28, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/home/redduck666/django/newforms-admin/django/db/models/loading.py", line 126, in get_app_errors self._populate() File "/home/redduck666/django/newforms-admin/django/db/models/loading.py", line 55, in _populate self.load_app(app_name, True) File "/home/redduck666/django/newforms-admin/django/db/models/loading.py", line 70, in load_app mod = __import__(app_name, {}, {}, ['models']) File "/home/redduck666/django/varc/juno/../juno/mediaarchive/models.py", line 176, in class Author(models.Model): File "/home/redduck666/django/varc/juno/../juno/mediaarchive/models.py", line 179, in Author slug = models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g. "janez_marijan_potokar_novak" (PAZI, SUMNIKI)') File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py", line 47, in inner func(self, *args, **kwargs) File "/home/redduck666/django/newforms-admin/django/db/models/fields/__init__.py", line 1019, in __init__ super(SlugField, self).__init__(*args, **kwargs) File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py", line 47, in inner func(self, *args, **kwargs) File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py", line 47, in inner func(self, *args, **kwargs) TypeError: __init__() got an unexpected keyword argument 'prepopulate_from' -- error: one bad user found in front of screen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
recaptcha with freecomments
Hi all, Can anyone share a code of integrating freecomments and recaptcha. I have seen that it is easy to integrate it using newforms. However, I am running into a few issues whenever I try it with the classic freecomments integration. I am talking of integrating with free_preview.html and freeform.html from the c comments inside a blog from code.djangoproject.com http://code.djangoproject.com/wiki/UsingFreeComment Ramdas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Two sites, one django project
Hi, I'd like to build two sites, say, two polls sites, each having their own domain name. Their functionalities are almost exactly the same. They're different only by theme. By theme, I mean both the site design (visual theme) and the site messages. For example one is for polls about music and the other is about videos. I'd like to be able to use the same source code (i.e same django project) for running both of these sites for the ease of maintenance. This may be by running either a single instance of django, or two. But again, I'd prefer single instance for the ease of administration. This would also let me have a single sign-on functionality as a side effect. The site message strings are scattered in models, views and template files. I don't want to duplicate any of these codes just for the sake of alternating between different messages. I tried to find a way out, by using sites framework, but wasn't able to without actually duplicating views and templates. Another option was using i18n, and two different translation files between two django instances. But this only works for languages other than English, I guess. What exact way of achieving this would you suggest me? I've been doing research on this for quite a long time, but really could not come up with a solution. Any suggestion is greatly appreciated, even those like "don't do this, duplicate the project" :) 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: Problem when using raw_id_admin=True in ManyToManyField
> A few details on what "does not seems to work properly" looks like might > help people help you. Thanks for your reply. You're absolutely right. Here are some more details: In the admin, when I try to save a catalog with more than one BadItem, I get the following error: Exception Value:ERROR: IN types character varying and integer cannot be matched SELECT "testapp_baditem"."name" FROM "testapp_baditem" WHERE "testapp_baditem"."name" IN (12,34) Exception Location: c:\Python25\Lib\site-packages\django\db\backends \postgresql\base.py in execute, line 43 I added the djangologging application, and saw that the first problematic SELECT is in main.change_stage, line 325. djangologging's relevant log output: SQL 11:49:35,187main.change_stage:325 SELECT " testapp_baditem"."name" FROM "testapp_baditem" WHERE " testapp_baditem"."name" IN (12,34) 0 ms SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem "."name" FROM "testapp_baditem" WHERE "testapp_baditem"." name" IN (12,34) 0 ms SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem "."name" FROM "testapp_baditem" 0 ms SQL 11:49:35,296pprint._safe_repr:292 SELECT "testapp_baditem "."name" FROM "testapp_baditem" WHERE "testapp_baditem"." name" IN (12,34) 0 ms ("main" is file django/contrib/admin/views/main.py) This is all with django-0.96.1, although django trunk version causes the same problems. I found something that may be related to this problem here: http://code.djangoproject.com/changeset/5647 The problem is, this is a bug fix in django-0.91, and the discussed file in this changeset (/django/core/meta/__init__.py) no longer exists. If there is more data that can help which I neglected, please let me know. > One thing I find odd is that you decided to limit your > CharField to only digits -- if you are going to do that, why not just > convert it to a numeric field instead? That would make it more like the > default primary key field, so might fix the problem. (Though I'm also not > sure how wise it is to be trying to use the name field as a primary key in > the first place.) When I did not limit the field to digits, and tried to add a single BadItem to the catalog, the add form gave me this error: "Enter only digits separated by commas." I guess It's related to the previous problem, since the admin may refer to these ID's as numeric instead of their real type, CharField in this example. This example is indeed a bit strange, but it's a simplified version of the original models. --~--~-~--~~~---~--~~ 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: Cleaning up Word's mess in text areas using tiny_mce
On 9 Apr 2008, at 5:55 pm, Rodrigo Culagovski wrote: > > Thanks for the answers. I ended up using Pilgrim & Swartz's > 'sanitize.py' [1], and adding a custom 'save' function to the classes > where I need it, like so: > > def save(self): > self.summary=util.SomeTags(self.summary,'utf8') > self.body=util.SomeTags(self.body,'utf8') > super(Entry, self).save() # Call the "real" save() method. > > "util.SomeTags" calls the sanitize code and returns the original text > with everything except some tags, like , , etc., stripped out. > > This works fine, whether on bad formatting coming from word, or > unwanted formatting done in TinyMCE (BGColor, etc.). > > 1: http://www.gnome.org/~jdub/bzr/planet/2.0/planet/sanitize.py Wow, Both of these answers look very useful - I wish I'd asked before! -- David Reynolds [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: Encoding problems prior to Django's debug system
> > Hey fellow Djangorians, > > > > I've got an encoding problem with the latest checkout of Django. I > > just upgraded, on Mac OS X, from 0.96 over to the current SVN trunk. > > The migration worked well except for the fact that when I create an > > entry with the admin interface that makes use of an Icelandic > > character (like eth; \u00F0), editing the entry will yield the > > following traceback: > > Just a short answer: Use UTF-8 whereever possible. It saved me valuable time. Encodings are really a mess. Bülent --~--~-~--~~~---~--~~ 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: accessing dom elements
> > I'm looking for the easiest way to parse xml file in Django/Python > without using dom methods like getelementbyid etc. I preffer jquery- > like syntax/selectors. Unfortunatelly I can't find that kind of > library for Python. elementtree is your friend; included with Python 2.5 file = 'my.xml' from xml.etree.ElementTree import parse tree = parse(file) print tree.getroot() http://effbot.org/zone/element-index.htm --~--~-~--~~~---~--~~ 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: paul bragiel / lefora is a spammer
Ian Holsman napisał(a): > Writing it here as lefora is written on django, and he or the developer > who wrote it for him will see it and be ashamed of themselves. > > This guy just IM'd me asking me to digg his forum software. > > I have never met the guy, and am assuming he also spammed other people > on the mailing list. and am sick of this behavior He contacted me few months ago, as his dev team is located somewhere in Poland and I am managing Python related meetups in Warsaw, PL (WARPY). We had few chats before and yesterday he asked me for the very same thing, but I did not get this as spamming. YMMV, though. -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ 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: Exceptions by mail
Marc Fargas escribió: > Simply set DEBUG=False in your settings.py, when an exception raises > django will send the traceback to the people defined in ADMINS (also in > settings.py) > > Documentation about that is: > http://www.djangoproject.com/documentation/settings/#error-reporting-via-e-mail > > > Regards, > Marc > > El jue, 10-04-2008 a las 09:46 +0200, Matias Surdi escribió: >> Hi, >> >> I've read somewhere that there is a way in django to send exceptions by >> mail. I can't remember where. >> >> Does anyone know where could I find documentation about that? >> >> >> >> Thanks a lot.That was :-) --~--~-~--~~~---~--~~ 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: Exceptions by mail
Simply set DEBUG=False in your settings.py, when an exception raises django will send the traceback to the people defined in ADMINS (also in settings.py) Documentation about that is: http://www.djangoproject.com/documentation/settings/#error-reporting-via-e-mail Regards, Marc El jue, 10-04-2008 a las 09:46 +0200, Matias Surdi escribió: > Hi, > > I've read somewhere that there is a way in django to send exceptions by > mail. I can't remember where. > > Does anyone know where could I find documentation about that? > > > --~--~-~--~~~---~--~~ > 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 > -~--~~~~--~~--~--~--- > -- http://www.marcfargas.com -- will be finished some day. signature.asc Description: Esta parte del mensaje está firmada digitalmente
Re: Application Concepts
Does anyone else think I should add a ticket request for this as a future feature? On Apr 9, 7:32 pm, Waldemar Kornewald <[EMAIL PROTECTED]> wrote: > > Most of this can be automated (scanning installed apps for media > folders, generating urlpatterns, etc.) and IMHO Django should provide > a standard mechanism to do this. > > Bye, > Waldemar Kornewald --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Exceptions by mail
Hi, I've read somewhere that there is a way in django to send exceptions by mail. I can't remember where. Does anyone know where could I find documentation about that? --~--~-~--~~~---~--~~ 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: ModelMultipleChoiceField updating HTML choices after 2nd reload
I would like to get an answer for this too. Just reading through Justin's code, I have figured out the solution to a problem I was stuck on for a few days (I am new to Django so reading and learning about the _set_queryset function was a godsend). Also, I was wondering if someone can point me in the direction of any documentation which describes other *obscure* function calls like _set_queryset etc. I didn't see it anywhere in the main documentation section. Had I seen it, I probably would have saved myself a few hours of pulling my hair out. Best, R On Wed, Apr 9, 2008 at 11:19 PM, Justin <[EMAIL PROTECTED]> wrote: > > I noticed when looking at some code that after setting the queryset, > it appears in the form. I can call ._get_queryset() or .queryset and > it looks updated. > > The problem occurs in the actual form rendered. > > form.as_ul() does not have the updated choices for the checkbox. I'm > digging through django code but still nothing. > > > > On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]> wrote: > > I have a form: > > > > class TestForm(forms.Form): > > name = forms.CharField(max_length=128, label="Test name") > > tasks = forms.ModelMultipleChoiceField(required=False, > > label="Tasks", widget=forms.CheckboxSelectMultiple, > > queryset=Task.objects.none()) > > > > The goal is to have checkboxes for a set of models easy enough. I > > initialize it to none because my goal is to update the queryset from > > within the views based on specific conditions. > > > > Inside my views.py, I have this: > > > > >>After clicking link to create project > > > > tasks = Task.objects.filter(project=project) > > form = TestForm() > > form.base_fields['tasks']._set_queryset( tasks ) > > data = { "form": form, "project":project } > > return render_to_response("projects/create.html", data) > > > > When I click a link to this page from another, the checkboxes are not > > there because the tasks queryset is still set to Task.objects.none(). > > If I hit F5 to reload, the correct tasks based on the project show > > up. I can hit F5 infinitely and it's correct. It's only on that > > first load. > > > > More weird... I click back out to a different project page. When I > > click the link, I expect it to show the form with a new set of tasks > > based on the second project as choices. Instead of the correct > > choices or even none, it shows the choices from the first project. > > When I hit F5, it shows the correct choices. > > > > It's almost like it's caching the previous state between forwards. > > > > I also tried overriding __init__ in the form. It followed the exact > > same behavior. I'm using the most recent development version of the > > source. > > > > This ticket:http://code.djangoproject.com/ticket/4787 looks related > > but it seems to have been resolved. > > > > Can I update the queryset like this? > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---