genstatic - Generate and maintain static HTML files with Django templates
Hi all, Here is a GPLed software tool I made recently: http://github.com/redsymbol/genstatic Hope some of you find it useful and interesting. Please let me know if you have any feedback. Cheers, Aaron -- Aaron Maxwell http://redsymbol.net/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django-tel new features
Hi everyone, django-tel is an app that helps you make "click-to-call" URLs in your mobile web apps. More details are on its github page: http://github.com/hilomath/django-tel/tree/master Since its initial announcement here a few weeks ago, a template tag named "telify" has been added. telify will find all phone numbers in a block of text and transform them into "tel:" hyperlinks. So your template can include something like this: {{{ {% load tel %} {% telify %}Call 800-555-1212 to get your free gift today! (Not 866-555-1212, that is something else entirely.){% endtelify %} }}} ...which will finally produce an HTML response like this: {{{ Call 800-555-1212 today! (Not 866-555-1212, that is something else entirely.) }}} I have not tagged any version yet. But what's up there now will be very close to the official 1.0 version to be released soon. License is GPL version 3. Hope you find this of value. Please let me know of any comments, bug reports or feature requests. Cheers, Aaron -- Aaron Maxwell Hilomath - Mobile Web Development http://hilomath.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: parsing urls with dot
On Thursday 09 July 2009 05:47:48 am Dids wrote: > > Why not to add dots to your regexp? For example, [\w\d\-\.]+ ? > > I guess my question should have been: How come \. doesn't appear to be > matched in url.py? > That's the problem, it doesn't work. It should. Are you using raw strings? Post the whole urlpattern here, including the failed regexp, so we can give more specific feedback. -- Aaron Maxwell Hilomath - Mobile Web Development http://hilomath.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django-tel : telephone URL support for Django
On Thursday 09 July 2009 03:30:18 pm Chris Moffitt wrote: > How is this different from the built in phone2numeric filter? > http://docs.djangoproject.com/en/dev/ref/templates/builtins/#phone2numeric The tel filter creates the well-formed tel: hyperlink automatically. So where as {{"800-COLLECT"|phone2filter}} renders as this in the html response: 800-2655328 ... {{"800-COLLECT"|tel}} renders as this: 800-COLLECT That's the main difference. django-tel is more about RFC 2806 (tel: urls) than the phone-to-numeric conversion. Excellent question; thanks. I should put this in a FAQ or the README. -- Aaron Maxwell Hilomath - Mobile Web Development http://hilomath.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django-tel : telephone URL support for Django
Hi everyone. I've put up a django application providing a template filter, "tel", that helps format telephone URLs. This is helpful when writing mobile-optimized web sites, or other contexts you want "click-to-call" to work. For example, you can say something like this in your template: {{{ {% load tel %} Call {{"800-222-CASH"|tel}} now to get free money! }}} This will render into the following HTML: {{{ Call 800-222-CASH to get free money! }}} For now, please download from the github page: http://github.com/hilomath/django-tel/tree/master Django-tel is currently in development, and does not even have a release number set. But it's featurefull enough to be useful and has no known bugs at this time (except for non-USA support; see README.txt.) Any comments, bug reports, etc. are appreciated, and can be communicated to myself. Or use the github issue tracker. Cheers, Aaron -- Aaron Maxwell Hilomath - Mobile Web Development http://hilomath.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Design a good scrapbook system
On Wednesday 08 July 2009 09:07:54 am Sonal Breed wrote: > Hi all, > Can anyone tell me how to design a good scrapbook system like Orkut or > Facebook > where user can scrap or comment on other user's profile. I am trying > to develop this for a social networking site built in Django.. Well, this is kind of a big question, Sonal. There will be a lot of steps, because it's not a trivial web application. And it depends on the rest of the social site's design. Pinax is likely to be a helpful library for you. However, you will first need to get clarity about what the precise features will be and how they are used (i.e. user interface). The best approach is starting small, adding one small piece of functionality at a time, and proceeding incrementally. Good luck! -- Aaron Maxwell Hilomath - Mobile Web Development http://hilomath.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: changing apache mod python
Hm. It involves this module Deportista. I haven't heard of it, so I'm assuming it's either a third-party library you are using, or one a module made in house. You might try this: (assuming unixy environment) 1) At a shell prompt, set PYTHONPATH to the value you included in the attached error report page. (you know how to do this? If not, look up setting and exporting environment variables.) 2) Also set DJANGO_SETTINGS_MODULE 3) Start a python interpreter 4) type in "import entrenatech.views" Does this reproduce the Deportista importerror? If so, that is a good clue. On Wednesday 01 July 2009 12:55:05 am Miguel wrote: > The error is: > ViewDoesNotExist at / Could not import entrenatech.views. Error was: No > module named Deportista > As you said, Django .96 might be incompatible somehow, but I have to keep > it becasuse it is a little messy to updgrade the django version. Too much > production code. -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: changing apache mod python
On Monday 29 June 2009 12:09:58 pm Miguel wrote: > Hi all, > > I made an mistake of upgrading ubuntu to the last version. This new version > is running python 2.6 and it has also install the mod python for apache > linked to this python version. All my code is running django 0.96 with > python 2.5. > Now, the developments don't work. It says I have the following error: Hi Miguel, More detail about the exact import error is needed. But from what you've said so far, there are a few possibilities. First, your python code itself should be able to work fine with python2.6. Python 2.x is almost entirely backwords-compatible as versions increase, so your python 2.5 code should run just fine. However, Django 0.96 itself might be incompatible. I know that in the run up to the 1.0 release, they had to shake out some unicode and other minor errors that reared up in 1.0. If that is the case, you would probably want to try running your web app in django 1.0, porting it if need be. Finally: is it possible that the import error just has to do with a change in virtual host settings? I.e., in the Apache (virtual) host configuration, are you sure the PythonPath setting is correct? Perhaps some library location shifted, or something related to this changed during the upgrade. I'm afraid "downgrading" the server itself - even just mod_python - is really hard, messy and error-prone. Hopefully something written above points you to an easy solution. If not, I'd say (without knowing anything about your web app) your best bet is to port the site to django 1.0. Good luck. Aaron > > MOD_PYTHON ERROR > > ProcessId: 5225 > Interpreter:'x' > > ServerName: '' > DocumentRoot: '/htdocs' > > URI:'/' > Location: '/' > Directory: None > Filename: '/htdocs' > PathInfo: '/' > > Phase: 'PythonHandler' > Handler:'django.core.handlers.modpython' > > > At the end, it says I have an error importing a module. > > > does anybody know how to go back to the 2.5 python module? or how can I > resolve this problem? > > > thank you very much, > best regards, > > > Miguel > > -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to disable URL auto-completion
On Saturday 27 June 2009 12:16:24 am hugo wrote: > Hi everyone, > > Click this > > I want "Click this" to have hyperlink "myURL". However, the link > produced by the code above became > http://mySite/myURL instead of myURL. So if myURL is http://www.time.com, > the resulting link becomes http://mySite/http://time.com, which is Interesting. What version of django are you using? In 1.1beta, the site URL is not prepended in my test installation. However, it still does not do what you want; you would only want to encode a portion of the url, not the whole thing. The url encoding of "http://time.com"; is "http%3A//time.com". Not what you want. Right? In this example, you'd just want to say in the template: Click this (The safe filter is needed in case there are any query params, e.g. "http://time.com?x=1&y=2"; - you don't want that "&" to become "&", etc. See the template docs for the "safe" and "escape" filters if you're not sure what this means.) Now, if you truly do need to urlencode a path in a URL, you'd need to apply that separately. E.g. to get the result "http://time.com/who%20is%20he%3F";, you want to urlencode "who is he?" only, and leave the rest of the URL unmolested. The simplest way is probably to do the processing in the view code. Use python's urllib.quote or urllib.quote_plus functions on the path, append it to the toplevel domain url to create the full myURL. Then pass myURL directly to the template as above (again, remember the "safe" filter). This is the best approach for you most likely. Cheers, Aaron -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with startproject
On Tuesday 02 June 2009 10:46:03 am Technicalbard wrote: > OK - newb here (in more ways than one). I'm trying to get going on an > Ubuntu VM (inside VirtualBox) and I installed Django via synaptic. > > The problem comes when I try to start the tutorial: > > mor...@morgan-laptop:~/www$ django-admin startproject mysite > Error: [Errno 13] Permission denied: '/home/morgan/www/mysite' > > I made sure that I have ownership of the /www folder (as opposed to > root having ownership), but that didn't make a difference. What's the output from each of these commands: (all at the command prompt, one at a time) ls -dl /home/morgan/www ls -dl /home/morgan/www/mysite whoami touch /home/morgan/www/TESTFILE After the last one, does the file /home/morgan/www/TESTFILE exist? -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Do you use a skeleton for new django sites?
Hi all, When creating a new django based website, my first step used to be to invoke "python manage.py startproject". The files created would be the first or second commit into version control for that project. I found, however, that I would always make a similar set of changes right after: certain configurations and changes to settings, creating an apps directory (module), 404 and 500 templates, etc. So what I do now is I have a separate project, which I call django-skel, that is just a new project file layout with the changes I already want to make for every project. For each new project, I just export from that, copy the files into the new project space, and commit. Over time, I'll discover something new I'll want to add to all my django sites. So I just make that change to django-skel and forget about it. Does anyone else follow this technique? Or do you have some different approach that solves this problem for you? Thanks, Aaron -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL conf question .....
On Tuesday 26 May 2009 07:21:16 pm tekion wrote: > Part 3 tutorial from django site, suggest the below method of > optimizing urls. > urlpatterns = patterns('mysite.polls.views', > (r'^polls/$', 'index'), > (r'^polls/(?P\d+)/$', 'detail'), > (r'^polls/(?P\d+)/results/$', 'results'), > (r'^polls/(?P\d+)/vote/$', 'vote'), > ) > > the key factor, is that you must have a common prefix. Yes. > But what if > you do not have a common prefix, would it still work? Not with that single statement. However, you can use this feature with different prefixes by making multiple calls to the patterns function. Like this: {{{ urlpatterns = patterns('mysite.polls.views', (r'^polls/$', 'index'), (r'^polls/(?P\d+)/$', 'detail'), (r'^polls/(?P\d+)/results/$', 'results'), (r'^polls/(?P\d+)/vote/$', 'vote'), ) urlpatterns += patterns('mysite.widgets.views', (r'^widgets/$', 'index'), # etc. ) }}} Note that the first call says "urlpatterns = patterns", while the second says "urlpatterns += patterns". This works because patterns is a function that returns a simple Python list. If you do this, be careful that the first mention of urlpatterns is an assignment (=) and all subsequent mentions are appends (+=). Otherwise you'll loose all the url patterns that preceded the final assignment... an error that can drive you nuts if you don't know to watch out for it. -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django version
On Tuesday 19 May 2009 10:47:05 am VidrSan wrote: > How can I see django version on my web-server? Just python's code, > beaucause I can't find any information on hosting An addendum to others' replies - since I have several django sites still around that were made with different releases of django from the past two years, I like to put this in my settings.py: {{{ from django import VERSION as DJANGO_VERSION assert (1,1) == DJANGO_VERSION[:2], DJANGO_VERSION }}} (If, for example, this particular django site is expecting version 1.1.) -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Does a django social sharing widget app exist?
On Monday 18 May 2009 09:33:39 pm Sam Chuparkoff wrote: > I haven't looked at this, but here's a link: > > http://tylerlesmann.com/2009/mar/09/announcing-django-sociable/ This appears to be EXACTLY what I'm looking for. Thanks, Sam! -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to use filter
On Sunday 17 May 2009 11:00:15 pm laspal wrote: > list = Status.objects.filter(someid = 20, value < val2, value > val1) try this: list = Status.objects.filter(someid=20, value__lt=val2).filter(value__gt=val1) -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Does a django social sharing widget app exist?
Hi. Is anyone aware of a django app that helps with providing social-network sharing buttons to pages? I'm talking about services like Add to Any (http://addtoany.com/), or the Wordpress plugin known as Sociable (http://yoast.com/wordpress/sociable/). Ideally this would be a django app you could just add to the installed apps in settings.py, set a few config variables, then include something like {% social_share_buttons %} in the template. If this exists, google doesn't seem to know about it. Maybe I need to write it... Thanks, Aaron -- Aaron Maxwell http://redsymbol.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: registration module - log user in upon activation
There's an error in my code example. That "from registration.views import activate" should be something like "from registration.views import activate as original_activate", and the second line should be "resp = original_activate(request, activation_key)" - otherwise this view recurses infinitely. Basic idea is the same though. On Tuesday 26 August 2008 11:36:54 am Aaron Maxwell wrote: > {{{ > from django.contrib.auth import authenticate, login > from registration.models import RegistrationProfile > from registration.views import activate > > def activate(request, activation_key): > ''' > Wrapper around registration module's activate view, which logs in user > ''' > prior = RegistrationProfile.objects.get(activation_key=activation_key) > resp = activate(request, activation_key) > after = RegistrationProfile.objects.get(user=prior.user) > # The activation key is reset to the string "ACTIVATION_KEY" if > # the activation is successful > if after.activation_key != activation_key: > # user account has been activated > login(request, after.user) > return resp > }}} -- Aaron Maxwell http://redsymbol.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Test client: how to tell if user is logged in?
Hi all, Using django 1.0beta's test client, is there some reliable way to tell if a test user is logged in? It would be nice to do this within the test case code. However, even within a view, using request.user.is_authenticated does not seem to work properly. Thanks, Aaron -- Aaron Maxwell http://redsymbol.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
registration module - log user in upon activation
Hi all, I'm using django-registration 0.6 to handle user account creation: http://code.google.com/p/django-registration/ When the user activates their account (by following the activation link that they are emailed), what I'd like is for them to be logged in right away. As far as I can tell, this is not currently supported. Has anyone found a way to make this happen? One approach would be to wrap the activate view in a custom view, that also logs the user in - something like: {{{ from django.contrib.auth import authenticate, login from registration.models import RegistrationProfile from registration.views import activate def activate(request, activation_key): ''' Wrapper around registration module's activate view, which logs in user ''' prior = RegistrationProfile.objects.get(activation_key=activation_key) resp = activate(request, activation_key) after = RegistrationProfile.objects.get(user=prior.user) # The activation key is reset to the string "ACTIVATION_KEY" if # the activation is successful if after.activation_key != activation_key: # user account has been activated login(request, after.user) return resp }}} Unfortunately this does not work: django.contrib.auth.login requires that authenticate() be successfully called first. Within the view here, though, I don't have the password - the salted hash is stored in the User database, but not the plain password, which is what authenticate requires. Suggestions appreciated! Thanks, Aaron -- Aaron Maxwell http://redsymbol.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django-based forum software?
Thanks, everyone. -Aaron On Thursday 30 August 2007 09:47:41 Aaron Maxwell wrote: > Hi, > > Does anyone know of a django forum app? I.e., to build a site providing a > user forum. > > This is kind of hard to search on - try googling for "django forum"... -- Aaron Maxwell http://redsymbol.net Business Owners and Self-Employed: You're NOT Alone! The Business Butler - http://businessbutler.us --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django-based forum software?
Hi, Does anyone know of a django forum app? I.e., to build a site providing a user forum. This is kind of hard to search on - try googling for "django forum"... -- Aaron Maxwell http://redsymbol.net Business Owners and Self-Employed: You're NOT Alone! The Business Butler - http://businessbutler.us --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---