Re: time it takes django to read database?
On Tue, Dec 9, 2008 at 3:57 PM, Colin Bean <[EMAIL PROTECTED]> wrote: > Ah, didn't realize that it was showing one part of the page and not > another. Looks like the template tag in the "secondary" section > queries all of the blog post objects, while the main section uses the > "latest" variable from django.views.generic.date_based.archive_index. > According to the docs, "Objects with a date in the future are not > included (in latest) unless you set allow_future to True." > > http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-index > > Any chance the dates on your posts are set to the future? Is the date > set correctly on your server? Those were my thoughts as well. Depending on how the date gets set when storing an item in the database, and what date/time gets used when pulling it from the db, you could run into issues here. Try passing allow_future=True in with the other arguments to the dict() Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: time it takes django to read database?
On Tue, Dec 9, 2008 at 9:33 AM, garagefan <[EMAIL PROTECTED]> wrote: > > sure thing: > > from django.conf.urls.defaults import * > from mysite.blog.models import Entry > from tagging.views import tagged_object_list > > info_dict = { >'queryset': Entry.objects.filter(status=1), >'date_field': 'pub_date', > } > > urlpatterns = patterns('django.views.generic.date_based', >(r'(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? > P[-\w]+)/$', 'object_detail', dict(info_dict, > slug_field='slug',template_name='blog/detail.html')), >(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? > P[-\w]+)/$', 'object_detail', dict(info_dict, > template_name='blog/list.html')), >(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/ > $','archive_day',dict(info_dict,template_name='blog/list.html')), >(r'^(?P\d{4})/(?P[a-z]{3})/$','archive_month', > dict(info_dict, template_name='blog/list.html')), >(r'^(?P\d{4})/$','archive_year', dict(info_dict, > template_name='blog/list.html')), >(r'^$','archive_index', dict(info_dict, template_name='blog/ > list.html')), > ) Sorry, the problem I suspected isn't there, so I'm not sure what's going on. Know this though: It's not a problem with Django, esp. since the items are showing up instantaneously in some places. It just sounds like a problem in your code. Could you show the template section that takes such a long time? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: time it takes django to read database?
Could you post your urls.py file for your blog app? It's very easy to make a mistake in there that results in confusing time-related errors. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: strategy for deploying to production server
On Tue, Sep 23, 2008 at 1:22 PM, sotirac <[EMAIL PROTECTED]> wrote: > > Just trying to get a feel for what other developers are doing when > deploying to a production server. There are some differences between > my development machine and production server such as the location of > my media files, the database settings, and if I want to enable caching > or not. Right now my option is to comment out some of the code and > uncomment the other values. This is time consuming and error proned. > How do you deal with this issue of working in your development machine > and then having to deploy the same code into your production server. > > Some files I modify are the settings.py/url.py/views.py. Remember that all of these are just Python files, there's nothing special. So I usually have files called dbsettings.py and mediasettings.py, that hold all my database and media info, then I just have settings.py import them. The stuff common between environments lives in settings.py, and the custom stuff only has to live in one place. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: dumb question model-dictionary
On Mon, Sep 1, 2008 at 2:48 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote: > > So I'm finding there are multiple places where I'm needing to iterate > over the properties of a Model and I'm absolutely certain it's got to > be insanely easy to get a dictionary from a model but for the life of > me I can't figure it out, and I can't find any documentation on the > matter. > > basically I want to be able to do this: > > class Foo(models.Model): >bar = model.CharField(max_length=20) >barfoo = model.ForeignKey(Bar) > > foo = Foo.objects.get(pk=1) > foo.get_dictionary() > {'barfoo': 1, 'bar': 'bar value'} There might be a better way, but try taking a look at foo._meta._fields It does't give you exactly what you need, but the pieces are there. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Strategies for staying current with django development
Another good idea is to listen to the "This Week in Django" podcast (www.thisweekindjango.com). They cover all the major things that have happened to trunk in the last week, as well as things happening in the community, snippets they've run across, etc. It's put together really well, and fun to listen to. This is what I use to keep up to date, esp. when I have to take some time away from Django work. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Better way that _meta to alter Admin?
I'm starting to port my projects, from a version of Django before NFA. In the past, I had something like this: User._meta.admin.list_display = User._meta.admin.list_display + ('is_active',) User._meta.get_field('is_staff').help_text = u"Select this if you want this user to be able to log into the Admin site." User._meta.get_field('is_staff').verbose_name = u"Site Administrator" It seems that using inheritance in NFA, there should be a better way. I was able to replace the list_display stuff with: class MyUserAdmin(UserAdmin): pass site.register(User, MyUserAdmin) That works nicely, but I can't find the "right" way to do the _meta.get_field() stuff in NFA. Any thoughts? Thanks, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Changing 'list_display' for User
On 6/3/08, Tim <[EMAIL PROTECTED]> wrote: > > I'm looking for something similar to this and I ran across this blog: > http://www.amitu.com/blog/2007/july/django-extending-user-model/ > > Perhaps will spark your imagination. Ahh, I had forgotten about ._meta, that let me do what I needed. Thanks! Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Changing 'list_display' for User
Is there a programatic way to modify the 'list_display' value for the User model in django.contrib.auth? I really don't want to patch the Django sources, but I can't immediately see another way. Thanks, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Row-level permissions, recommendations?
On 5/6/08, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote: > > What's the state of the art for row-level permissions in Django? > I'm working on an application where I need to allow users to edit > their own personal info but nobody else's. What app, hack, patch or > branch should I use in order to be able to do this via the admin site? Going into the future, row-level permissions are going to be implemented by making use of the newforms-admin branch. At least, that's the last I heard about it. The RLP branch that exists in SVN is *WAY* out of date. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Pass extra data to a view
On 5/3/08, Mike Chambers <[EMAIL PROTECTED]> wrote: > > Could you just specify the data in the URL that you redirect to? > > mike In my case, it's a variable amount of data, a list of ids from the database. I suppose I could specify it in the URL. I've got it working with sessions now, but passing it in the URL seems more RESTful. Jay --~--~-~--~~~---~--~~ 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: Pass extra data to a view
On 5/2/08, Jay Parlar <[EMAIL PROTECTED]> wrote: > I must be missing something super obvious here, but I can't figure out > how to pass data to a new view, from the old one. > > For example, I have the following in a view: > > categories = [1,2,3] > return HttpResponseRedirect( > reverse('question-select', > > args=[position_id],kwargs={'categories':categories})) > > > A URL pattern of: > > url(r'^(?P\d+)/question-select/$', > choose_questions,kwargs={'categories':None}, name='question-select' ), > > > And a 'choose_questions' view of: > > def choose_questions(request, position_id, categories=None): > ... > > > I would *love* to have the value of 'categories' in 'choose_questions' > be [1,2,3], the value I passed to reverse(). However, this isn't > happening. What, if any, is the proper way to pass extra context to a > view like this? Wait a sec, I'm crazy, aren't I... The call to HttpResponseRedirect is just going to tell the browser to redirect to a new URL, so there's no direct calling of the view function. Oops. If anyone has a better way to do it, I'd like to hear. I guess for now I'll use sessions. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Pass extra data to a view
I must be missing something super obvious here, but I can't figure out how to pass data to a new view, from the old one. For example, I have the following in a view: categories = [1,2,3] return HttpResponseRedirect( reverse('question-select', args=[position_id],kwargs={'categories':categories})) A URL pattern of: url(r'^(?P\d+)/question-select/$', choose_questions,kwargs={'categories':None}, name='question-select' ), And a 'choose_questions' view of: def choose_questions(request, position_id, categories=None): ... I would *love* to have the value of 'categories' in 'choose_questions' be [1,2,3], the value I passed to reverse(). However, this isn't happening. What, if any, is the proper way to pass extra context to a view like this? Thanks, Jay P --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FormWizard does too much in __call__?
I'm looking at the FormWizard code, and in __call__, we have the following: for i in range(current_step): form = self.get_form(i, request.POST) if request.POST.get("hash_%d" % i, '') != self.security_hash(request, form): return self.render_hash_failure(request, i) self.process_step(request, form, i) My concern is that self.get_form() gets called everytime through. This means that our form instances are being recreated over and over again. I understand wanting to handle the case where some data has changed, but shouldn't there be some sort of cache so we don't need to keep recreating the instances? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FormWizard and process_step
I'm trying to use process_step() to dynamically add new classes to my form_list, and running into some issues. Essentially, what I want my process_step to look like is: def process_step(self, request, form, step): next_form = build_next_form(step, form) if next_form: self.form_list.append(next_form) Where build_next_form() will dynamically create classes based on the results of the previous step. My initial FormWizard is instantiated with only one class, and my goal is to add more classes as the user is progressing through the forms. The problem is that process_step is called over and over. The end result is that after I finish step 0, a new form gets added. That form is rendered, and submitted. On submission, step 0 is checked again, and that same form then gets added, again. I know *why* this is happening, and the documentation makes it clear that it *will* happen, but what I'd like, is a hint on how to avoid getting duplicate classes added. It feels like I'm going to have to start tracking state myself, eliminating some of the benefit of using FormWizard. Thanks in advance, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Application Without Source?
On Dec 10, 2007 2:43 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Or perhaps I'm reading into this too much. If I distribute the .pyc > files minus the .py files, would that work? Is this machine- > independent (IE: I "compile" the source on an x86, it'll be ok on a 64- > bit or other architecture?) Anyone who *really* wanted to get at your code could do a decent job of disassembling the .pyc files, there's not a lot going on in those. In fact, I believe there used to be a commercial service that would take .pyc files, and automatically convert them to .py And if I recall correctly, .pyc files are version dependent, machine independent, but don't quote me on 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: Anonymous Users
On 8/27/07, Darrin Thompson <[EMAIL PROTECTED]> wrote: > I'm building a real estate search. I have existing and future > competition. It's to my advantage to track a few preferences and > favorites for anonymous users before they register. > > I'm pretty sure it isn't that hard and I'm not the first to implement it. I think you just want to use sessions: http://www.djangoproject.com/documentation/sessions/ Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django hosting companies
On 8/14/07, Ian Lawrence <[EMAIL PROTECTED]> wrote: > > ola > i have said before on this list but these > http://www.webfaction.com/ > guys are awesome...i have nothing to do with them i just respect their > service and support > []'s > Ian I'll second this. Webfaction is the way to go. They're very knowledgeable about Python *and* Django, you get your own Apache process (so no FCGI to fight with). I have Django sites hosted with both DreamHost and Webfaction. While Dreamhost is pretty good, once you get it working, I recommend Webfaction. So much easier to setup, direct contact on the forums with the people who run it, it's just fantastic. Get DreamHost if you want to use all the other features it offers (they have a bunch of one-click installs), but if Django is your main concern, then go WebFaction. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: pass a template to a genric_view
On 8/14/07, Marco A. <[EMAIL PROTECTED]> wrote: > HI ! > I have this urls.py > > (r'^10/$', > 'django.views.generic.list_detail.object_list', info_dict , > {'template':'cit_list10.html'}), > > but the genericview use the standard template ... not the template in > 'cit_list10.html'. > > I doesnt find the problem > > Thanks for help ! Try this: (r'^10/$', 'django.views.generic.list_detail.object_list', dict(info_dict , {'template_name':'cit_list10.html'})), Two things changed: 1) Used dict() 2) 'template_name', not 'template' Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django built-in web server
On 8/10/07, james_027 <[EMAIL PROTECTED]> wrote: > > hi, > > Can I use the django's built in web server in an intranet enviroment > where the maximum users could be not more than 50 users? I am just > asking this for the purpose for easy deployment :). I am very newbie, > and trying to avoid apache Unless something changed recently, the built in server is *not* threaded, meaning you can only service one request at a time. Even if only 50 people have access to the server, that might start causing problems for you. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why aren't my flatpages working?
On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I dunno. Never had a problem with them before. Lemme try the subdomain > thing. Also, make sure you've got all the correct templates and everything, as described in the documentation. That's caused issues for me as well. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why aren't my flatpages working?
On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Unless it's the subdomain... I've got it set up as test.domain.com, > could that hose it? Should I just have domain.com? Not really sure :) All I know is that I've had 404s with flatpages before, and it's always because I forgot to change out the default "example.com" in Sites. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Why aren't my flatpages working?
On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > OK, I've looked over this again: > http://www.djangoproject.com/documentation/flatpages/ > > I've got > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', > 'django.middleware.doc.XViewMiddleware', > 'classic.utils.lastseen.LastSeen', > ) > > > django.contrib.flatpages is an installed app. > > I can see it in the admin, and have the URL set to /about/ > There's only one site, so it's selected. > > But when I go to /about/ I 404. Do you have the domain set properly in the Sites app? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: latest django version
Often times SVN has trouble getting through corporate firewalls, could that be the issue? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: zyons GenericForeignKey
On 6/26/07, Carl Karsten <[EMAIL PROTECTED]> wrote: > didn't grep enough: > > django/contrib/contenttypes/generic.py: > class GenericForeignKey() > > How do I 'use' generic.py ? Just change the import. There was a backwards incompatible change made to Generic keys recently, and I guess Ian Holsman hasn't yet updated Zyons to match. http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Genericrelationshavemoved Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Calling System Commands
On 6/26/07, Moses Ting <[EMAIL PROTECTED]> wrote: > > That's what I thought, but running the following command via a web > request returns lines of length 0. > > command = 'c:\path\plink -ssh [EMAIL PROTECTED] -pw password dir' > lines = os.popen(command).readlines() > > The exact command works just fine when ran from either a regular > python prompt or within the Django shell. Are you running this with the dev server, or Apache? Because with Apache, the permissions might not be there to allow it to run ssh. Or there might be some weird relation between how an Apache process/thread interacts with popen. I don't use Windows, so I'm not sure about that. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Hosting for Django
On 6/15/07, arthur debert <[EMAIL PROTECTED]> wrote: > In the end I've settle of webfaction. They have a very good setup with > you own apache instance + mod_python, and it's very affordable. Great > support as well. I'll second that. I recently deployed a customer site on Webfaction, and the experience has been pretty great. Their service really is fantastic (especially their Django forum, which is one of their most active forums). Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: SlugField
On 5/6/07, gsmith <[EMAIL PROTECTED]> wrote: > > Jay, > I've already added my SlugField. Here is a look at the table I > created > > class news(models.Model): > title = models.CharField(maxlength=200) > theslug = models.SlugField(prepopulate_from=("title")) > body = models.TextField(maxlength=2000) > > def __str__(self,): > return self.title > > class Admin: > > However, when i login to my admin and type something into my title > field nothing appears in the SlugField. I'm assuming that I need to > import some JavaScript file so that my SlugField gets auto-populated > when I enter text into the text field. Nope, no need to import anything manually. You've been bitten by a "quirk" of Python. Notice that you have this: prepopulate_from=("title") That's *almost* right. In the documentation, they show a two element tuple, ("pre_name", "name"). You only have a one element tuple. However, you did it wrong. A one element tuple in Python *has* to have a trailing comma, so it should be prepopulate_from=("title",) Alternatively, you can use a list instead of a tuple, then you don't need the comma prepopulate_from=["title"] The trailing comma in a tuple is required so Python knows whether or not you are creating a tuple, or just simply putting brackets around an expression. Hope that helps, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: SlugField
On 5/6/07, gsmith <[EMAIL PROTECTED]> wrote: > > I have a table called Stories that contains two fields 'Title' and > 'Body'. We'll I want the page to be accessed by a SlugField. I have > added a SlugField to my table. However, I want it so that whenever I > enter a title for a story in my admin then the SlugField gets auto- > populated with the contents of the title. > > So if I enter a title of 'The weather has been severe'. Then the want > the SlugField to be populated with something like 'weather-severe'. I > think I'm going to have to implement some type of JavaScript file to > accomplish this. Django can already do this for you. See the SlugField documentation: http://www.djangoproject.com/documentation/model-api/#slugfield Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newforms Captcha 0.1 release
On 4/26/07, Brandon Low <[EMAIL PROTECTED]> wrote: > > 16 hours ago I posted about my captcha system that was quite rough > around the edges. > > I've done some house cleaning since then and will call it 0.1. > > This is now in "Works on my live site" state. I managed to clean up > most of the hacky crap that was in the last version and add some > comments to my code. > > http://test.lostlogicx.com/transfer/captcha-0.1.tar.bz2 > > Is there a more 'official' place to post django projects like this? > djangosnippets doesn't seem like the place for 200 line things with > several files. Most people create Google Code projects, prefixed with "django-". See http://code.google.com/p/django-openid/ and http://code.google.com/p/django-template-utils/ for examples. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Implementing OpenID in your Django app
On 4/23/07, Simon Willison <[EMAIL PROTECTED]> wrote: > > Hi all, > > I've just released the first version of an OpenID consumer package for > Django. The idea is to make it ridiculously easy to add OpenID > consumer support to any Django application - and hence allow users of > OpenID to sign in without having to set up a new username and > password. > > http://code.google.com/p/django-openid/ > > Documentation here: > > http://django-openid.googlecode.com/svn/trunk/openid.html > > If you don't know what OpenID is, my screencast might help: > > http://simonwillison.net/2006/openid-screencast/ > > This is the first releasable version so I'm really keen on feedback, > both concerning the API and features that would make useful additions. > My plan for the next version is to include tools for associating > OpenIDs with Django user accounts. > Simon, thank you for this! Your screencast was the first time I really understood what OpenID is all about, and I've been hoping for awhile that you would release the implementation you use for your site. Very cool, thank you! Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error - 'int' object is unsubscriptable
On 4/21/07, mateo <[EMAIL PROTECTED]> wrote: > > I've found that if I add the 'admin' subclass to the 'choices' class > and remove 'edit_inline=models.TABULAR, num_in_admin=3' from > the Foreign Key I can save new entries just fine. The error only pops > up when I have the 'choices' edited inline with the 'polls'. > Well that's certainly less than desirable. If you have the time (and know-how with Python), maybe download the 0.96 release, and try with that, just to make sure that something didn't get screwed up recently in SVN. I'd try myself, but I've run out of time for the evening. Also, in the code you posted, the indents seem to be quite strange. Maybe it's just the way Gmail formats it, but it looks like you're using indent levels of 5 and 3 in different places. Try to stay consistent and just use 4. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error - 'int' object is unsubscriptable
On 4/21/07, mateo <[EMAIL PROTECTED]> wrote: > I am on part 2, 'Custominze the Admin Change List'. (http:// > www.djangoproject.com/documentation/tutorial02/#customize-the-admin-change-list) Sorry, I meant, what stage exactly did it break? ie., did you go through tutorial 2 step by step, checking that the Admin looks like it does in the tutorial, after each change, or did you just put in all the code and try it? It'd be helpful to know what the last part was that still worked, and what change caused it to break. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Error - 'int' object is unsubscriptable
On 4/21/07, mateo <[EMAIL PROTECTED]> wrote: > > List, > > When following the tutorial I get the below error when attempting a > save from the admin console. I'm new to Django and certainly not a > guru of any sort so I thought I would ask about it here first before > posting a bug report. I am using the latest SVN release as of 4/21. > Any ideas what might be going on? > > Traceback (most recent call last): > File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" > in get_response > 77. response = callback(request, *callback_args, **callback_kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > decorators.py" in _checklogin > 55. return view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/views/decorators/ > cache.py" in _wrapped_view_func > 39. response = view_func(request, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/ > main.py" in change_stage > 329. new_object = manipulator.save(new_data) > File "/usr/lib/python2.5/site-packages/django/db/models/ > manipulators.py" in save > 191. param = f.get_manipulator_new_data(rel_new_data, rel=True) > File "/usr/lib/python2.5/site-packages/django/db/models/fields/ > __init__.py" in get_manipulator_new_data > 289. return new_data.get(self.name, [self.get_default()])[0] > > TypeError at /admin/polls/poll/1/ > 'int' object is unsubscriptable > > What stage of the tutorial, exactly, did this error occur at? Could you also please copy and paste the contents of your models.py file with your response? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: [OT] Vim (was "Poll tutorial question")
On 4/19/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> Well, whitespaces in Python are pretty difficult to keep in > >> line, if you are used to other languages. I personally use > >> Tabs for intending and VIM editor and have it to make Tabs > >> visible like dark blue |--, > > > > Hey, do you mind sharing your .vimrc for that, probably best > > on dpaste.com ? > > > Just add > > set listchars+=tab:|- > set list > > to the end of your vimrc. This will show the tabs in the above > format. The color is based on your colorscheme, whatever > highlighting it maps the SpecialKey to. > > If you don't like the other characters that become visible with > listchars, you'd have to remove them from the 'listchars' setting > (it defaults to "eol:$") > > :set listchars-=eol:$ > > You can read more than anybody would care to know at > > :help 'listchars' > :help hl-SpecialKey > :help 'list' > > and the subsequent links to which those send you. > > -tkc > I've got to throw my two cents in here. The Python community (or at least, the majority of it), insists on spaces instead of tabs. http://www.python.org/dev/peps/pep-0008/ I don't want to start a discussion of which is better, as this is not the right place. However, Django is written using spaces, not tabs. The community tends to write with spaces, not tabs. The PEP says not to mix the two, and if a mix happens, convert all your code to use spaces, not tabs. So be wary if you ever plan on plugging someone else's Django application into your project. If you think tabs are better because you can highlight, then try this: http://www.vim.org/tips/tip.php?tip_id=1040 Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: selecting a framework ,
On 4/19/07, gops <[EMAIL PROTECTED]> wrote: > > Hey thanks for those coolest links , i think this will be enough for > me getting started , > > i am from hard core c c++ programming background taking babystep in > web development , so my target it to "learn one thing that do it > all" , and after much of googling , i think django is the right > choice , > > and if i develop a code that works , i surely will make it open-source > for public to use and develop. > > and this is web based in the sense that , i want to create a website > that do all erp work for a small business need to do , > no fancy stuffs. i will upload my updates if things getting sense. > > now am excited to use jango > That's more or less how I came to Django. I was already proficient in Python, but the other half of my work experience is "hardcore c/c++", doing real-time embedded devices. ie., as far away from web development as you can be :) Django fit my brain quite well, and if you're proficient in C/C++, then Python won't be too hard to learn (you'll just have to make sure to "unlearn" a few horrible habbits that C/C++ forces you to use). Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django comparison
On 4/19/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > On 4/19/07, Nicola Larosa <[EMAIL PROTECTED]> wrote: > > The next step is doing away with a predefined model altogether. Semantic > > web CMS, anyone? ;-) > > Have you looked at trunk/django/contrib/databrowse yet? :) Is that what Adrian's going for? I briefly tried out databrowse the other day, and couldn't quite see the point (realizing of course that it's brand new). Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Static content in admin?
On 4/17/07, RG <[EMAIL PROTECTED]> wrote: > > Is there any way to manage static blocks of content from the admin > panel? I am converting my companies website into django and many "non- > programmers" will be maintaining the content. > > There are blocks on the home page that will get updated only ever so > often, as well as footers, contact pages.. etc. A way I've handled this in the past is with the permissions system. I have a model called CurrentSpecial, which I use to populate a div on the main page with whatever the current sale/special/whatever is. For any user (other than myself) that is allowed to login to the Admin and make changes, I make sure that the only permission they have for that model is "can change currentspecial" (so they *don't* get the "add" or "delete" permissions). This essentially enforces a limit of one instance of this model in the db. They can go in and change whatever the current details are for that special, but they can't delete it, and they can't add new ones. Not the greatest solution in the world, but it works. Anyone have any better methods? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Navigating the Documentation
On 4/17/07, Nate Finch <[EMAIL PROTECTED]> wrote: > > Hi, thanks for the very reasoned, and thorough response to a somewhat > bitchy post. My apologies, I was tired and frustrated, so the email > came off a bit more edgy than I really intended. > > Those links do help a lot. I'll try to gather my thoughts into a more > constructive suggestion. I guess the thing I'd like to see is a > complete tree view of all documentation pages. > > Anyway, thanks again. It's not a perfect solution, but don't forget about www.djangobook.com. A lot of that documentation matches the project documentation quite closely (and in many places is much better), and as it's done in a book format, it's presented in the order you'd want if you were learning Django the first time. And it has a Table of Contents :) Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Passing Django Model objects between machines
On 4/17/07, johnny <[EMAIL PROTECTED]> wrote: > > Anyone know, how I can pass Model object from one machine that runs > Django, to another machine that doesn't have Django, but uses > python? This is a dangerous idea. What happens after you pass the Model object to some machine X, and machine X tries to do something the object that requires a call to the database? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django comparison
On 4/17/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > Run under Apache. The Django server would be slower and would be more > likely to fail once you got any kind of load on the server. The Django server can only handle one request at a time, so "load" would be defined as two people trying to access the site :) Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: url template tag with generic views?
On 4/16/07, ltbarcly <[EMAIL PROTECTED]> wrote: > > Is it possible to use the {% url %} tag with generic views? Generic > views get used more than once in an app presumably, so there would > have to be some way to narrow it down. > > I'm guessing that there might not be a way to do it at this time, > which is a shame. > In the past, you had to create a wrapper around the generic view, but the TRUNK now contains named URLs: http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Super long response times/load times: Looking for some guidance on alleviating the issue
On 4/16/07, Roboto <[EMAIL PROTECTED]> wrote: > > serving directly from apache. Well, I'm out of ideas then :) Probably, you should start putting up some of your more relevant config information (Apache config files), because you haven't given too much information to go on. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Super long response times/load times: Looking for some guidance on alleviating the issue
On 4/16/07, Roboto <[EMAIL PROTECTED]> wrote: > > Hey Jay, yeah, I noticed somethign similar to that affect as well. It > seems like it does some sort of caching or something, and if it hasn't > cached in a while it takes a while to load. I'm running mod_python, > so I'm often reseting the server so that my code changes go through. > As for serving media files, I'm serving off the same server off my > media directory. The HTML are templates stored within the Django > app. Should they be placed elsewhere? It's fine if the templates are stored within the Django app, but I was asking about the CSS and the images. How are those being served? Are you using Django's 'django.views.static.serve', or are you servering directly from Apache? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Super long response times/load times: Looking for some guidance on alleviating the issue
On 4/15/07, aaloy <[EMAIL PROTECTED]> wrote: > Fasterfox gave me 3.208s for the main page and less than a second for > the others. That's the same behaviour I saw (with Safari instead of Firefox). First access is kinda slow, but every subsequent one is fast. That *includes* reloading the main page. The first connection will be kinda slow, but all the reloads are almost instantaneous. What kind of server setup are you using? I'm not very educated on the various types, but I believe FCGI, for instance, will kill all the Python processes after awhile, if the site hasn't been hit, and will respawn them again once a new connection request comes in. Depending on who your hosting provider is, that might be the explanation. And of course, if I'm *way* off, someone please let me know :) And how are you serving the media files (css, images). I notice from the HTML that they're coming from the same server. Are you having Django serve them, or your web server? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Saving an object takes a long time
On 4/15/07, Chris Moffitt <[EMAIL PROTECTED]> wrote: > Thanks for the pointer. Any other ideas? There are a few straight Python things you can do to speed up the code a bit, but they won't be huge. First off, how many keys are you usually seeing in address.__dict__.keys()? If it's a lot, and the "if data.has_key(field)" check is *usually* true, you might be better to do: for field in address.__dict__.keys(): try: setattr(address, field, data[field]) except KeyError: pass Also, you might try .iterkeys() instead of .keys() Second, in the big "else" block, you're doing too much string creation in the for loop. Change it to: for field in address.__dict__.keys(): try: setattr(ship_address, field, data['ship_' + field]) except KeyError: pass This way, you're no longer doing the conditional has_key, and you're also not creating the "ship_"+field string twice each time. You could also change that .keys() to a .iterkeys(). What would possibly be even better is if at the beginning of the function, you did something like: customer_keys = customer.__dict__.keys() And then used customer_keys in both of your for loops. That saves a function call. Again, these are all just little things, but depending on how many 'address' keys there are, and how likely the key is to appear in 'data', it might make a difference. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating Django .95 -> .96 on Mac
On 4/10/07, brian mckinney <[EMAIL PROTECTED]> wrote: > > Thanks Jay, this worked perfectly. > > Can anyone shed some light on the purpose of the easy-install.pth > file? Is this just adding django to the system path? Very briefly: There is a large movement in the Python community to move towards .egg distribution. For many things, it's great, but the general consensus was that for Django, it was causing more trouble than it's worth. The way that .egg files work is by getting listed in the easy-install.pth file. That file will include all the .egg files on your system, as a way to let the Python interpreter know about them. For 0.96, eggs are no longer being used, and the more "traditional" method of installing the directory into site-packages is being used. This is actually going to be a problem for anyone that had installed 0.95 as an egg, and then upgraded to 0.96 (not just on OS X). If you don't know about eggs, then it's a confusing problem. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Updating Django .95 -> .96 on Mac
Which directory does the .egg file and the 'django' directory live? /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ ? If so, there should also be a file called easy-install.pth in that directory. Open up that file, and you'll see a reference to the .egg file. Delete that reference. You can then delete the .egg file itself. What's probably happening, is that the .egg is showing up on sys.path before the new 'django' directory. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: upload_to with username
On 4/3/07, Stephen Mizell <[EMAIL PROTECTED]> wrote: > > > That line is executed exactly once, at the time the file is imported. So > > it is not dynamic in any way. > > > > (I seem to be saying that at least every other day here. It's normal > > Python behaviour, people. Please stop hoping it were otherwise!) > > Thanks for the help. I didn't call it dynamic, though. What are you > referring to? Your suggested code implies that it be dynamic though. The models.FileField() line will only ever be executed one time. You're passing it the value get_current_user(), but that value only ever gets passed that one time. If it were "dynamic", then get_current_user() would get called everytime the FileField is accessed, which is what you wanted, but that's not the case. Hence Malcolm's comment :) Jay P --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: upload_to with username
On 4/3/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I remember having some concerns about your approach a while back, but > apparently they weren't significant enough for me to attach a comment to > the ticket. A bit careless on my part. :-( > > I'll try to reconstruct my thinking in the background and post something > if/when I remember what was bothering me. I think it was a worry about > making this work correctly inside a model's overridden save() method, > but it's a bit fuzzy now. I'll get back to you. I'd have major hesitations (especially a year after I first put up the patch) about it becoming the "proper" solution. I think the proper solution would involve specifying something at the model level. Possibly the ability to define a function which can dynamically determine directory names? ie. FileField(..., upload_to_function=some_func) Not really sure what the arguments to such a function would be though... This patch came out of a particular one-off use case I had, where I had one particular view that needed to do some custom upload_to work. I've always hoped that someone would come up with a better solution (after all, my patch is almost a year old), but that doesn't seem to be the case. Seems like a vital requirement for *any* site where users will be allowed to upload content. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: upload_to with username
On 4/2/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > At the moment, there is no easy way to change the base directory for > file uploads. You can however, change the filename to include > sub-directories, I believe (so change foo.blah to upload/dir/foo.blah). > If you want to try and change this, read the source in > django/db/models/fields.py and see what you can come up with. It does > get a bit hair, though, because of some curried functions. Everytime a custom upload_to question comes up, I offer up my (now quite old) patch that allows it, but only in custom views: http://code.djangoproject.com/ticket/1994 The patch may not even apply anymore, but for someone who really needs custom upload_to, it's an option. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Advanced Search on Django?
On 3/30/07, js <[EMAIL PROTECTED]> wrote: > > Hi, > > Now I'm trying to write a 'Advanced search' function like this. > http://code.djangoproject.com/query > > Because I'm still new to Python and Django > writing flexible query like this is a bit hard. > So I svn checkouted djangoproject.com's source and > tried to look at the custom query's code, > but I couldn't find that. Everything under code.djangoproject.com is powered by Trac, not by Django, which is why you can't find it. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Strange filtering issue
I've got one view where I want the queryset to be a standard objects.all(), but I also want to use a datetime.now() to pass in "upcoming" events. I do this: def get_upcoming(): return Event.objects.filter(end_date__gte=datetime.now()).order_by('end_date') urlpatterns = patterns('django.views.generic.list_detail', (r'^/?$', 'object_list', dict(info_dict,allow_empty=True, extra_context={'upcoming_events':get_upcoming})) ) The trick here is that Django allows you to pass in functions as dictionary values. I don't remember if you can use a function for the 'queryset' value, but it definitely works inside of extra_context. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django install on mac osx 10.4.8
On 3/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi everybody, > > hope you're all good out there. > > I did a few progress with my install. > i installed python 2.4. > > with this install instead of the latest one i could install django > with the sudo python setup.py install command. > > but now i can't seem to start a project. > when i do the import django line in the terminal i do not have any > error message again > but when i try the > > django-admin.py start-project testsite > > i get a syntax error message > > File "", line 1 > django-admin.py start-project testsite > ^ > SyntaxError: invalid syntax Don't run that command from within the Python interpreter, just do it from a Terminal command line. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Where art thou ImageField
You may want to check out the 'stockphoto' app. Even if you don't use it directly, it might give you ideas. It seems to handle thumbnails quite well. http://www.carcosa.net/jason/software/django/stockphoto/ Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django install on mac osx 10.4.8
On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > nope i do it from home, never had any problem before, not like i would > really have known anyway got problem all the time :), > problem isntalling this and that, problem installing rails and so on. > shame i really want to give a try at django reviews looks good, better > than rail for a designer like me. > I recommend staying away from DarwinPorts. It sometimes works very nicely, other times, not so much. I would instead install Python2.4 and sqlite2 from http://pythonmac.org/packages/py24-fat/index.html (As you're running Tiger, sqlite itself is already installed, you just need the Python wrappers). Then install subversion from http://www.codingmonkeys.de/mbo/Subversion-1.4.3.pkg.zip Then install Django via svn (the install document says how to do that). Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django install on mac osx 10.4.8
On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > well i tried with the forewall and offan it return the same error all > the time. Sorry, I misspoke. I didn't mean firewall, the firewall should have no effect. I actually meant proxy. Many corporate environments are behind proxies that screw up urllib until you configure things properly. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django install on mac osx 10.4.8
On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi everybody, > > i'm trying to install django, i followe dthe instruction on the django > web site but it doesn't work > been looking around and the only tutorial that i yet understand > ( sorry it's al a bit complicated for me ) require to install macport, > which i'm not really keen on ( tried earlier for other reasons and got > only trouble ). > > playing around i installed the latest release of python 2.5 > > then i downloaded again the latest release of django but when i do the > install command > > sudo python setup.py install > > Downloading > http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0.6c1-py2.5.egg > Traceback (most recent call last): >... > urllib2.HTTPError: HTTP Error 404: Not Found > > And i can't do anything, > > has anybody any idea how to solve this? > Are you behind a firewall? urllib2 can't get through firewalls unless you've configured some environment variables. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Allowing no value for a DateField
On 3/12/07, Roland Hedberg <[EMAIL PROTECTED]> wrote: > > Hi! > > I have designed a model which contains among other things a couple of > DateFields. > > Some, actually one, of these must have a value but the other may not. > > So, I tried to use the construct: > > done_planned = models.DateField(blank=True) > > But that doesn't work, because I get a exception with the error: > > "act_activity.done_planned may not be NULL" > > when trying to store a model instance where the optional dateField > attributes are undefined. > > So, how should it be done ? You want: done_planned = models.DateField(blank=True, null=True) 'blank=True' is for the Admin, saying that at a validator level, the field may be blank. 'null=True' is for the database constraints. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: FileField/ImageUpload saves upload-to path as \...\...\ instead of /.../.../ in database
On 3/10/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Umm ... Jay? He's using django-users already. :-) Heh, silly me. The first two emails *were* sent to django-dev (and django-users), so Gmail automatically tagged them as such. All the subsequent emails showed up in my django-dev folder because of that. My bad! Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: FileField/ImageUpload saves upload-to path as \...\...\ instead of /.../.../ in database
django-dev is not the appropriate group for this, you want django-users. Django-dev is for discussion on the development of Django itself, not development "with" Django. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: choosing ajax framework (for my projects) :)
On 3/9/07, ashwoods <[EMAIL PROTECTED]> wrote: > > with so many choices, you dont really know where to start :( > > things like i would like to do. > > 1) update the contents of a div element with the content fading out > and in (news on the first page) > 2) select form elements that populate depending what the "parent" form > element was chosen > 3) when i click on a link in a row of a table, change the rows height > and load some data and a picture. > 4) "live search" > > id say pretty simple stuff. but where should i start? prototype, mojo, > mochi, and thousands of others. > what would you recommend, those of you who have experience? :) > > i must also say that i actually don't enjoy coding in javascript :) > traumatized when trying to write cross browser javascript 8 years ago. I've not much javascript experience myself, but when I needed to learn a bit, I found Mochikit to be a good fit. The main reason for that is that it's written in a *very* Pythonic style. I'm a long time Python guy, so that felt natural to me. It doesn't have nearly as many visual effects as some of the other kits, but they're slowly adding them. And I *think* it works well with Dojo, if you need to build fancy visual stuff on top. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Marking a DateField event as "repeating"
On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry, the date_from and date_to are probably superfluous for your > needs. For my system they represent the period that this schedule is > valid for and therefore the absolute extent that rrule can generate > dates for. > > For my application I don't have to pull them all out. I'm writing a > booking/scheduleing system and mostly people will search for "things" > on a particular day(s) or for a particular month or between two > specific dates etc. Using the bitmaps and simple bitwise math I can > pull out just the ones that are *likely* to have dates in them. > > You could always store another marker or two to give a good first line > SQL filtering depending on how you want to look for them. The idea is > to probably get a few more than you might need, but not *too many* > more! Finding all the records that fall on a monday or in the month of > May is pretty easy with the SQL, then just rrule them to find the > actual dates depending on the other repeat criteria. > > Otherwise you would have to pull them all out yes. However, if you > have rules that repeat on every day or every other day you are not > likely to have very many of them for any one specific calendar. > > Also I store these Schedules as a top level table. I then create > Resources (Events?) that "use" a specific schedule. This way I can > have lots of Resources that use the same Schedule, again minimising > the number of schedule records. > > You can then create nice names for the schedules (in the description > field), call them "Weekly", "Monthly", "Every second Thursday" etc. > and have a pick list of common schedules to assign to events or > whatever. > > Again, it's probably overkill for a simple calendar, but damn > powerful!! Just some ideas to mull over then :) > Ahh, ok, that makes sense now. It might be overkill for what I'm doing, but I can just see the requirements for this continually increasing. Having the structure already in place to do whatever I want would be a good thing :) Thanks, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Marking a DateField event as "repeating"
On 3/8/07, Gary Doades <[EMAIL PROTECTED]> wrote: > > > > > So in your Event model (or whatever you're calling it), you're > > essentially storing the keyword arguments to an rrule, depending on > > what's necessary for a particular event? > > > > Then whenever you need to render a calendar, you pull in all the > > Events from the db, create rrules for each using the stored > > parameters, and just work with the dateutil library to do the rest? > > > > Jay P. > > More or less, yes. > > I have a Django model (from my original test code): > > class ResourceSchedule(models.Model): > description = models.CharField(maxlength=64) > daymap = models.IntegerField() > monthmap = models.SmallIntegerField(default=4095) > period = > models.SmallIntegerField(default=0,choices=RESOURCE_SCHEDULE_PERIODS,validator_list=[validators.NumberIsInRange(0,6)]) > frequency = models.SmallIntegerField(default=1) > time_from = models.TimeField(default='09:00:00') > duration = models.TimeField(default='00:30:00') > date_from = models.DateField() > date_to = models.DateField(null=True) > > > Which covers all the rule bits I will need. > > The daymap and monthmap are used depending on what the period is (Weekly, > Monthly etc.) to store exactly wich days & months the event should repeat > in. I store these as a bitmap for minimizing data storage, but it is > easily searchable with SQL and the bitmaps can be simply expanded to lists > for display in forms (as Checkbox Lists for example). You could of course > store the days/months more explicitly in your table. > > frequency is the interval part of the rule giving you every 'n' weeks for > example. > > Its pretty easy to then find the ResourceSchedules that might be > candidates for having events in your datefrom/dateto period and shoving > them into and rrule/rruleset. > > It might be overkill for some simple tasks but I need the flexibility. > This way I can store/generate just about any repeating pattern I care to > think of. Mostly I'm cool with that, but one thing just isn't clicking yet: Your date_from and date_to fields, I'm guessing these represent the from/to dates of the *original* event, and aren't affected by repetitions? So if that's the case, how do you initially pull your ResourceSchedules out of the database? It looks to me like you'd have to pull them all out (ie. ResourceSchedule.objects.all()), generate rrules for all of them, and see which of the rrules fit into a desired timespan. Is that right? By the way, it warms my heart to see you storing bitfields. My area is embedded devices, not web stuff, so I often spend my days working with bitfields and masks and such. Good to see that tradition carried into some Django :) Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Marking a DateField event as "repeating"
On 3/7/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Sorry, I skipped the first step in the reasoning because I thought it > was obvious. My bad. > > Except for events that repeat only yearly, every single one of your > events is going to occur at least once in any given month. The only > exceptions will be things like events with monthly repetition on the > 30th of the month and where you're considering the month of February. > But that case occurs infrequently enough that you can ignore it. > > So, your initial list is *every event*. Then you have a method on the > Event model that converts that single event + a month and year (i.e. a > date) into a list of events on particular dates in that month. The > slight improvement here is to select every event except yearly ones and > then treat yearly recurrences as special. Which approach is best depends > on how common yearly events are. > > Iterate over your set of events, calling the special method and have > that method return a list of (date, title) tuples, for example. Then > merge those lists (iterate and merge in a single list comprehension), > sort the list and you're ready to put them on a calendar. > > Is that clearer? > Ok, my bad, I left one option out of my original model, namely "NoRepeat", for one-off events. But talking this through with you has filled in the blanks. So I think it stands as follows: 1) Select all events that are NoRepeat, and find the ones that are in the desired month. 2) Then do everything you said on the set of events that are not NoRepeat, plus my results from step 1. Sound good? Of course, this is a simplified model. If I want to allow all the features of a regular calendar app, I'll need to support custom repeats, like "Every second Thursday", or "Every 5 months on the 17th". iCal on OS X has a very nice interface for selecting these custom repeats, I guess I'll try and copy that. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Marking a DateField event as "repeating"
On 3/7/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > This shouldn't be too hard to do (it was a fun problem to think about > over lunch). I would create a method on the model that takes a date > (what you are really interested in is the month and year) and returns a > list of the dates in that month when this event occurs. It could even > return copies of itself (or a lighter-weight class) for each date that > it occurs on, with the date set appropriately. > > Then you can select all your active events and concatenate together all > those lists, do a single sort on the date field in Python and you're > done. > > You could be a little more efficient here by not selecting all events > with repeat = 'Y' and just selecting those in the months they are going > to appear (so one query for most repeat types and another query for 'Y' > types). > > With judicious use of list comprehensions, creating all the events for > all dates in a given month should be close to one or two lines of code > (plus the extra model method). The performance should be pretty decent, > too. It is one of those problems that's just begging me to have a crack at it in IPython, and see what I can come up with. I'm just occupied with other things right now, so I was hoping someone else had already done it :) I'm not quite understanding part of your first paragraph though: "I would create a method on the model that takes a date (what you are really interested in is the month and year) and returns a list of the dates in that month when this event occurs" If the model is taking a date, then what is "this event"? Part of the goal would be to determine *which* events occur in a given month. The second step would be to figure out all the times those events do occur. Given all the events that do occur in a given month, the rest of your steps make sense, but I'm still not sure how I'd find that initial list of events. Thanks, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Marking a DateField event as "repeating"
So I'm working on a calendar application, and trying to come up with an efficient way to mark some event as repeating. The trivial way to create the model would be something like: REPEAT = ( ('D', 'Daily'), ('W', 'Weekly'), ('M', 'Monthly'), ('Y', 'Yearly'), ) class Event(models.Model): title = models.CharField(maxlength=32) date = models.DateField() repeat = models.CharField(maxlength=1, choices=REPEAT) When I render a calendar, I render one month at a time. Any suggestions on an efficient way to query the db for all the events in a given month? Maybe it would make more sense to skip the database all together, and store things as iCal files, using one of the Python iCal libraries to parse through? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Python HTML lib_filter
On 3/7/07, Sam <[EMAIL PROTECTED]> wrote: > > I have translated Cal Henderson's lib_filter.php to python. > > If you need to filter your users HTML input, you might like it. > > http://amisphere.com/contrib/python-html-filter/ > Looks good, I'll have to play with it later. One quick thing though: You're using re.compile all over the place, and that's fine, it's good to precompile the regexs. Problem is, you're recompiling the regex everytime each method is called. For example, in 'escape_comments', you do a re.compile. It would be *much* better to do that compile in the __init__, and store it to a variable, so you only ever have to do it once. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: iCal like interface in the Admin?
On 3/6/07, Rubic <[EMAIL PROTECTED]> wrote: > > Jay, > > I would think you'd want to do a custom form for something like this. > I'll be doing something similar soon for a scheduling system. You're > familiar with the dateutil module? > > http://labix.org/python-dateutil Hmm, not familiar with that one. I was just planning on using the standard datetime and calendar modules. I'll definitely take a look though, thanks! Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
iCal like interface in the Admin?
I'm currently putting together my first calendar view for a website. Initially, I thought that creating a basic "Event" model with a single DateField would be good enough, but after thinking about it, realized that without some basic "Repeat" functionality, it'll become useless pretty quickly. For instance, in iCal, when you create a new event, you can choose for it to repeat daily, weekly, monthly or yearly. That's easy enough, a simple IntegerField with a 'choices' option. However, iCal also has a "Custom" option. This also has "Daily", "Weekly", "Monthly" and "Yearly" options, except that with each of them, you get to customize it. So for "Daily", it says "Every X days", where "X" is a text field for you to put a number in. For "Weekly", it says "Every X weeks on Y", where X is again a text field, and Y is an option of one of the seven days. Can anyone see a reasonable way to do this with the Django admin, or am I going to have to create a custom form for this? Thanks, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Users permissions
On 2/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, I'm thinking about create a website using django. One of the > apps would be a news section, where everybody can publish the news > (perhaps after approval) and where the users can edit and delete their > own news, but not the other users news. > Is it possible to implement this within the django admin or should I > create a specific application for this? > I accept suggestions about how to do it. If you use the row-level permissions branch, you *can* do this from the Admin. However, that branch isn't really being maintained right now. I'm using it on one website, and it's working nicely for me. However, I would recommend that normal end users not be allowed to use it, just "trusted" admins. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Per object permissions
On 2/8/07, Ramdas S <[EMAIL PROTECTED]> wrote: > I think Adrian is keeping the trunk upto date. I am using thie updates trunk > right nowand everything seems to be OK Except that the per-object permissions branch hasn't had a trunk merge for over a month. I'd *guess* Adrian is too busy with the newforms branch right now. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Per object permissions
On 2/7/07, Scanner <[EMAIL PROTECTED]> wrote: > Is someone actively merging in stuff from mainline? > I emailed the address listed on the wiki page at djangoproject.com > for the project but either my spam filter ate the response or I have > not gotten any response. Chris Long was the original maintainer, and he kept doing merges for awhile. At this point though, I haven't seen him around these parts in months. Adrian was doing it for awhile after that, but seems to have stopped. I've got a site running in production that uses the branch, and it's working for me. Luckily the site doesn't need any major changes (and won't anytime soon), or I'd have some issues. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Uploading large files via http FORM
On 1/12/07, Pythoni <[EMAIL PROTECTED]> wrote: > > Hi, > does anyone have an experience with uploading large files in Django > application? > I use mod_python with Django and when I try to upload a file about 100 > MB I received an error. > Thank you for any suggestion. > L. > Even if you reconfigure your Apache, your CPU is going to get maxed out. Read through the archives, there is a patch or two out there to change the way Django handles uploads, to allow for big files. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Book Add Google or Yahoo Site Search
On 1/20/07, johnny <[EMAIL PROTECTED]> wrote: > > Is it possible to add Google or Yahoo Site Search to Djangobook.com? > > Thank You. > You probably know this, but if you prepend your search with "site:djangobook.com", then it'll just search the djangobook.com domain. So do "site:djangobook.com adrian" to find all the occurrences of "Adrian" on the site. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Context-sensitive 'upload_to' parameter for FileField
On 1/19/07, Patrick J. Anderson <[EMAIL PROTECTED]> wrote: > > Hi, I was wondering if it is possible, and if so then how, to have a > context-sensitive 'upload_to' parameter set for FileField. > > Let's say, I have the following model concept: > > class MyModel(models.Model): > folder = models.CharField(maxlength = 8) > file_html = models.FileField(upload_to = '%s/html' % x) > file_pdf = models.FielField(upload_to = '%s/pdf' % x) The inflexibility of 'upload_to' has been discussed a few times in this list. If you search through, you should be able to find one or two solutions. None of them are great, but they're all that's available. Many moons ago, I submitted a patch that allowed custom upload_to. No idea if it would work against the current trunk, but you can try, http://code.djangoproject.com/ticket/1994 Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trouble with stockphoto
On 1/17/07, Isaac Alston <[EMAIL PROTECTED]> wrote: > The problem is most likely with your MEDIA_URL. Make sure it ends with a '/' Thank you very much. That seems to be it fixed :-D. First I had MEDIA_URL set to: ' ' then '127.0.0.1:8000', then '127.0.0.1:8000/' then '/', then finally '/smedia' which got it working. I'm so happy :-). The only thing I'm concerned about is a) why didn't it want a URL and b) what's going to happen when I deploy? How will this change? '/smedia' is a URL, so I don't understand your first question. To answer you second question, that all depends on how you deploy. For me, I have a "separate" server called media.awwca.ca, so my MEDIA_URL is 'http://media.awwca.ca/site_media/' (I put quotes around "separate" because physically, it's the same server, but this makes it easier on me if I ever want a physically separate server). Although if you're not doing that, then keeping it as '/smedia/' should be fine, assuming you really do serve your media out of there. --~--~-~--~~~---~--~~ 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: Trouble with stockphoto
On 1/17/07, Isaac Alston <[EMAIL PROTECTED]> wrote: Ok, I figured this part out. I looked at the stockphoto/models.py code, and discovered it was doing something like STOCKPHOTO_URL[-1], which was obviously causing the error, but I couldn't work out why. Then I realised that if STOCKPHOTO_URL was already defined in settings.py as '' then it would be trying to index an empty string (which would fail). I removed my entries to STOCKPHOTO_URL and that error has now disappeared. Now everything is at a default install, but it's not fixed anything, the link in admin is still: http://127.0.0.1:8000/admin/stockphoto/photo/5/stockphoto/2007/01/17/newser.jpg for example. Highly frustrating. I still don't have a good idea of what your settings currently are. Could you paste in your various media settings, as well as the current stockphoto settings? My guess as to why the link is being generated like that is because you have a relative URL somewhere in there. The first part of the URL you're getting, namely "http://127.0.0.1:8000/admin/stockphoto/photo/5; is the correct URL for the admin edit page for the stockphoto model. The part after that, "stockphoto/2007/01/17/newser.jpg" is roughly the correct path to the actual file. BUT, that path should be a child of the media directory, not of the admin edit page. The problem is most likely with your MEDIA_URL. Make sure it ends with a '/' Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trouble with stockphoto
On 1/16/07, Isaac Alston <[EMAIL PROTECTED]> wrote: > Hmm, that MEDIA_URL worries me. Can you try setting that to something > more concrete? Ok, I tried setting it to "127.0.0.1:8000" (was the only thing I could think of) and it didn't do anything, so I decided to do a fresh install of stockphoto. Upon doing this, I now receive a new error: "threeci.stockphoto: string index out of range" when I try to syncdb (or go to the app). Curiouser and curiouser. The only changes I've made, was set the stockphoto urls to '' (because I just wanted a default install - I thought perhaps 'photos' was causing the problem). Can you paste the full traceback for the string index error? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trouble with stockphoto
On 1/16/07, Isaac Alston <[EMAIL PROTECTED]> wrote: > Your paste bin links don't seem to be working for me, but I'm going to > guess that your STOCKPHOTO_BASE and STOCKPHOTO_URL aren't right. The > link to the .jpg itself shouldn't have 'admin' in it anywhere, unless > you have your media setup in a very odd way. This is strange, I'll paste them somewhere else, sorry about that: http://pastebin.com/860489 Just in case that's broken as well: STOCKPHOTO_BASE='/photos/' STOCKPHOTO_URL='/photos/' MEDIA_ROOT = '/home/isaac/django/threeci/smedia/' MEDIA_URL='' All of my media is in /smedia. I'm using runserver so I don't have a 'media server' setup yet - I've put something into urls.py from the Django docs, which lets you serve stuff out of a folder without setting up a 'proper' server while in development. Hmm, that MEDIA_URL worries me. Can you try setting that to something more concrete? > For my site, for example, one of the .jpgs have the link: > http://media.awwca.ca/site_media/stockphoto/2006/09/17/HPIM1621a.JPG Is this taken from the admin 'edit' page for your photo? Yeah, that's the URL to the actual jpg, from the info page for the picture in the Admin. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trouble with stockphoto
On 1/16/07, Isaac Alston <[EMAIL PROTECTED]> wrote: > You do have to add to urls.py. I'm using stockphoto on one of my > sites, you can see my site's code here: > http://svn.jayparlar.com/website/trunk/awwca/ Thanks for this. What I meant was the urls.py in the stockphoto directory (sorry I didn't make it clear). I notice that you've not changed this (but you have changed the urls.py for the whole site, as was in the install :-) ). Here's my urls.py for the whole site, I can't see why it doesn't work: http://dpaste.com/4716/ The problem does not seem to occur when I go to /stockphoto (I get a TemplateSyntaxError (saying it can't find 'load markup'), but I think that's good because it shows it's finding a template ;-) :-)). The problem occurs when I go into the 'edit' part of an admin page, and the link to the photo is given as: http://127.0.0.1:8000/admin/stockphoto/photo/2/photos/2007/01/11/Family-2006-09-10_012.jpg for example. Here is my settings.py: http://dpaste.com/4717/ ; of particular note are STOCKPHOTO_BASE and STOCKPHOTO_URL which may be causing this. Any advice would be appreciated. Your paste bin links don't seem to be working for me, but I'm going to guess that your STOCKPHOTO_BASE and STOCKPHOTO_URL aren't right. The link to the .jpg itself shouldn't have 'admin' in it anywhere, unless you have your media setup in a very odd way. For my site, for example, one of the .jpgs have the link: http://media.awwca.ca/site_media/stockphoto/2006/09/17/HPIM1621a.JPG Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Permissions at object instance level
On 1/15/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: The Row-Level-Permissions branch was (is) an attempt to implement this sort of functionality. I don't know the current state of this branch (i.e., is it merge ready, fundamentally broken, or somewhere in between?), but at the very least, the design discussed in the wiki relating to this branch gives an indication of how this feature could be added to an application. I'm running an older version of the branch on a (low volume) production site, it's working fine for me. Can't vouch for the current state though. I know Adrian has been doing occasional trunk mergers of it, as Chris Long, the original author, seems to have stopped development on it. I'd say it's as close to merge ready as any of the branches, but there were never enough people testing it to push it through to the final stage. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: CSS Basics
On 12/19/06, cwurld <[EMAIL PROTECTED]> wrote: Hi, I don't understand why css files are special in django. If I have a template that contains inline style commands, nothing special needs to be done. But if I put those same commands in a separate file, now that file needs to be in a special location that needs to be handled by some special code. It seems like I am really missing something here. But based on all the other questions on css, it seems like many others are just as confused as I am. There's nothing special about CSS files. What you're probably seeing, is that Django developers, in general, prefer NOT to have Django serve up the static media. The reason for this is essentially that Apache (or whatever server you use) is highly tuned for serving static media, and it'd be a waste to have Django process those requests. You *can* serve static media in Django, but as you said, you need to use "special code", namely the 'django.views.static.serve' view. What people tend to do is serve their static media from a separate server. If you look at the page source for djangoproject.com, you'll see that the CSS is served from http://media.djangoproject.com For a better explanation, see: http://www.djangoproject.com/documentation/static_files/ Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Would Django be a good framework for developing and engineering/science application
On 12/14/06, T. Size <[EMAIL PROTECTED]> wrote: > > I would appreaciate any comments about if Django is a good framework of > developing an application like is described below. If it is a good > framework for this I would appreciate pointers to applicable > documentation or examples. > > In the near future I will be developing an application that will be > used as a tool for doing the electrical engineering for making > electrical power transformers. Individuals from other parts of the > company will have to access parts but not all of system. > > Anyway here are the details > 1. An electrical engineer will log into the system, access one of > several design programs and after completing a few forms submit for the > program to perform iterations. Output will be saved to a database and > portions of the output will be published to other parts of the company. > I have libraries in python for doing most of the engineering part of > this work right now. It could take several minutes for each > transformer design to run making the iterations. > 2. Managers will login the system to run reports. Few items if any > can be changed by management but they will do a number of reports. > Django's CRUD system looks very promising to me for this part. > 3. Purchasing agents will update prices for components and get reports > of requirements for recently released jobs. > 4. Authentication by person and role will be very important. > 5. The deployment will be on an intranet initially but web access in > the future would be a great asset thus my interest in using a web > framework. > > Most of the examples I have seen for Django seem to focus on custom CMS > type applications. Atleast the engineering function described above is > more of a servlet (although a big one) type application. > Well, I've done something that sounds reasonably similar. In-house intranet app for an engineering company. We had some in-house Python tools that were used pretty heavily, but each user had to run their own version of it, and we couldn't place any controls on how it was used. So, I created a Django app. Engineers would log in, fill in the necessary info into the forms, and hit Submit. Processing would fire stuff off to another dedicated server, a process that could take up to a minute. Eventually, it'd finish, and send the data back to the Django app, presenting the user with the final results (done with a little AJAX). Certain admins could then log in and track what different people had done, as well as grant and remove permissions for individual users to perform certain actions. So essentially, it was a big Django app wrapped around tens of thousands of lines of Python code that was previously used in the end-user tool. Worked like a charm, everyone seemed pretty happy with the system. Hope that helps. I know I didn't offer too much in the way of details, but essentially, it sounds like I did what you plan on doing. The only problem I ran into was getting the AJAX stuff going, but that's only because this was both my first ever Django app, and my first time trying out AJAX. I simply used the AJAX so the "Submit" button would immediately bring the engineer to a new page, and I could keep them up to date on the status as the separate server did its processing. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Installation on Python25
On 12/14/06, kbochert <[EMAIL PROTECTED]> wrote: > > I can't ccut and paste from a dos box. Fortunately I just discovered > that I can redirect stderr using '2>' !! > Ahh, I think I see what's happening. Django 0.95 is reasonably old now, and by default, it tries to download setuptools 0.6c1, for Python2.5. However, there is no 0.6c1 for Python2.5, the only one they have available is 0.6c3. So here's the easiest thing to try: In the Django 0.95 folder, there should be a file called ez_setup.py. In it, near the top, is the following line: DEFAULT_VERSION = "0.6c1" Change that to DEFAULT_VERSION = "0.6c3" And give the install a try again. If that doesn't work, then try installing setuptools separately, by itself. In the current SVN version of Django, the setuptools stuff has been removed (at least, it was removed at one point, don't know if that's true anymore). So this won't be a problem in the future. You just happened to be one of the few people running Python2.5 and Django 0.95. Most people running 2.5 are probably running Django out of SVN, where this isn't an issue. Let me know if this doesn't work. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Installation on Python25
On 12/14/06, kbochert <[EMAIL PROTECTED]> wrote: > > Not that I am aware of. Windows 2000, Sygate personal firewall. Comcast > cable. > Plain vanilla I think. > Could you paste in the full text of the traceback? Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Installation on Python25
On 12/14/06, kbochert <[EMAIL PROTECTED]> wrote: > > I need some help installing Django. (not a good sign for my ability to > use it!) > I have installed Python25 on Windows2000, and added it to the path. > Its at C:\Python25 > I downloaded and unzipped Django 0.95 to C:\Django-0.95 > I opened a console in c:Django-.095 and entered 'python setup.py > install' > It connected to the internet, and I got a long message: > > Downloading http://cheeseshop ... 5.egg > Traceback: > File "setup.py", line 2, in > ez_setup.use_setuptools() > ... >... > File "C:\Python25\lib\urllib2.py", line 499, in http_error_default > raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) > urllib2.HTTPError: HTTP Error 404: Not Found > > I have a firewall. It asked if I wanted to allow the connection to the > internet. I answered yes, and saw a short burst of traffic. > > What was not found, and what do I do about it? Are you running behind a proxy server, by any chance? urllib2 can get tripped up in that situation. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Looking to hire
On 12/8/06, Jim Fritchman <[EMAIL PROTECTED]> wrote: > > Hi, all. > > Wagdogs is looking to hire one or more developers to work on Django. > We are a new startup located in the suburbs of Philadelphia, > Pennsylvania and we have so much interest in our company that we need > to get our product to market as soon as possible. > > We are looking for individuals that have experience with Python, > Django, CSS, Javascript, PostgreSQL and more importantly then that, > someone who is very motivated and is looking for a challenge. > > If you would like more information about the position, please contact > me directly at jim.fritchman (at) gmail (dot) com. > > Please feel free to pass this along to anyone you know that might be > interested. > Don't forget to post this over at http://gypsyjobs.com/, where they say: "Jobs with Django. Matching Companies with Developers" Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: is there a way to combine generic views?
On 12/7/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 12/7/06, Anton Daneika <[EMAIL PROTECTED]> wrote: > > I want a page which displays both the details of an object and the list of > > the objects. Is there a known way to combine generic views to produce such a > > thing? The problem is that all generic views return HttpResponse which I > > don't need in that case -- just the processing. > > I suppose it's just not the use case of the generic views -- they are not > > for this. > > Hi Anton, > > You suppose correctly. :) None of the generic views combine an "object > detail" with "object list." But it's very easy to pass in the object list as 'extra_context' to the generic view, which I think people sometimes forget about. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: Video stream uploading/playing
On 12/4/06, Pythoni <[EMAIL PROTECTED]> wrote: > > Eric, > Thanks a lot.Very good tutorial for me! > L. > Keep in mind that for larger files (I think over 10 megs), FileField causes very high CPU usage during upload. There is a patch somewhere in Trac that changes Django to store the file on disk during the upload, instead of RAM, which is supposed to help quite a bit. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Question concerning generic views or date based views in general
On 12/3/06, Oliver Andrich <[EMAIL PROTECTED]> wrote: > Hi, > > I am currently developing a small Django application for my personal use. > Now I like to have a date based archive page, and I thought that this > finally is a good thing to look into generic views. My requirements are, > that I can display the actually database item on the page and in a side bar > a list of years, which link to year based archives, and a list of months in > the current year. From reading the documentation about generic views, I > think I have understood, that I can have either a list of years or a list of > months, but not both. Is this correct? Well, the general operation of a generic view is to grab one "list" of things. Usually this is a list of items in a month, or items in a year, or items in a day, etc. However, you can pass extra information to the generic view with the 'extra_context' Take a look at this: http://awwca.ca/events/ Now, right now, there are no upcoming events, so it only shows all the past events. However, if there were upcoming events, they would be in the 'upcoming_events' variable in the context, passed to the template. You can take a look at the template code here: http://svn.jayparlar.com/website/trunk/awwca/templates/events/event_list.html And you can take a look at the urls.py that populates the context for the template here: http://svn.jayparlar.com/website/trunk/awwca/events/urls.py Also, if you want to have stuff in a sidebar, that's always there (no matter what page you're using), then you'd want something like template tags. Notice that on every page at awwca.ca, the right sidebar stuff is always there, and the information there is dynamic. Look at the "sidebar" div here: http://svn.jayparlar.com/website/trunk/awwca/templates/base.html, and notice that it does things like "{%random_thumbnail%}" and "{% upcoming_events %}" to populate the sidebar. > And besides generic views, I can also create the view myself. Is there a way > to select the years with entries from the database using the ORM? I can of > course use SQL, but I want to stick to the ORM and I want to learn a little > more about it, besides the basics I have used so far. Yep, the ORM can completely handle that. Check out the urls.py I pointed out above to see how I select upcoming events from the database, namely: def get_upcoming(): return Event.objects.filter(end_date__gte=datetime.now()).order_by('end_date') If you don't understand what's going on there, you'll need to read the documentation more. Hope this helps, Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Extending User
On 12/1/06, scum <[EMAIL PROTECTED]> wrote: > > Trying to extend the user group using this model code: > > class UserProfile(models.Model): > user = models.ForeignKey(User, unique=True, > edit_inline=models.TABULAR, num_in_admin=1,min_num_in_admin=1, > max_num_in_admin=1,num_extra_on_change=0) > hours = models.FloatField( max_digits=8, decimal_places=2, default=0, > core=True) > > > In the shell, when I type: > >>> from django.contrib.auth.models import User > >>> a = User.objects.all()[0] > >>> a.get_profile() > Traceback (most recent call last): > ... > DoesNotExist: UserProfile matching query does not exist. > > > OK -- understood, because the userprofile table is empty. > > > >>> a = User() > >>> a.save() > >>> a.get_profile() > Traceback (most recent call last): > ... > DoesNotExist: UserProfile matching query does not exist. > > The Question: > How do I get the userprofile created with each user? (I tried the > OneToOne model and that didn't work either). > > Thanks! James' blog post on it is more or less considered the one true way to do this: http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Re: How should I store credit cards for offline processing
On 12/1/06, Noah <[EMAIL PROTECTED]> wrote: > > I'm not in charge of such decisions. I only write the code. Doesn't remove the moral obligation on your part to do something about it, or refuse the work. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to restart Django/FastCGI/Lighttpd?
On 11/16/06, Tom Smith <[EMAIL PROTECTED]> wrote: > I'm sure there are better ways, but that's the way that works for me. > That sounds great and I tried setting up an SVN repos on Textdrive and it > beat me... following the docs, again, it's the concepts that get me, not the > specifics... > > I'm now in the awful position of hacking a live server to do fixes... and > people are using it... > > And the worst thing is, each time I kill the django-fcgi and lighttp... it > never quite boots the first time. I'm assuming that it takes django a while > to get up... in order for lighttp to connect with it... > > I really need to get to where you are now... Well, here's my suggestion then: Start a new thread here in django-users, asking for some TextDrive specific help. A lot of people on this list use TextDrive (a list member is even the one that created TextDrive's screencast). Maybe you can get some answers that way. For better or worse, I use Dreamhost, so I'm afraid I'm not much more help to you. I'm just worried that no one else is reading this thread right now, which is why no one is jumping in to help you with your TextDrive issue. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Automatically adding http:// to a URLField
You could also set a 'default' value for the field, something like default="http://; Then it will be prepopulated, which would help a little. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: syncdb doesn't handle blank=True correctly?
On 11/15/06, Stefan Foulis <[EMAIL PROTECTED]> wrote: > > Hi > > Starting with a empty database and running syncdb does not set the > fields in the resulting tables to allow NULL values on any fields > (not even the ones with blank=True) on my installation. > django correctly allows empty fields in the admin interface, but of > course the db backend complains as soon as django tries to save to > the db. > > Is this a known issue? Or is something bogus with my installation? > (I tried this with postgres and sqlite and had this problem with > Integer-, String- and ForeignKey-Fields. Manually changing the fields > in the db solved the problem.) blank=True is *only* for admin level validation, it has no effect on the db. You want null=True Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to restart Django/FastCGI/Lighttpd?
On 11/15/06, Tom Smith <[EMAIL PROTECTED]> wrote: > I tried the touching trick (on main.fcgi and django-fcgi.py) and it doesn't > work... is there another way to "refresh" django without having to kill the > root python process and lightpd? Sorry, no clue, I'm no expert. > Really though, you should be doing development with the built-in dev > > server, and then when you have your models and everything working, > > move to lighttpd. > Yes I know... hacking a "live" site is very silly but I have yet to master > how to turn my django project into a SVN project so that I can continue > working on it... Well, here's the way I do it. On my development machine, I do all my hacking out of a SVN working directory. When I get everything working how I want it locally, I do my 'svn commit', then login to my production server. >From there, I have an svn checkout. Go there, do my 'svn up'. Then, I do 'svn export --force ...' to make a pristine copy of the contents of the svn checkout into the directory that contains my actual running website. I'm sure there are better ways, but that's the way that works for me. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding a button to admin view?
> On 10/31/06, iain duncan <[EMAIL PROTECTED]> wrote: > > > > Hi folks, I would like to add a custom form button to the admin > > interface somehow and am not sure how to go about it. > > > > I want to add a "download now" button the list view for some file > > entries, so it needs to be a link to file. Any idea how this should be > > done? You might also be able to use the 'js' option to add some custom JavaScript to the page, and add the button via that. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Obsoleting by date
On 11/14/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote: > > Hello, I have a model which is obsoleted after a certain date, so that > I can just retrieve the entries from database which are in the future, > and not those which have already passed. > > Since I can't get into the djangoproject database, I guess I should > try here. Is there a way to .get() or .filter() those which have a > date in the future, or get a boolean to be true after a certain date? On one site I run, I like to separate the upcoming events (ie whose end_date is greater than or equal to the current date) from the past events. I have something like this in my urls.py: from datetime import datetime info_dict = { 'queryset': Event.objects.all(), } def get_upcoming(): return Event.objects.filter(end_date__gte=datetime.now()).order_by('end_date') urlpatterns = patterns('django.views.generic.list_detail', (r'^/?$', 'object_list', dict(info_dict,allow_empty=True, extra_context={'upcoming_events':get_upcoming})) ) The part of that which answers your question (I think) is: Event.objects.filter(end_date__gte=datetime.now()).order_by('end_date') Notice also that the 'upcoming_events' extra context is returned by a function. The reason for this is that I want datetime.now() to be called everytime the URL is accessed, not just the first time. Putting a function inside an 'extra_context' causes Django to call the function each time. Jay P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to restart Django/FastCGI/Lighttpd?
On 11/13/06, Tom Smith <[EMAIL PROTECTED]> wrote: > > I have been making changes to my code an not seeing the changes > happen... > > How do I restart django under Lighttpd/FastCGI so that changes to my > model etc stick? > If you're on a unix-like system, you should be able to just do a 'touch' on your .fcgi file. Really though, you should be doing development with the built-in dev server, and then when you have your models and everything working, move to lighttpd. Jay P --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---