Re: Django cache created in one function not available to another?

2011-01-29 Thread Rob Hudson
This sounds similar to this bug :
http://code.djangoproject.com/ticket/15149

On Jan 28, 8:02 am, Lance Vick  wrote:
> So I have a function that sets cache (and successfully outputs it):
>
> def push_cache:
>     cache.set('foo_cache', 'FUBAR!!!')
>     foodata = cache.get('foo_cache')
>     print(foodata) # this works
>
> However when I try to access that cache from within a view and
> directly output it it returns None:
>
> def fetch_cache(request):
>     cache_data = cache.get('foo_cache')
>     return HttpResponse(cache_data) #this does not work.
>
> Am i misunderstanding something fundamental in how cache works?
>
> I am using the memcached backend in django 1.2.3

-- 
You received this message because you are subscribed to the Google 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: Check if django is getting a page from memcache

2010-02-13 Thread Rob Hudson
You can telnet to memcached and run the `stats` command.  That'll tell
you overall hits and misses (plus other info).  If you're using
Django's page caching middleware, you'll see 2 hits per page because
Django caches both headers and page content.  The page load you should
see 2 misses.  Then all subsequent page loads you should see the hits
counter increase.

-Rob

On Feb 13, 2:41 am, Alessandro Ronchi 
wrote:
> I am not sure django is getting a page from memcached. Is there a way to
> check it?
>
> Thanks in advance,
>
> --
> Alessandro Ronchi
>
> http://www.soasi.com
> SOASI - Sviluppo Software e Sistemi Open Source
>
> http://hobbygiochi.com
> Hobby & Giochi, l'e-commerce del divertimento

-- 
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.



Re: django-debug-toolbar and 404's

2010-02-12 Thread Rob Hudson
Can you test it by disabling the debug toolbar middleware?  I've
duplicated your exact settings as much as I can and it's working for
me.  If disabling the middleware makes the admin appear, then it would
seem something in the toolbar is causing the problem.

And you are right... those settings you refer to are optional.

Thanks,
Rob

On Feb 11, 10:57 pm, Rishabh Manocha  wrote:
> Mike,
>
> Thanks for replying. Reading through the django-debug-toolbar docs, those
> settings are all optional, so I just figured I don't need to set them for
> the default debug-toolbar functionality. I'll give it a shot though, just to
> make sure.
>
> Anybody else have any ideas??
>
> --
>
> Best,
>
> R

-- 
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.



Re: django-debug-toolbar with runserver not running on localhost

2010-02-05 Thread Rob Hudson
Or use the SHOW_TOOLBAR_CALLBACK to customize when you want the
toolbar displayed... I simply ship with what I consider reasonably
safe defaults.  For example:

# Always show the toolbar

DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK: lambda req: True,
}

# Only show toolbar for super user

def custom_show_toolbar(request):
if request.user.is_superuser:
return True
return False

DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
}


-Rob

On Feb 5, 1:23 am, chefsmart  wrote:
> If you use dcamer's forkhttp://github.com/dcramer/django-debug-toolbar
>
> you won't have to rely on INTERNAL_IPS and you can simply log in as a
> superuser to use django-debug-toolbar
>
> Regards.

-- 
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.



Re: django-tagging is not multi-db safe

2009-12-26 Thread Rob Hudson
> Django-tagging have a lot of users though. Maybe the pinax-people will
> arrange for a version that is 1.2-safe.

Check out django-taggit: http://github.com/alex/django-taggit

--

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.




Re: debug toolbar problem

2009-11-02 Thread Rob Hudson

It's looking like you have DEBUG=False and rely on
request.user.is_superuser to enable the toolbar.  Which mostly works,
except...

The Django Debug Toolbar monkey patches the CursorDebugWrapper class
to collect its data about what SQL queries are being executed:
http://github.com/robhudson/django-debug-toolbar/blob/master/debug_toolbar/panels/sql.py#L130

And this only gets used as a database cursor within Django when
settings.DEBUG=True:
http://code.djangoproject.com/browser/django/trunk/django/db/backends/__init__.py#L82

So when DEBUG=False, it uses a normal cursor which doesn't track SQL
queries.

-Rob

On Nov 2, 5:38 am, "bax...@gretschpages.com" 
wrote:
> > Are you caching your pages?
>
> Yes, but only for anonymous users
>
> > Are you using Django ORM?
>
> Yes
>
> > Have you added the DebugToolbarMiddleware to your MIDDLEWARE_CLASSES
> > in settings.py?
>
> Yes. In settings:
>
> MIDDLEWARE_CLASSES = (
>     'django.middleware.common.CommonMiddleware',
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.middleware.doc.XViewMiddleware',
>     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
>     'django.middleware.cache.CacheMiddleware',
>     'utils.lastseen.LastSeen',
>     'utils.ban_middleware.IPBanMiddleware',
>     'debug_toolbar.middleware.DebugToolbarMiddleware',
> )
>
> 
>
> DEBUG_TOOLBAR_PANELS = (
>             #'debug_toolbar.panels.version.VersionDebugPanel',
>             'debug_toolbar.panels.timer.TimerDebugPanel',
>             #'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
>             'debug_toolbar.panels.headers.HeaderDebugPanel',
>             'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
>             'debug_toolbar.panels.template.TemplateDebugPanel',
>             'debug_toolbar.panels.sql.SQLDebugPanel',
>             'debug_toolbar.panels.signals.SignalDebugPanel',
>             'debug_toolbar.panels.logger.LoggingPanel',
>         )
>
> 
>
> def custom_show_toolbar(request):
>             if request.user.is_superuser:
>                return True # Always show toolbar, for example purposes only.
>             return False
>
> DEBUG_TOOLBAR_CONFIG = {
>             'INTERCEPT_REDIRECTS': False,
>             'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
>            # 'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
>             'HIDE_DJANGO_SQL': False,
>         }
>
> INSTALLED_APPS = (
>     ...
>     'debug_toolbar',
> )
>
> I see the bars, and most appear to be working ( like version, for
> example, before I turned it off), but nothing on SQL
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson

Wow, that was a tricky one to track down...

After putting debug output in django/template/loaders/filesystem.py I
saw that filepath was set to:

'/Users/rob/git/anglers/anglers/templates/('book/
search_form.html',)'

I back tracked that and found that I had a trailing comma in my view
code:

if not template:
template = 'book/search_form.html',

I take it that gets interpreted as a single value tuple.  D'oh!  That
got there from a refactor where I copy/pasted that string when it was
in an extra_context dictionary and didn't notice the comma.

What's interesting to me, is that the file path got converted
correctly in the debug output but not in the template loader itself.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson

On Sun, Mar 29, 2009 at 8:28 AM, Karen Tracey  wrote:
> That generally means the permissions don't allow the code to access the
> file.  You don't mention if this happens with the dev server (which would
> surprise me, since you can load the template from the shell) or only with a
> real web server. If it's only with the real web server than I expect the
> permissions need to be fixed so that the web server can read the template
> file.

Yes, it's using the dev server.  I did check the permissions just in
case and they look fine (-rw-r--r--).

What is odd is I'm also using this template from a different view and
it loads fine.  I'm trying to debug now but I'm about to run out of
time and thought I'd throw it out here if anyone else encountered
this.

Thanks,
-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



TemplateDoesNotExist error when postmortem says it exists?

2009-03-29 Thread Rob Hudson

This is a stumper...

I have a very simple view that is a wrapper around the generic view
direct_to_template.  The loader finds the template as indicated in the
output "(File exists)", but yet I still get a TemplateDoesNotExist
error.  Any ideas?

I can go to the Django shell and load it just fine:
> ./manage.py shell
>>> from django.template.loader import get_template
>>> t = get_template('book/search_form.html')
>>> t

>>> t.name
'book/search_form.html'

Copy/Paste from debug output:

Template Loader Error:
Django tried loading these templates, in this order:
  Using loader
django.template.loaders.filesystem.load_template_source:
/Users/rob/git/anglers/anglers/templates/book/search_form.html
(File exists)
  Using loader
django.template.loaders.app_directories.load_template_source:
/Users/rob/django/django/django/contrib/admin/templates/book/
search_form.html (File does not exist)

Traceback:
File "/Users/rob/django/django/django/core/handlers/base.py" in
get_response
  92. response = callback(request, *callback_args,
**callback_kwargs)
File "/Users/rob/django/django/django/contrib/auth/decorators.py" in
__call__
  67. return self.view_func(request, *args, **kwargs)
File "/Users/rob/git/anglers/anglers/../anglers/book/views.py" in
search_form
  102. extra_context=extra_context,
File "/Users/rob/django/django/django/views/generic/simple.py" in
direct_to_template
  17. t = loader.get_template(template)
File "/Users/rob/django/django/django/template/loader.py" in
get_template
  81. source, origin = find_template_source(template_name)
File "/Users/rob/django/django/django/template/loader.py" in
find_template_source
  74. raise TemplateDoesNotExist, name

Exception Type: TemplateDoesNotExist at /advanced-search/
Exception Value: book/search_form.html

I'm using Django 1.1 beta 1.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Pass a queryset to the admin and display using existing app/model admin?

2009-03-28 Thread Rob Hudson

I have a use case where we want a search form to search across almost
all columns of this particular model.  Upon submit, I thought it would
be a nice feature (since this is already in the admin) to use the
already existing settings for my particular app/model instance.  Is it
possible to build up the queryset in my own view and pass that off to
the admin to display?

I already have a custom admin set up if there's something that's
close.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 quoting and escaping

2009-03-04 Thread Rob Hudson

I decided to follow Google's lead and pass it as a parameter of the
query string instead and all is well now.

Thanks for the feedback... I never considered it might be the web
server.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



URL quoting and escaping

2009-03-03 Thread Rob Hudson

At work we wanted to set up some quick clickthru tracking.  I whipped
up a quick solution that seemed to work on my local machine.  The
solution was to use jQuery to look for anchor tags who's href started
with "http://; as a signifier of external links, and add a click event
to them to direct them back to our server first.  Then catch that with
a view that logged it and redirected it back out.

I liked this solution because:
1) The user still sees where the link is going in the status bar on
hover.
2) If Javascript is off, there is no jQuery to affect the links and
they get sent along as normal.

Somewhere along the way the URLs are losing a "/" and the original URL
of "http://www.google.com; gets munged into "http:/www.google.com",
which is resulting in a 404 on our site.

Relevant code:

Javascript:

$(document).ready(function(){
$("a[href^='http://']").click(function() {
window.location = "/clickthru/" + escape(this.href);
return false;
});
});

URLs:

(r'^clickthru/(?P.*)/$', 'web.misc_views.clickthru'),

View:

def clickthru(request, url):
"""Log the URL then redirect"""
import urllib
url = urllib.unquote(url)
Log.objects.create_log('clickthru', request, url)
return HttpResponseRedirect(url)


If I test escape in the Firebug console, I get what appears correct:

>>> escape("http://www.google.com/;)
"http%3A//www.google.com/"

And unquoting in Python reverses it:

>>> import urllib
>>> urllib.unquote("http%3A//www.google.com/")
'http://www.google.com/'

Throwing an assert in my view shows that the url already has lost one
slash.

Any ideas would be helpful.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Advice on many to many with too many records in admin

2009-02-14 Thread Rob Hudson

On Sat, Feb 14, 2009 at 11:29 AM, Alex Gaynor  wrote:
> Have you tried using raw_id_fields with it?
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#raw-id-fields

Just now tested that out.  That works pretty well but the downside is
that, for the user, the ID means nothing.  It has the lookup button to
pick a book, but once selected, it's difficult to review that
everything looks correct before saving.

It does solve the too many records to search through problem, but
usability is lacking, IMO.

Thanks for the suggestion... I think I'll use it for now and see if
anyone else responds.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Advice on many to many with too many records in admin

2009-02-14 Thread Rob Hudson

Hi Django Users,

I'm setting up a new Django model for a Newsletter app.  The
newsletter model has a many to many to a Book model that has about
20,000 records.  This results in a multiple select box that is
unusable for searching/selecting books.

I have some ideas on what I can do to make this usable but I also
wanted to see if anyone else has had this problem and what they did to
work around it.

Some ideas with what I imagine are their pros/cons...

1) Instead of using a many to many, use a text field that the user
enters a comma separated list of items as lookup strings for the Book
model.  Pros: Pretty simple to do.  Cons: Opens up potentially lots of
user error by having to type exact strings for the model lookup.

2) Override the admin views and templates for adding and editing
Newsletters and use a different widget for selecting books.  The
widget could be an AJAX auto complete multiple widget of some sort, as
seen on a lot of sites.  Pros: Easier for the user to enter multiple
books using a common web pattern.  Cons: I'd say quite a bit more time
consuming to set up.

Any other ways to do this?  Or some examples of #2 to help someone
along?

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 Forms in HTML 4.01 Strict

2009-01-30 Thread Rob Hudson

Here's some food for thought on the subject of HTML 4.01 in Django (as
it's been discussed a lot before):

James Bennet brought up the HTML4 argument on the Django developers
list some time ago:
http://groups.google.com/group/django-developers/browse_thread/thread/a233bb5b3b39e147/7c9bf930a533345b

and later blogged about why he chose HTML4 for his personal blog:
http://www.b-list.org/weblog/2008/jun/18/html/

> I have not suggested such thing though. From a brief look at the source
> code, it appeared to me that it would be easy to create a setting that
> specifies whether to include the slash or not, and based on that setting
> write either " />" or ">" at the end of input tags (and ).

This has been written some time ago and shot down by Jacob:
http://code.djangoproject.com/ticket/3568

In the comment of the wontfix change he mentions he'd support a
template filter for this, along the lines of what django-html is doing
already.

I personally believe, if Django should choose only one doctype as its
default, it should choose HTML 4.01 and provide a filter for XHTML.
But I think I'm in the minority on that.  :)

Cheers!
-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: InternalError and transactions

2009-01-24 Thread Rob Hudson

On Jan 24, 11:41 am, Karen Tracey  wrote:
> Just a note -- what you are describing is unique URLs per-user.  You
> confused me a bit with how you phrased it as duplicate URLs are allowed by
> what you have specified, so long as they are associated with different
> users.

Right. Sorry for the confusion.

> You left out the form definition.  I'm guessing it's a ModelForm?  Also I'm
> guessing you excluded the user from the form?  Note if it is a ModelForm,
> and all the fields involved in unique_together were in fact included in it,
> then the form validation would do the unique check for you, and you wouldn't
> have to worry about the save causing a database error, assuming you could
> guarantee no other save was made that might invalidate the unique check done
> by is_valid() before the committing save() ran.  But if you exclude one of
> the fields or can't guarantee a duplicate entry hasn't been inserted between
> the validation check and the committing save, then you do need to deal with
> the potential database error.

For full disclosure, here's my LinkForm:

class LinkForm(ModelForm):
class Meta:
model = Link
exclude = ('user',)

def __init__(self, request, *args, **kwargs):
super(LinkForm, self).__init__(*args, **kwargs)
self.request = request
self.fields['category'].queryset = Category.objects.filter
(user=request.user).order_by('name')

Based on what you describe above, it sounds preferable to let Django
handle the unique_together on is_valid(), but I don't think I can do
that since I need to attach the user to the form later since I don't
know it until the request comes in.  So I'm stuck with having to do my
own error checking, correct?

> So...if you can't call transaction.rollback() because the code is not under
> transaction management, ensure it is under transaction management whenever
> you might need to call transaction.rollback().  Probably easiest to just
> wrap it in commit_on_success:
>
> http://docs.djangoproject.com/en/dev/topics/db/transactions/#django-d...
>
> Alternatively you could use the lower-level connection rollback routine and
> bypass the django.db.transaction layer, but I think it's cleaner to stick
> with the higher level routines.

OK.  I added commit_on_success to wrap the view and am now able to
rollback on IntegrityError.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



InternalError and transactions

2009-01-24 Thread Rob Hudson

I'm a bit at a loss as to where to go from here...

I have simple Link and Category models.  My Link model is essentially:
user_id, category (FK), name, URL.  I have a Meta unique_together on
(user, url) so no duplicate URLs get entered.  I'm testing this by
trying to purposefully enter a duplicate URL.

At first my code threw an IntegrityError so I'm trying to catch that.
Here's my create view:

def create(request):

errors = {}

if request.method == 'POST':
form = LinkForm(request, request.POST)
if form.is_valid():
link = form.save(commit=False)
link.user = request.user
try:
link.save()
except IntegrityError:
errors['Duplicate URL'] = 'That URL is already a
link.'
else:
return HttpResponseRedirect(reverse('links_index'))
else:
form = LinkForm(request)

return render_to_response(
'links/link_form.html', {
'form': form,
'errors': errors,
},
context_instance=RequestContext(request)
)

But I get an InternalError.  Trackback below:

Environment:

Request Method: POST
Request URL: http://localhost:8000/links/create/
Django Version: 1.1 pre-alpha
Python Version: 2.5.4
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'private_apps.links',
 'django_extensions']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'private_apps.middleware.RequireLoginMiddleware')


Traceback:
File "/Users/rob/django/django-trunk/django/core/handlers/base.py" in
get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/Users/rob/git/private_apps/private_apps/../private_apps/links/
views.py" in create
  61. context_instance=RequestContext(request)
File "/Users/rob/django/django-trunk/django/template/context.py" in
__init__
  105. self.update(processor(request))
File "/Users/rob/django/django-trunk/django/core/
context_processors.py" in auth
  27. 'messages': user.get_and_delete_messages(),
File "/Users/rob/django/django-trunk/django/contrib/auth/models.py" in
get_and_delete_messages
  262. for m in self.message_set.all():
File "/Users/rob/django/django-trunk/django/db/models/query.py" in
_result_iter
  186. self._fill_cache()
File "/Users/rob/django/django-trunk/django/db/models/query.py" in
_fill_cache
  667. self._result_cache.append(self._iter.next
())
File "/Users/rob/django/django-trunk/django/db/models/query.py" in
iterator
  281. for row in self.query.results_iter():
File "/Users/rob/django/django-trunk/django/db/models/sql/query.py" in
results_iter
  238. for rows in self.execute_sql(MULTI):
File "/Users/rob/django/django-trunk/django/db/models/sql/query.py" in
execute_sql
  1935. cursor.execute(sql, params)
File "/Users/rob/django/django-trunk/django/db/backends/util.py" in
execute
  19. return self.cursor.execute(sql, params)

Exception Type: InternalError at /links/create/
Exception Value: current transaction is aborted, commands ignored
until end of transaction block


Since this looked like a transaction issue I tried adding a
transaction.rollback() to my IntegrityError except clause but that
threw its own error that it wasn't in transaction management.

Side note: I'm curious if the IntegrityError might be worth putting in
the metaclass to add to the base model class, so one doesn't need to
import it specifically, they could use `except Link.IntegrityError`?

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Migrating MySQL -> Postgre, any working solutions?

2009-01-04 Thread Rob Hudson

I'm working on a project that is doing this and wrote a data migration
script.  The gist of it is that it connects to the old MySQL database
using straight MySQLdb, and connects to the new Postgresql database
using Django and the ORM.  I iterate over all tables and such and call
my ORM methods to create the new records and save them.

Here's a snippet:

import MySQLdb
from myproj.myapp.models import Lookup

# connect to old table
db = MySQLdb.connect(host=OLD_DB_HOST, user=OLD_DB_USER,
passwd=OLD_DB_PASS, db=OLD_DB_NAME)
c = db.cursor(MySQLdb.cursors.SSDictCursor)

# Import a lookup table
sql = 'SELECT * FROM lookup_table'
c.execute(sql)
while True:
row = c.fetchone()
if not row:
break
Lookup(name=row['name']).save()

-Rob

On Jan 3, 2:10 am, Szymon  wrote:
> Hello,
>
> I've found in archives message:
>
> > Check out django_extensions 
> > app,http://code.google.com/p/django-command-extensions/.
> > It has a command, dumpscript [...]
>
> It takes ages to complete. I've tried that method yesterday. I've
> turned off my web server and ran that command. After 6 hours it wasn't
> completed. (~1 GB database)
>
> So there is any other working solutions for migrating MySQL ->
> Postgre?
>
> Regards,
> Szymon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: sys.path trickery in settings.py

2009-01-04 Thread Rob Hudson

I wouldn't say it's frowned upon, per se, but you're making things
hard for yourself.  Why not add Django to your Python path?

There are other ways to go, too...

In the shell you're working in:
$ export PYTHONPATH=~/pkg/django-trunk
Then ./manage.py will find it without editing the file.

For myself, I have multiple versions of Django in a folder in my home
directory and manage which one is used via a .pth file in my Python
path.  See this snippet:
http://www.djangosnippets.org/snippets/641/

-Rob

On Jan 4, 1:56 am, George Cox  wrote:
> Hi,
>
> I keep my django-trunk installation (and other things like
> django_evolution) in my home directory, outside the system-wide
> installation   To avoid having to set PYTHONPATH in the environment, I
> set do this in my project settings.py file:
>
> #  sys.path trickery
> ---
> import os, os.path, sys
> root = os.path.abspath( os.path.dirname( __file__ ) or os.curdir )
> sys.path.insert( 0, os.path.normpath( os.path.join( root, '..', '..',
> 'pkg', 'django-trunk' ) ) )
> sys.path.insert( 0, os.path.normpath( os.path.join( root, '..', '..',
> 'lib' ) ) )
>
> as such, it's necessary to edit manage.py to move the "from
> django.core.management import execute_manager" below the "try / import
> settings / except" block.
>
> Is this frowned upon?  If not, hope this helps someone. :-)
>
> gjvc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Character encoding... latin1 to utf8?

2008-12-06 Thread Rob Hudson

Wow, thanks so much Karen, for slicing and dicing the problem like
that.

On Dec 6, 10:36 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> You could also just convert the character set used on the MySQL side:
>
> http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html
>
> Presumably since MySQL knows it really means cp1252 for stuff it calls
> latin1, it would convert properly to utf-8 when you told it to.  You'd
> sidestep the issues you've hit with 'latin1' meaning different things to
> different pieces of software.

The problem is, there is no cp1252 character set in MySQL as far as I
can tell, since cp1252 == latin1 to mysql.  And setting the keyword
argument to connect to "charset='cp1252'" threw a MySQL error.

My data migration script is working now, though, when I don't specify
'use_unicode=True' and manually run .decode('cp1252') on the columns I
need to.

Much thanks to both you and Malcolm for helping me get this cleared
up.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Character encoding... latin1 to utf8?

2008-12-06 Thread Rob Hudson

Thanks Malcolm,

On Dec 4, 6:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Now you might well be able to have this happen automatically using the
> "unicode" option to MySQLdb -- it knows how to convert between various
> server-side encodings and Python unicode. So look at that parameter to
> the connect() call. It's fairly well done in MySQLdb (it and PostgreSQL
> were almost trivial to make work when we added Unicode support to
> Django).

I actually had that set up already.  I'm trying to look at it a little
more closely.  Here's a dpaste of a SQL call and a few columns.  Look
at the "fdescr" column output... it's showing the string is unicode
but it has some characters in it like \x95 and \x92.
http://dpaste.com/96601/

> Alternatively, if you're getting bytestrings backs, run them through a
> decode() call:
>
>         data = original_data.decode('cp1252')

I tried this at the bottom of the above dpaste just to see... I know
I'm not getting bytestrings back.  So I tried it also without the
unicode=True flag to connect and it produces different output than
above:

>>> row['fdescr'].decode('cp1252')
u'Lefty Kreh is one of the most experienced, well-prepared, and
thoughtful anglers in the world. In 101 Fly-Fishing Tips, he
shares this wealth of experience with a variety of common-sense
solutions to the problems that anglers face. Included are tips on:
\u2022how to pacify a fish \u2022which hook-sharpening tools to use and when \u2022how to take a rod apart when it\u2019s stuck \u2022what to do when a fish runs under your boat \u2022how to dry waders and find leaks \u2022why long hat brims affect casting accuracy \u2022and much moreSure to improve a fly fisher\u2019s success, comfort, and enjoyment while on the water. A must for any angler.ABOUT THE AUTHORLefty Kreh is an internationally known and respected master in the field of fly fishing, and the author of numerous articles and books on the subject. He lives in Maryland.' Now instead of \x95 I get \u2022 (which is a bullet). >From here I'm not sure what the best way to proceed is... do I want the \u2022 version instead, in which case, should I not pass in unicode=True and manually decode each column? I'm partly thinking that since this is a one-time operation (actually, it's a many one-time operation until we're ready to switch over to the new site), I could scan for any "\x" characters and manually replace them. There are likely only a handful as in the above. But how does one scan and replace these so the output is correct? > Just for laughs, though, try running "file" on the csv file you generate > and make sure it, at least, detects that it is a UTF-16 file. It actually tells me nothing... > file export.csv export.csv: Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe 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: No module named urls

2008-12-04 Thread Rob Hudson

On Dec 4, 12:59 am, Rob Hudson <[EMAIL PROTECTED]> wrote:

> I'll keep poking around a bit and see if I can dig up anything
> further.

I think I tracked it down...

Looking at the tracebacks above, you can see the first time through,
it winds up on line 198 which tries to import the urls.py file.  In my
particular case, the urlconf_name was "profiles.urls".  And indeed, my
local (in my project) profiles app does not have a urls.py file in
it.  If I `touch profiles/urls.py` things work, sort of.

The thing is, I'm using James Bennett's django-profiles package and
it's not in my project but it's on my Python path.  There are no
models, so I never put it in my INSTALLED_APPS (though reading now,
the docs say I should have)... I only reference the profiles.urls in
my root urls via include(), and that pulls in the urls from the
profiles app on my Python path.  I have a local project app also
called profiles, however, that doesn't include a urls.py (because I'm
using the one from James'), and this is the reason for the breakage.

Having the app named `profiles` is the perfect name but it can't exist
on my Python path and in my project without a conflict.  I tested
renaming mine, putting the "profiles" in my INSTALLED_APPS, and all is
well now.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: No module named urls

2008-12-04 Thread Rob Hudson

On Dec 3, 11:01 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> This is an area where Django has poor error handling and we're slowly
> cutting them down. So you have to do a bit of commenting out and
> experimenting on the command line (just try a simple reverse() call each
> time to trigger it) to work out the problem.
>
> It's the first error that you should pay attention to here. Subsequent
> "successes" are misleading -- they're not raising errors, but something
> is still not working properly.

Is this helpful at all then?

This is importing `reverse` and running it twice with the same URL
named view where I'm seeing the error.  I'm doing it twice to see the
difference...

>>> from django.core.urlresolvers import reverse as r
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 161, in _get_reverse_dict
for name in pattern.reverse_dict:
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 154, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 198, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 243, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for 'django-admindocs-docroot' with arguments
'()' and keyword arguments '{}' not found.


I was suspecting that not having this line in my urls.py was tripping
it up so I added it:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

A slight difference was observed...

>>> from django.core.urlresolvers import reverse as r
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 161, in _get_reverse_dict
for name in pattern.reverse_dict:
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 154, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 198, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls
>>> r('django-admindocs-docroot')
'/admin/doc/'

I'll keep poking around a bit and see if I can dig up anything
further.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: No module named urls

2008-12-03 Thread Rob Hudson

It's odd... I'm getting the exact same error at the exact same spot,
running Django trunk r9550.  What's strange is that it gets the 500
error on first request, and is ok all subsequent requests.

On Nov 26, 9:34 am, TheIvIaxx <[EMAIL PROTECTED]> wrote:
> So i've narrowed down the problem more.  Its failing on the template
> call to {% url django-admindocs-docroot as docsroot %} on the admin
> page and all other pages.  If i remove this line, the site works just
> fine, recognizing all urls defined.  Not sure just the template engine
> would fail to see the urls.py, but everything else does.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



getting request.user into a ModelForm?

2008-11-06 Thread Rob Hudson

I have the following:

## MODELS

class Category(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=200)

class Link(models.Model):
user = models.ForeignKey(User)
category = models.ForeignKey(Category)
name = models.CharField(max_length=255)
url = models.URLField(max_length=255)

## FORMS

class CategoryField(forms.Field):
def clean(self, value):
if not value:
raise forms.ValidationError('This field is required.')
try:
category = Category.objects.get(user=???, name=value)
except Category.DoesNotExist:
category = Category(user=???, name=value)
category.save()
return category

class LinkForm(ModelForm):
category = CategoryField()
class Meta:
model = Link
exclude = ('user', 'url')

## VIEWS

def create(request):
if request.method == 'POST':
form = LinkForm(request.POST)
if form.is_valid():
link = form.save(commit=False)
link.user = request.user
link.save()
return HttpResponseRedirect(reverse('link_list'))
else:
form = LinkForm()

return render_to_response(
'links/link_form.html', {
'form': form,
},
context_instance=RequestContext(request)
)

What I don't see is a way to get the user up into my field the way I
have things set up.  I originally didn't have a user FK on the
Category model but decided I wanted it so that when adding new Links,
the Categories can be filtered by user so each user sees only their
categories.

I'm stuck here.  Any help is much appreciated.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Any way to avoid the SQL hit of auth_messages?

2008-10-20 Thread Rob Hudson

Hi,

I'm wanting to reduce an unneeded query from my page views in my
project caused from Django's built-in auth_messages.  I'm looking for
the best solution to do this while still allowing me to use contrib/
auth and the admin.

The source of the query comes from the 'auth' context processor, I
believe.  So one solution I've thought of would be not to use it.  But
then the admin breaks horribly.

I'm curious of 2 workarounds:

1) Add the 'auth' context processor only for URLs starting with '/
admin/'?
2) Since I might want the user object hanging off of request at some
point, write my own auth context processor that doesn't add messages
or permissions stuff to request.  I'm not sure exactly which parts of
the 'auth' context processor the admin uses so maybe this would need
to also do #1.

Or is there a better way to take care of this want (not necessarily a
"need").

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms admin and custom widgets

2008-09-17 Thread Rob Hudson

I was playing with this again tonight and it's just not working for me
no matter what I try.  I'm wondering if there are issues with
ManyToMany and Inlines and trying to override them?


On Jul 24, 5:23 pm, "Rob Hudson" <[EMAIL PROTECTED]> wrote:
> > SpecialBookFormSet = inlineformset_factory(Newsletter, Special,
> > form=SpecialBookForm)
>
> > [1]:http://www.djangoproject.com/documentation/modelforms/#model-formsets
>
> Hmm... I'm still not able to get it to work.  I think I'll try to
> whittle my code down to an example that I can play with and post a
> without all the clutter of my real code.
>
> I suppose I should first create a custom model field without it being
> an inline and make sure I understand that, and then bring it (and my
> new found understanding) over to extending that towards an inline
> custom model field and custom widget.
>
> -Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: DjangoCon keynote transcript/summary

2008-09-17 Thread Rob Hudson

On Sep 17, 7:29 am, Delta20 <[EMAIL PROTECTED]> wrote:
> PS: Does anyone know what Cal was using to show the queries in
> Pownce(I think that's what it was)? That looked pretty handy.

I don't know what tool it was or if it is available but I started a
project with a similar purpose that is gaining some steam:
http://github.com/robhudson/django-debug-toolbar/tree/master

Cheers!
-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Newforms admin and custom widgets

2008-07-18 Thread Rob Hudson

Hello,

This is question my get long so I'll post the short version then the
longer more detailed version:

The short:
My goal is provide the user with an autocomplete AJAX widget to
quickly look up ISBNs. The ISBNs will end up in a text field in HTML
to be sent back to the backend where I'd like it split and save in the
ManyToMany field.

As a first deep foray into newforms I'm getting stuck at multiple
levels.

The long:

I have a Newsletter model with some basic fields.  I have a Special
model with FK to Newsletter and ManyToMany to books for book specials
to be included with the newsletter.  Since the Book model contains 16k
+ records the default admin for this takes forever to load and render
which makes it unusable.

I found a django snippet that I tried to adapt to create a
CommaSeparatedBooks(Field|Input) here:
http://www.djangosnippets.org/snippets/595/

>From there I'm trying to create a ModelForm from my Special model and
override the book field to use my custom Field.

Then I'm providing the FormSet to the StackedInline class to use.

At this point I'm getting an error when I load the admin:
Error while importing URLconf 'anglers.urls': 'ModelFormOptions'
object has no attribute 'many_to_many'.

So I've decided to come here for help and try to see where I've gone
astray.  See code below.

## admin.py

from django.contrib import admin
from django.db.models.fields.related import ManyToManyField
from django.newforms import ModelForm
from django.newforms.fields import Field
from django.newforms.models import modelformset_factory
from django.newforms.util import ValidationError
from django.newforms.widgets import Input
from anglers.book.models import Book
from anglers.newsletter.models import Newsletter, Special

# Widgets and Fields

class CommaSeparatedBooksInput(Input):
input_type = 'text'
def render(self, name, value, attrs=None):
if value is None:
value = ''
elif isinstance(value, (list, tuple)):
value = ', '.join([book.isbn for book in value])
return super(CommaSeparatedBooksInput, self).render(name,
value, attrs)

class CommaSeparatedBooksField(Field):
widget = CommaSeparatedBooksInput
def clean(self, value):
super(CommaSeparatedBooksField, self).clean(value)
if not value:
return ''
if isinstance(value, (list, tuple)):
return value
isbns = set(value.split(','))
isbns = set([isbn.strip() for isbn in isbns])
books = list(Book.objects.filter(isbn__in=isbns))
unknown_books = isbns ^ set([book.isbn_clean for book in
books])
if unknown_books:
raise ValidationError('Book ISBN values not found: %s' %
str(unknown_books))
return books

# ModelForms and FormSets

class SpecialBookForm(ModelForm):
books = CommaSeparatedBooksField()
class Meta:
model = Special

SpecialBookFormSet = modelformset_factory(SpecialBookForm)

# ModelAdmins with Inlines

class SpecialAdmin(admin.ModelAdmin):
list_display = ()
search_fields = ()
ordering = ()

class SpecialBookInline(admin.StackedInline):
model = Special
formset = SpecialBookFormSet

class NewsletterAdmin(admin.ModelAdmin):
list_display = ('start_date', 'end_date')
ordering = ('-start_date',)
inlines = (SpecialBookInline,)

admin.site.register(Newsletter, NewsletterAdmin)
admin.site.register(Special, SpecialAdmin)



## models.py

class Newsletter(models.Model):
message = models.TextField()
start_date = models.DateField(default=datetime.today)
end_date = models.DateField()

def __unicode__(self):
return u"Newsletter from %s to %s"

class Special(models.Model):
newsletter = models.ForeignKey(Newsletter)
header = models.CharField(max_length=200, core=True)
message = models.TextField()
books = models.ManyToManyField(Book)

Thanks for any guidance.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: request getlist() in order?

2008-07-18 Thread Rob Hudson

Thanks Arien!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



request getlist() in order?

2008-07-16 Thread Rob Hudson

If I have a form like the example:




The Beatles
The Who
The Zombies




And I call request.POST.getlist('bands'), is the order of the bands
going to always be the same as provided in the select box?

Or another case, if I have the form:


Select bands in the order you want them to play:

The Beatles
The Who
The Zombies


The Beatles
The Who
The Zombies


The Beatles
The Who
The Zombies




In this case, only 1 item can be selected per select box but they are
all named the same so I can get them as a list via getlist().  Will
the value of getlist() be in order as selected in the form?

I'm trying to determine if I can do something the easy way (depend on
the order as provided in the form) or do I have to name the fields in
such a way to remember the order on POST.

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson

On Jul 9, 8:07 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Rob, I am never letting you do my financial programming for me. Float
> fields lose precision. Inexact. Approximate.

Heh.  Sorry.  I was misunderstanding "arbitrary".  Yeah, don't listen
to me, obviously.  :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Generic delete view.

2008-07-09 Thread Rob Hudson

It took me a minute to see it, but "str object not callable" is
referring to the fact that your URL pattern is providing a string as
its 2nd argument and "delete_object" (the string) cannot be imported
and called.

You can either:

1) Use the actual view you imported (i.e. remove the single quotes).

2) Specific the 2nd argument in the URL pattern as the full path to
the delete view: "django.views.generic.create_update.delete_object"

I saw a reference on Django devs mailing list that these will be
updated *very soon* to use newforms.

-Rob

On Jul 8, 7:14 pm, William <[EMAIL PROTECTED]> wrote:
> Hi, I'm having a bit of trouble using the delete generic view in
> Django SVN. I have the following entry in my urlpatterns:
> from django.views.generic.create_update import *
> urlpatterns = patterns('',
> ...
> (r'^calendar/delete/(?P\d+)/$','delete_object',
> {'model':Event,'post_delete_redirect':'/calendar/'}),
> ...
> )
>
> And in a template, I have the following hyperlink:
> Delete Event
>
> When I click on the link in the above template, I get the following:
> TypeError at /calendar/delete/1/
> 'str' object is not callable
> /usr/lib/python2.5/site-packages/django/core/handlers/base.py in
> get_response, line 86
>
> I've tried various different ways of calling this generic view, but
> none seem to work.
> As a side note, is it worth using generic views such as create and
> update since they still use oldforms?
>
> Thanks for any help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Black Box Testing Framework for Django

2008-07-09 Thread Rob Hudson

I've seen articles using Twill:
http://twill.idyll.org/

And Selenium for Javascript testing:
http://selenium.openqa.org/

I'm pretty sure Twill would meet your definition of "Black Box
Testing" since it has no knowledge of the internals of the Django app
you are testing.

-Rob

On Jul 8, 10:55 pm, Pepsi330ml <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I am reading up on how to use external testing framework on Django Web
> Application.
> Particularly, Black Box Testing.
> Anybody using any particular framework on Django? Please kindly
> advise.
>
> Currently, i am looking into using HttpUnit on Django.
>
> Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson

FloatField?
http://www.djangoproject.com/documentation/model-api/#floatfield

On Jul 9, 4:02 am, shabda <[EMAIL PROTECTED]> wrote:
> I need to do some Financial calculations in an app in Django.
> models.DecimalField is fixed precision, while I need an arbitrary
> precision field. How can I do this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: accessing a model ojbect's saved fields

2008-07-09 Thread Rob Hudson

Could you override the save method and remove the file from the
filesystem prior to saving?

e.g.

class MyModel(models.Model):
...

def save(self):
if self.id: # is a record in the database
# file system unlink call to self.path
super(MyModel, self).save()

-Rob

On Jul 9, 6:22 am, pihentagy <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> Is it possible to access a model object's saved field values?
> Purpose:
> I have an ImageField, and if that field changes, I would like to
> remove the old file from the filesystem. Now the only way to figure it
> out is with a new query, but I suspect this hits the database again,
> and seems a bit hacky BTW.
>
> thanks
> Gergo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: In admin, unable to save many-to-many relation objects with intermidiate table

2008-07-09 Thread Rob Hudson

I just bumped into this last night and found that having core on the
ForeignKey field cause it to not save the record.  Try removing
core=True and see if that helps.

-Rob

On Jul 8, 6:02 pm, "ristretto.rb" <[EMAIL PROTECTED]> wrote:
> Hello, I'm stuck.  Any help will be much appreciated.
>
> I 
> followedhttp://www.djangoproject.com/documentation/models/m2m_intermediary/to
> make a
> Many-to-many relationship via an intermediary table.
>
> class LeftSide(models.Model):
> :
>
> class RightSide(models.Model):
> :
>
> class JoinTable(models.Model):
>     leftSide = models.ForeignKey(LeftSide,
>                 edit_inline=models.TABULAR,
>                 num_in_admin=3, core=True)
>     rightSide = models.ForeignKey(RightSide,
>                 edit_inline=models.TABULAR,
>                 num_in_admin=3,core=True)
>     reference_no = models.CharField(max_length=10, null=True, blank=True)
>
> I can load the LeftSide in the admin, and choose to Change a record.  I
> get 3 RightSide menu groups at the bottom.  I can choose a RightSide to
> set as a join.  When I choose Save (any of the 3 save variations on the
> page) nothing is saved.
>
> There are two cases.
>
> 1)  If the are already records in the join table for that LeftSide, then
> I get an error when I save.  {'jointable.0.id': [u'Join Table record
> with this ID already exists.']}  I didn't actually make any changes to
> that association, so I don't know why it would complain.
>
> 2)  If there are no join table records associated with the LeftSide,
> then there is no error, but nothing is saved, either.
>
> Am I doing something totally wrong here?  Or is this a bug in the Admin
> system?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Calendar of Events

2008-07-07 Thread Rob Hudson

Google is your friend:
http://code.google.com/p/django-event-calendar/

On Jul 7, 2:13 pm, Mario <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I’m a NOOB and I was wondering if there are any calendars of event
> model that will allow a user to click on a specific date with the
> associated listing of events. Any suggestions or recommendations are
> appreciated.
>
> Thank you.
> Goober
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using a Custom Manager for date based generic views??

2008-07-06 Thread Rob Hudson

On Jul 6, 3:53 pm, Christopher Clarke <[EMAIL PROTECTED]> wrote:
> class IssuerManaager(models.Manager):
>
>      def with_aggs(self):
>          from django.db import connection
>          cursor=connection.cursor()
>          cursor.execute("""
>              select i.id,max(i.name), m.dateix AS period_ending,
>              count(*) AS no_funds,
>              sum(vd.total_units_issued_outstanding) as  
> total_units_issued_outstanding,
>              sum(vd.total_unit_holders) as no_unit_holders,
>              sum(vd.tt_total_net_assets_under_management) AS  
> net_assets_under_management,
>              sum(vd.tt_value_redemptions) AS total_redemptions,
>              sum(vd.tt_value_sales) AS total_sales
>              FROM core_fundvolumedata vd, core_fund f, core_issuer i,  
> freqdates_monthly m
>              WHERE f.id = vd.fund_id AND f.issuer_id = i.id AND m.id =  
> vd.period_ending_id
>              GROUP BY i.id, m.dateix, vd.period_ending_id
>              ORDER BY i.id, m.dateix;
>              """)
>          results_list= []
>          for each in cursor.fetchall():
>              p= self.model(id=each[0],name=each[1])
>              p.period_ending=each[2]
>              p.no_funds = each[3]
>              p.units_issued_outstanding=each[4]
>              p.no_unit_holders=each[5]
>              p.net_assets_under_management=each[6]
>              p.redemptions=each[7]
>              p.sales=each[8]
>              results_list.append(p)
>          return results_list
>
> class Issuer(models.Model):
>      name = models.CharField(max_length=100)
>            --
>            --
>            --
>      objects = IssuerManaager()
>
>    The manager works but when i try to use it in the generic view
>
>       return archive_month(
>                           request,
>                           year=year,
>                           month=month,
>                           queryset = Issuer.objects.with_aggs(),
>                           date_field = 'period_ending',
> I get
> list' object has no attribute 'model'
> Am i on the right track and how do i get this to work??
> Thanks for any help
> Regards
> Chris

The thing is, your manager method is returning a list, and the generic
view is expecting a queryset.  If you can get a list of ids from you
custom SQL you could then create a QuerySet object to return by using
the 'in' filter:
http://www.djangoproject.com/documentation/db-api/#in

Or write your own view that expects a list that is similar to the
archive_month view.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: clean_* method for ModelForms?

2008-07-06 Thread Rob Hudson

So if I understand correctly, you are saying make author a
not-required field so is_valid() will validate to True.  Then in my
view do the commit=False on save, check if author is present and if
not, set the default author, then call save().  Something like that?

On Sun, Jul 6, 2008 at 11:35 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> Oh, `required=True` of course
>
> On Jul 6, 10:31 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>> Field for `author` created with `required=False`. And `clean` method
>> doesn't call `clean_author` if `author` data isn't present.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: raising HttpResponseBadRequest throws Exception Type error?

2008-07-06 Thread Rob Hudson

On Jul 5, 7:33 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Having an exception
> for every possible response code is really overkill here, since it means
> you'll be raising status-code-related exceptions instead of more
> semantic ones.

Ah, makes sense.

> > * Shouldn't Django be consistent in its own raising of errors and
> > choose one way to do it (e.g. choose #1 above over #2)?  Out of
> > curiosity I grep'd the code to count how many chose the paren method
> > vs the comma method:
>
> Meh. They're both perfectly valid Python and people should be able to
> read either. It really makes no significant difference at all. I tend to
> use the parenthesised version in my own code (partly because it's easier
> to split across multiple lines), but the other form is just as readable.

Agreed.  Not worth it.

Thanks for the reply Malcolm.  Very informative as always.

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



raising HttpResponseBadRequest throws Exception Type error?

2008-07-05 Thread Rob Hudson

In my code for an API it made sense to me to import and raise
`HttpResponseBadRequest ` when the API was given bad data to work
with.  I'm importing and raising the error like this:

from django.http import Http404, HttpResponseBadRequest
raise HttpResponseBadRequest, "Invalid data"

But when I do that, I get a TypeError:

Exception Type: TypeError at /api/v1/clips/new/
Exception Value: exceptions must be classes, instances, or strings
(deprecated), not type

I thought this was similar to Http404 until I looked at the code in
django/http/__init__.py and see that the Http404 is subclassing
Exception while most of the other "errors" subclass HttpResponse.  And
there is even a HttpResponseNotFound that has a status_code of 404 to
confuse matters even more.

I also grep'd the codebase to see what was the proper way to raise an
error and saw two ways:

1) raise Http404("Error message here.")
2) raise Http404, "Error message here."

I tried both for my `HttpResponseBadRequest` and still got a type
error.  Following the logic that this is just a subclasses
HttpResponse I changed it to a return:

return HttpResponseBadRequest("Error message here.")

and that worked.

In the end I was a bit confused by all of this and came away wondering:

* Shouldn't all HTTP error code raising function similarly?  Shouldn't
I be able to raise a 400 error the same as a 404?

* Shouldn't Django be consistent in its own raising of errors and
choose one way to do it (e.g. choose #1 above over #2)?  Out of
curiosity I grep'd the code to count how many chose the paren method
vs the comma method:

~/sandbox/django/django_trunk/django > egrep -R 'raise \w+\(.*' * |
grep -v .svn | wc -l # paren method
 371
~/sandbox/django/django_trunk/django > egrep -R 'raise \w+,.*' * |
grep -v .svn | wc -l # comma method
 184

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Inheriting from auth.models.User

2008-07-01 Thread Rob Hudson

On Jun 30, 9:43 pm, Michael Richardson
<[EMAIL PROTECTED]> wrote:
>
> There's a patch for this -http://code.djangoproject.com/ticket/3011

Dangit!  Michael beat me to it!  :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Timezone conversion

2008-06-14 Thread Rob Hudson

Check out the source of Brian Rosner's project here:
http://code.google.com/p/django-timezones/

-Rob

On Jun 13, 1:07 am, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> I want to convert a datetime field for an entry in my database to a
> specified timezone. Here is the code I have so far:
>
> from dateutil.parser import *
> from dateutil.tz import *
> from datetime import *
>
> event = get_object_or_404(Event, id__exact=eventid)
> edate = event.date
> tz = gettz('America/New_York')
> edatetz = edate.astimezone(tz)
>
> Now, when I do this, I get something along the lines of "naive
> datetime" for the edate variable. However, if I change the edate
> variable to the following line of code, it works:
>
> edate = datetime.now(tz=gettz('UTC'))
>
> Any ideas why this is happening? Is it the way I am storing the
> datetime in my MySQL database? I'm using a standard datetime field -
> is it missing something?
>
> Cheers,
> Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



auto_add or default or save?

2008-05-25 Thread Rob Hudson

I don't recall where, but I thought I had heard once that the auto_add
and auto_add_now options to date fields in models was going away.

I've seen 2 main options in the wild and I'm not sure which is
preferred... I suppose each has its own use case:

1) Add default=datetime.now to the field.  This seems to provide a
pre-save setting of a date that shows up in the admin and can be
changed prior to saving.  Looks like it's good for a created date
field if you're ok with the idea that you can change it in the admin.

2) Override save and set the field prior to saving.  This seems like
it's good for an 'updated' date field that automatically updates every
time it's saved.

Are those breakdowns accurate?  Is the auto_now_* stuff really going
away?  And if so, could the docs be updated to reflect that?  Are
there other ways to get 'created' and 'updated' functionality?

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem storing utf-8 in MySQL

2008-04-13 Thread Rob Hudson

On Apr 13, 6:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Do you mean that you are coming across a case of trying to store 4-byte
> UTF-8 sequences in MySQL? Or do you mean that you've managed to create a
> database table with the incorrect encoding and only realised this after
> you've stored data in the table? Or is there a third possibility?

Thanks for the follow up...

In my particular case I have an old database with content that has
built up over the years from a PHP website.  I'm re-building the site
in Django and am working on a database migration script.  For various
text fields in the old tables I was hitting this same error,
"Incorrect string value: '\x[something or other]'  for column
'[something]' at row 1".

I actually ended solving it by telling MySQLdb to "use_unicode", e.g.:
db = MySQLdb.connect(host=OLD_DB_HOST, user=OLD_DB_USER,
passwd=OLD_DB_PASS, db=OLD_DB_NAME, use_unicode=True)

I believe the old tables were latin-1 encoded so it seems like this
forces them to be unicode encoded which made pushing into the new
tables as utf8 work correctly?

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem storing utf-8 in MySQL

2008-04-13 Thread Rob Hudson

On Mar 21, 4:19 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> OK, got it now.  Turns out the answer is in the clear-as-mud error message,
> sort of:
>
> Warning: Incorrect string value: '\xF0\x90\x8C\xBC\xF0\x90...'
>
> x'f0908cbc' is a valid 4-byte UTF-8 value, only MySQL doesn't support 4-byte
> UTF-8.  Its 'utf8' character set only supports up to 3-byte UTF-8, see:
>
> http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html
>
> Support for 4-byte UTF-8 is listed near the top of what's coming in 6.0:
>
> http://dev.mysql.com/doc/refman/6.0/en/mysql-nutshell.html
>
> I've seen references to turning off strict mode in MySQL to get rid of
> problems like this, but haven't played with that at all.  I'm not sure what
> MySQL will do with the problem data if you turn off strict mode.
>
> If you want to just remove the problematic 4-byte UTF-8 codes from the file,
> they're only present in the Gothic (line 47) and 2nd Vietnamese (line 123)
> of the "I Can Eat Glass" translations.  Without those two translations MySQL
> accepts the data.
>
> Karen

For those of us having a very similar problem elsewhere, what's a good
general solution?

1. Check that the table is indeed utf8.
2. ???

Does attempting to re-encode the UTF8 string work?  Try the mysql
strict mode thing you mentioned?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Need Help Thinking Through How to Setup URLS and VIEWS

2008-03-30 Thread Rob Hudson

On Mar 29, 2:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Specifically, i need help with:
> 1. How do I test to see what a slug is? I.E. In my case, is it a
> section or a page.
>
> Finally, am I barking up the wrong tree? Would it be simpler to just
> write a custom view that does what I want? Any advice is much
> appreciated.

I think the flow could go something like the following.  I'm guessing
that it makes sense to check the Section slug before the Page slug but
that could easily be reversed...

def section_or_page(request, slug):
# Look for section and call section_detail if found
try:
section = Section.objects.get(slug=slug)
except Section.DoesNotExist:
pass # Check for page down below
else:
return section_detail(request, section) # another view
# Look for page and call page_detail if found
try:
page = Page.objects.get(slug=slug)
except Page.DoesNotExist:
pass # return 404 below
else:
return page_detail(request, page)
# Otherwise, return 404
raise Http404, "No page or section found matching the slug: %s" %
(slug)

Then your detail views can do what you'd normally do, for example:

def section_detail(request, section):
# get other pieces from other models?
return render_to_response('section/blah.html', {'section':
section, 'other': other_model},
context_instance=RequestContext(request))

Hope that helps,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms-admin questions

2008-03-09 Thread Rob Hudson

How's the stability and/or "readiness" of newforms-admin?

I have a project where I'm going to be needing to do some admin
tweaking and it sounds like newforms-admin is much more flexible.  For
example, here are a few things I'm going to be needing to do...

* Auto populate a field based on the value of another field.  This
will likely just be a javascript hook so I imagine it's rather easy
but I haven't yet dug into it.

* Provide an advanced search that uses my own search routine for a
specific table.

* Add in completely new admin functionality like a 3 step process for
creating a newsletter that gets sent to all users who are newsletter
subscribers.

* Add a duplicate an existing record feature, preferably a link from
the detail page.  The duplication process will grab just a few fields
that we've determined and pre-populate them on an add page.

I'll be needing to do this either in current admin or newforms-admin.
Since newforms-admin will one day replace the current admin my thought
was to go ahead and dive into it now to save the trouble of
duplicating the effort when it lands on trunk.

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 minify and combine script?

2008-02-24 Thread Rob Hudson

There's also this blog post:
http://pedro.valelima.com/blog/2008/jan/17/deploying-compacted-javascript-django/

> > On Sat, Feb 23, 2008 at 8:26 AM, Thierry <[EMAIL PROTECTED]> wrote:
> > >  I've recently made the switch from Symfony to Django.
> > >  Some interesting code here :)
> > >  When searching around I can't seem to find any javascript and css
> > >  minifier and combiner.
> > >  Can anyone recommend a good one?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Tumblelog - Generic table or combine queries or...?

2008-02-18 Thread Rob Hudson

On Feb 17, 12:50 am, Jamie Pittock <[EMAIL PROTECTED]> wrote:
> 2. Use the contenttypes framework and create a generic TumblelogItem
> Model that would hold the content_type and ids of all the model items
> I'd like to "tumble".  Something like...

This is pretty much what JellyRoll does:
http://code.google.com/p/jellyroll/

-Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Simple markup language?

2008-01-21 Thread Rob Hudson

Hi,

I'm looking for something along the lines of Textile or Markdown, but
with very minimal features.  Does anyone know of other projects that
might fit these requirements?

* Strip all HTML
* Only allow for simple markup (bold, italics, headers, lists, URLs or
auto-linking URLs)
* Do not allow things like images, tables, classes or styles

Thanks,
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Simple markup language?

2008-01-21 Thread Rob Hudson

Thanks for the reply...

I have considered rolling my own along the lines of {{ mytext|
striptags|simple_markup }} but thought I'd ask before I went through
the effort.  In Python there's usually a library for everything.  :)

I've also looked at the optional arguments to Markdown and Textile and
didn't see a way to disable core features specifically.

Cheers,
Rob

On Jan 21, 3:03 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> If you've already looked at the regular bunch: textile, markdown, rst,
> etc...
> And you just need minimal functionality,
> You could probable write up a small hack to do it with some regular
> expressions. You can find things that strip html, and then you could to
> the simple markup fairly easily after that. It shouldn't take too long
> to write something like that.
>
> It is also possible that some of the existing things may be able to
> either disable the extras you don't need, or you could modify them to
> just skip the code for those features.
>
> Jeff Anderson
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Templates, filesystem, caching?

2007-12-23 Thread Rob Hudson

On 12/23/07, Eratothene <[EMAIL PROTECTED]> wrote:
> Your snippet requires to restart django each time the templates have
> changed. Did you try to add checking of template file modification
> date in order automatically invalidate cache? What it is performance
> of such implementation? Adding this kind of  mechanism will increase
> performace without any loss of functionality. Such implemention will
> definitely be included into django base. Please, try it out.

I can't speak for the author of the snippet but I think checking the
mtime of a file would defeat the purpose.  Plus, if DEBUG=True that
snippet bypasses the cache anyway.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Templates, filesystem, caching?

2007-12-22 Thread Rob Hudson

On 12/21/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> In the early days of Django, Adrian, Simon et al looked at that. It
> wasn't worth it, since, in the grand scheme of things, template caching
> and checking the cache wasn't that much faster than loading and parsing,
> particularly in the overall response time of a request (of which
> template parsing is a relatively small component). Adding complexity for
> minimal gain isn't usually a good idea. Unless this is a universal win,
> it would be better to write it as a third-party template loader. It's
> fairly easy to write a template loader that takes another template
> loader as a parameter and just wraps caching around it and that keeps
> the core code cleaner.

I wonder if the template system has become a bit more complex since
then.  I also wonder if whatever tests they used included things like
includes in for loops.  I tend to think that the filesystem is slow
and anything to remove FS calls and shove things in memory is a good
thing -- especially something that could potentially be in a for loop.
 Obviously there are trade-offs as you mention but the patch didn't
look that complex to me -- actually it was surprisingly straight
forward.

I've considered applying this patch and testing against a project I'm
working on.  Maybe that would help prove to either Django or me that
this is or isn't worth it.

Thanks,
-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Templates, filesystem, caching?

2007-12-18 Thread Rob Hudson

On 12/18/07, Michael Elsdörfer <[EMAIL PROTECTED]> wrote:
> James Bennett schrieb:
> > Manually call get_template() or select_template(), and stuff the
> > resulting Template object into a module-global variable somewhere.
> > Then just re-use it, calling render() with different contexts, each
> > time you need it.
>
> Is there anything speaking against building that behaviour directly into
> Django?

I was curious of the same thing.  The only downside I see is that
templates wouldn't "reload" automatically if you changed them.  But
you could disable this when DEBUG=True.  And most people are used to
the idea of reloading Apache if there is a change in a .py file.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson

On 12/17/07, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> http://www.djangoproject.com/documentation/cache/

If I understand correctly, these cache the templates after they have
been rendered.  What I'm curious about is if there is a way to cache
templates before they are rendered so you can provide different
contexts to them.  It seems like there would still be some gains
involved -- a filesystem read, parsing the template into nodes, etc.

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson

Howdy,

A thought occurred to me today and I'm not 100% sure what Django does
by default...

Similar to the idea that PHP parses scripts for each request and
having an opcode cache can increase performance, I'm wondering if
Django reads templates from the file system, parses them, and then
does the context replacement on them for each and every request.  And
if so, would there be some optimization to be gleaned by caching the
parsed templates?  (Maybe optionally tied to DEBUG=False?)

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Pagination

2007-10-19 Thread Rob Hudson

I don't think it's 100% to your specs but take a look at this:
http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/

It's close enough for tweaking to get you 95% of the way there
(maybe).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Does setting a session cause a redirect?

2007-10-03 Thread Rob Hudson

After the few responses here and Malcolm telling me I was on drugs
(grin) I dug deeper and found the problem...

On my list result page I had a model method returning an empty string
for a URL to a related image which resulted in the following HTML:



That cause an extra GET request to the same page.  I fixed the model
method and all is good.

Thanks to all,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Does setting a session cause a redirect?

2007-10-03 Thread Rob Hudson

I'm working on an advanced search feature for a website and am using
request.session to store the search terms so pagination will remember
and paginate correctly.  While working with the built-in server I'm
seeing that my search submit come through as a POST then almost
immediately after I see another GET request.  I suspect that this code
is causing the redirect...

request.session['mykey'] = mydict

Does that seem right that it would redirect?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 deployment à lá Capistrano

2007-09-11 Thread Rob Hudson

On Sep 11, 9:20 am, "Alvaro Mouriño" <[EMAIL PROTECTED]> wrote:
> Capistrano is:
> * A saint:http://en.wikipedia.org/wiki/Giovanni_da_Capistrano
> * An Italian city:http://en.wikipedia.org/wiki/Capistrano_%28VV%29
> * A city in 
> California:http://en.wikipedia.org/wiki/San_Juan_Capistrano%2C_California
> * A city in Brazil:http://pt.wikipedia.org/wiki/Capistrano

Funny... for some reason I always thought Capistrano was a name of a
meat, like pastrami or something.  I always thought that was a strange
name.  :)

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 deployment à lá Capistrano

2007-09-11 Thread Rob Hudson

On Sep 8, 10:47 am, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
> This is just to make it a bit more obvious. I've decided to make up a
> python application similar to Capistrano, for Django.

I'll just echo here that yes, I'd be very interested in this.  It's on
my queue to learn Capistrano as a deployment tool but so far the
manual install and update hasn't been horrible enough to take the
time.  If there's a Python equivalent all the better!

Keep us posted on a URL for the project.  I understand you need a name
first but a mailing list, django code project, etc would help gather
the forces.

Personally, I'd avoid a name taken from Capistrano as it might imply
it's a simple port which you've said you wanted to avoid.  Django
itself (and a few other things related) are centered around a jazz
theme -- is there anything there that can be related somehow?

Cheers!
-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson

I didn't dig deeper last night because I was "getting things done" and
it was easier to just export the environment and move on.  Looking
harder at the traceback I noticed it was getting hung up on my putting
stuff in the project's __init__.py file which was importing things
from Django.  It looks like a chicken and egg problem if I do that.

"Which came first, the chicken or the egg?  I egged the chicken and
then I ate his leg."  -- Beastie Boys

-Rob

On 8/28/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
> The OP isn't talking about Apache but using inbuilt Django server
> using manage.py. :-)
>
> The OP should really post the full traceback and messages there are
> getting so it can be seen whether they are interpreting it correctly.
> Information in the details may also be helpful to people in working
> out what is wrong.
>
> Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson

On Aug 28, 8:49 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> manage.py just tries to import the settings module directly; it
> basically assumes that '.' is on your sys.path, that "settings" is the
> name of your settings module, and that the current working directory
> contains the settings module.
>
> Is it possible any of those things changed?

None of that changed, which is odd.  I just checked it out from my
repository to run test the project on another computer and the same
thing -- EnvironmentError.

Thanks,
-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 suddenly loses DJANGO_SETTINGS_MODULE running locally

2007-08-28 Thread Rob Hudson

I've had this happen a number of times previously and fixed it by
exporting the environment variable, but last night I was running
without and env variable using "./manage.py runserver", stopped the
server after making some changes and it then complained about the
missing environment variable.

It happened right after I added a new context processor.

Has anyone else noticed this?  Isn't "./manage.py" supposed to set up
the settings module correctly?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: What's possible in the admin?

2007-08-20 Thread Rob Hudson

Thanks for both of the great replies, Malcolm and oggie rob.  Much appreciated.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



What's possible in the admin?

2007-08-18 Thread Rob Hudson

I have a list of things I'd like to do in the admin for a new client
but I'm not sure if all of these are possible.  I'm hoping those more
familiar with admin tweaking could provide a Yes/No for these?  I've
heard something about how the new admin branch allows for multiple
admins, so possibly one admin is the standard data management admin,
and one admin is various links to jump off into the other bits listed
below?

1) Add a duplicate this record button to start a new 'Add [model]'
page but pre filled in with data from an existing record.

2) Add some light reporting views.  I imagine these would be just like
a public view but limited and linked to from the admin somehow -- so
I'd need admin authentication and a link in the admin?

3) If I can do #2, that opens up a lot of things for the other items on my list.

4) When adding a new record to a model, hook in an AJAX call to check
if the item already exists in the table and indicate if it does.
(There's a single column that is the key for this.)

5) And advanced search for their main model.  This is posible via #2
but it would be interesting if this could be abstracted a bit and be
re-used.  I'm kind of thinking of a way to specify which fields should
be included in the advanced search and automatically generate a form
and process the form submit to search those fields?  Not looking at
full-text search at all, but simple things like `title` contains
'django', `bestseller` is true, `binding` is 'Hard Cover', things like
that.

6) From the admin create a 3-step wizard to build, generate, and send
a newsletter.  Probably another item that depends on #2.


Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Map of Django users

2007-08-15 Thread Rob Hudson

I live and work in Eugene, OR and because of the Django Master Class
at OSCON I found out that there were a number of other people in
Eugene using Django.  So I thought it would be nice if there were a
map of Django users to see if there were others nearby.

To that end, I quickly created a Frappr map for Django users:
http://www.frappr.com/?a=constellation_map=137440019483

Feel free to add yourselves.  Here in Eugene we're thinking of
organizing a tech lunch for all the Django developers.

Cheers!
-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson

On 8/14/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> Unless that something is forgetting the inner Admin class, I'll wager
> you've bumped into #1796. I *really* need to get myself into gear and
> work on that some more. It's embarassing.
>
> At the moment, there's no known reliable workaround (although some of
> the comments in the ticket provide things that might work). One of the
> last comments is almost certainly the key to the issue; I need to
> implement a fix. Probably time to move that to the top of the stack.

Yes, there is an inner admin class.

1796 looks like it's related to M2M, which I don't have.  I am using
TagField, which another person mentions.  It looks like a really
slippery bug.

Is it odd that I don't see an error?  Just the admin page without the
models I'm looking for?

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson

On 8/14/07, Paul Rauch <[EMAIL PROTECTED]> wrote:
> inside the model class, add the class Admin.

I forgot to check that explicitly on the server but only because the
admin was working locally.  That would have been embarrassing though.
:)

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Why isn't my app appearing in the admin?

2007-08-14 Thread Rob Hudson

OK, this is baffling.  Tonight I've been working locally adding a new
app to my project.  I got enough of it going and wanted to publish to
my server.  So I updated via SVN on my server, ran validate to check
for errors, then ran syncdb, the models got installed, I reloaded
Apache and logged into the admin and the new app and models aren't
showing up.

To troubleshoot, I've done all of the following:

* Check my settings.py to see that the app is listed there.
* Reload and restart Apache multiple times.
* Clear my browser cache.
* Try a different browser.
* Check validation again.
* Check database tables exist by using ./manage.py dbshell (it's
there)
* Use ./manage.py shell and import the app from the command line (it
works)
* Create a new record in the shell and save it (that worked too)
* Tested closing the shell, opening it again, and pulling out the
record I just added (that works)
* Tried going to where it should be "/admin/appname/modelname/" and
get a 404.

But for the life of me I can't figure out why the app isn't appearing
in the admin.  What's left to check?  What's the process Django goes
through to determine if something shows up in the admin?

(I have a feeling I'm missing something amazingly stupid.)

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: MySQL and InnoDB

2007-08-07 Thread Rob Hudson

On Aug 6, 4:16 am, Matti Haavikko <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can you get the same result with "default-storage-engine=InnoDB" in your
> my.cnf?
>
>  - Haavikko

I believe you can but for other various reasons I'm not able to make
this change globally.

Does anyone know if adding the DATABASE_OPTIONS config setting adds
any unneeded overhead?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MySQL and InnoDB

2007-08-06 Thread Rob Hudson

Hi Django Users,

I'm using MySQL with Django but I dislike MySQL's default MyISAM
tables because there is no referential integrity.  So I googled how to
force Django to create InnoDB tables with MySQL and I found that I
need to add this to my settings.py:

DATABASE_OPTIONS = {
   "init_command": "SET storage_engine=INNODB",
}

I also saw that there was a comment stating to only do this when you
run syncdb and not when running in general.  I can understand that
it's only really needed when you run the CREATE statements, but does
anyone know if it adds any overhead if it's left in?  It's somewhat of
a PITA to have to remember to alter my settings if I'm adjusting my
data models.

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 advocacy in a commercial environment

2007-07-20 Thread Rob Hudson

On Jul 20, 2:09 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> I don't mean to pry, but at your workplace have you had any difficulty
> hiring into Python/Django roles at your company (compared to PHP)? Do
> you get less applicants? A better quality of applicant?

We only have 2 developers and because of Django, that's all we need.
We hired the 2nd awhile ago and he had some Python experience and
picked up Django very quickly.  The good documentation helped a lot in
that regard.  That in itself is another point -- a home grown CMS in
PHP with no docs would have taken much longer to figure out and get up
to speed with.

The MVC model, I think, would also help.  As the new employees are
learning they can work in something less technical like templates.  As
they learn, they can then do views.  And the senior devs can do things
like model design, middleware, new features, whatever.

Python and Django wouldn't be my concern when hiring new employees
since they are easy to learn.  It's all the other stuff that comes
with web development that together is harder to find (eg: valid
(x)HTML, CSS, Javascript, database, source control, unix/linux, HTTP,
etc.)

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Blog engine

2007-07-20 Thread Rob Hudson

A lot of the same arguments against making a standard blog project
could probably be applied to Rails, but here's a blog app in Rails...
http://simplelog.net/

I think an open-source Django blog project would be good because
1) It would be Usable to many (as evidenced by this thread and others
before)
2) Useful to many as a reference and resource

#2 is particularly interesting to me because I've written a simple
blog in Django and there are some non-obvious things that having a
reference implementation to look at would be nice.  Things like:

* Feeds (Atom, RSS, both)
* Comments (with spam filters)
* Open-ID enabled comments?
* Grouping blogs and links and whatever other objects by date using
generic relations (possibly?)
* Previewing links that aren't "published" yet, possibly using the
ADMINS option, while returning a 404 for anyone else?
* Writing a script executed by cron to pull content from other sources
and save them to your models.  (I did this for Magnolia recently.)
* etc.

If anyone wants to start one I'd be interesting in joining in and
playing.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Blog engine

2007-07-19 Thread Rob Hudson

Why not start a Google code repository and see how many people want to
chip in and help.  This comes up often enough that it sounds like
there's enough interest.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 advocacy in a commercial environment

2007-07-19 Thread Rob Hudson

On Jul 19, 1:19 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> If anyone has any good resources which show off the power of Django
> (and by association, the benefits of PHP), then please share them with
> us.

Where I work we migrated away from PHP to Django with great success
but it depends on your environment.

For us the Django admin was a huge factor since we have teams entering
content and the default Django admin was way better than anything we
had going so far.

There are some performance articles and blog posts, for example:
http://wiki.rubyonrails.org/rails/pages/Framework+Performance

We benefitted from the Django workflow with its built-in web server.

There's also the fact that Django is improving everyday which
translates into free new features or things that were hard to do are
easy now.  For example, databrowse or djangosnippets.

And we love Python and also love our jobs more because of the
switch.  :)

Those aren't really resources for you but depending on your in-house
requirements it's not hard to find resources online to help guide the
decision.  When I had to convince my superiors of the choice, I wrote
a PDF document looking at the best choices in each language (Ruby,
PHP, Python) and Django won out for our particular needs.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't run Django. Getting error message about no module named _md5

2007-06-28 Thread Rob Hudson

Python 2.5 uses hashlib and no longer has a module "md5".

There's at least 1 patch dealing with this for users and passwords:
http://code.djangoproject.com/ticket/3604

Though the "_md5" doesn't seem right either.

-Rob

On Jun 27, 6:58 am, jeffself <[EMAIL PROTECTED]> wrote:
> Just updated Django to latest version.  I'm running it on a Mac Book
> Pro with Python 2.5.1 from the MacPorts packaging system.  When I run
> 'python manage.py runserver', I get the following error:
>
> ImportError: No module named _md5
>
> I have a feeling this may be more of a python problem than Django, but
> I thought I'd ask around here.  Maybe someone here has encountered
> this.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Template "taglib" library?

2007-06-26 Thread Rob Hudson

Hello,

While looking at the Lost Theories source code (thanks Jeff Croft!) I
saw he's using what looks like a real handy library called "taglib".
I can't find taglib and it may well be a personal library.

But one use case caught my eye:

In theories/theory_list.html he's defining a "paginator" block at the
top with prev/next links and calls that block above and below the
resulting list, so in effect, defining a block to use twice.

That seems handy.

I haven't tried it yet but I suppose you could create a paginator.html
file and include it twice in your template, but defining it in-
template saves a couple file system calls and seems useful if that's
the only place you'll be using that.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Pagination

2007-06-21 Thread Rob Hudson

Just following up...

If you use the query string option, you don't need to know the current
url, you can just do this:

{% if has_previous %}
Previous
{% endif %}

And the browser fills in the current url path minus any query string
and that just appends to it, which is kind of nice.

I like the clean URL of: /url/page2/

But I like how this works better in the template: /url/?page=2

Unless I'm missing something which I thought I might be.

Perhaps the pagination stuff could add support for building URLs for
you in either case and add "prev_url" and "next_url" to the context?
Then either way is a no brainer for template authors.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Pagination

2007-06-21 Thread Rob Hudson

> I don't understand. If you're one /foo/bar/baz/page1/, then why can't
> you write  as the link? It will work, is a
> well-formed URL and is independent of the prefix. Note that you must
> ensure your URLs are canonicalised if you use this system, though:
> always ending with a trailing slash, so that the "../" will go to the
> right place.

Ah, that's what I was looking for.  I hadn't thought about that.
Thanks!

And thanks for the extra note on the extra bit of checks -- I'll keep
an eye out.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Pagination

2007-06-21 Thread Rob Hudson

On Jun 21, 1:23 pm, Tyson Tate <[EMAIL PROTECTED]> wrote:
> Look at "next" and "previous" context variables. You can do:
>
> Next
>
> and
>
> Previous

Right, but it's the 'href="/url/..."' part that doesn't feel right to
me.  If I either want to (a) re-use this template for other URLs (list
view by tag, list view by date, etc) or (b) decide later that I want /
url/ to be /foo/ in urls.py, then I have to remember to change the
template, which I don't trust myself to do.

I was kind of expecting to find in the pagination context variables a
prev_url and next_url I could use and not have to build my own in the
template.  I don't see all the pieces I'd need to make the /url/ part
be more dynamic.

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Pagination

2007-06-21 Thread Rob Hudson

I've set up a list view that I want paginated and I'm using the
list_detail generic view.  I was thinking that I would prefer the /url/
page2/ URL over /url?page=2 so I set that up.  The problem is, in my
template where I want to display the prev/next links there's no way
that I see to avoid hard coding the "url" part of the path to the next
and prev pages.

With this in mind, it seems like the ?page=2 option is preferred.

Is this right?  What are the pros/cons of one over the other?  *Is*
there a way to get the URL prefix up to the /page2/ part?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: robots.txt?

2007-06-06 Thread Rob Hudson

Great.  Thanks for all the help everyone.

-Rob

On Jun 5, 9:56 am, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> Yes, you'd set in something like:
>
> 
>SetHandler None
>  
>
> (which is exactly what I've done)
>
> -joe
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: robots.txt?

2007-06-05 Thread Rob Hudson

I'm not using mod_rewrite currently (and may even have it turned off
in Apache to save memory).  Is there another solution?

I have my static media folder set in Apache with:

  
SetHandler None
  

Can you do the same for single files?

Thanks,
Rob

On Jun 4, 8:12 am, KpoH <[EMAIL PROTECTED]> wrote:
> You can "mod_rewrite" /robots.txt to /static/robots.txt for example
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



robots.txt?

2007-06-04 Thread Rob Hudson

What do most people do for a robots.txt file in Django?

I set up my website to email me errors and 404s, and I often get a 404
email for the robots.txt.

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Offline Django Apps

2007-05-31 Thread Rob Hudson

On May 31, 1:20 am, "Vagmi Mudumbai" <[EMAIL PROTECTED]> wrote:
> Check out Google Gears.http://gears.google.com

There's a lot of interesting things about Google Gears...

It provides a browser local SQLite accessible via Javascript.

It provides a local HTTP server for storing/retrieving cached content.

Simon Willison dug up some interesting Google Gears tidbits:
http://simonwillison.net/tags/googlegears/
including:
Adobe's Apollo will use Google Gears technology, Dojo was in on the
Google Gears collaboration uses it.

Looks like a lot is happening in the world of offline web
applications.

Great stuff.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Stagnating Djangobook? Broken Atom feed?

2007-05-30 Thread Rob Hudson

I was kind of wondering the same... is the Django Book going to align
with Django 1.0?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Offline Django Apps

2007-05-22 Thread Rob Hudson

Cool.  What's the best way to coordinate the effort?  A wiki page to
start with?

Coming up in the next month or so I'm going to have to dedicate work
time to this but for now I'd like to just lay out the groundwork and
do it in such a way that it benefits the Django community.

1) Cross Platform Libraries...

In looking at DjangoKit a little I see he's using PyObjC.  I do like
the idea of using whatever the native widget library is for each
platform.  I'll have to look at the Democracy Player as an example but
they did something similar (Mac: PyObjC, Linux: PyGTK, Windows: ???).

2) Database...

It makes sense to me to require SQLite for this to work.  Moving your
data to SQLite is also a requirement for Slingshot.  I'm pretty sure
we can use the fixtures library to serialize data from databases other
than SQLite (MySQL, PostGreSQL), then load it up into SQLite.

3) Anything else?

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Offline Django Apps

2007-05-22 Thread Rob Hudson

I have a need for a way to run Django-based websites offline as an
installable application.  I recently read about Joyent Slingshot:
http://developer.joyent.com/

I'm curious if there are others who could use this functionality but
for Django.  If so, perhaps we can all collaborate and come up with a
solution that runs on Mac, Windows, and Linux.  Data syncing would be
nice but can come later.

A big bootstrap and proof of concept is most definitely DjangoKit:
http://jerakeen.org/blog/2007/04/djangokit-gets-better/

Thanks,
Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: On more efficient use of QuerySets

2007-04-04 Thread Rob Hudson

James Bennett wrote:
> The 'select_related' method[1] may be what you're looking for; it
> selects related objects up-front in the same query, so that later
> access doesn't go back and hit the DB again.

Yes, I'm doing this where it makes sense.

What I'm looking for is whether there is a way to say these types of 
things without making another database call:

* Of this list of Response objects which I already have, give me a list 
where this filter condition is true.

* Of this list of Content objects, remove those where this filter 
condition is true.

Would iterating over the list and checking each object be faster than 
simply making another db call?

Maybe I'm making more of an efficiency issue out of this than it really 
is, but I thought I'd at least investigate ways to optimize what we have.

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



On more efficient use of QuerySets

2007-04-04 Thread Rob Hudson

Fellow Djangonauts,

Here at my work[1] we've built a number of web-based educational 
websites in Django now.  I'm analyzing the number of SQL calls and am 
realizing that the number is higher than I'd like.

My main question is around whether or not I can do a bulk query to get 
most of the data I need, and then do filtering or quick searching of the 
resulting list of objects.  I'm thinking that it can't be done without 
another database call but you guys are smart and creative, so I'm sure 
there are other ways that I haven't thought of.  :)

Our data resides in a custom built content management system built in 
Django.  We have a data model for content and media and questions 
(forms) and user responses to those questions.

Here's a typical scenario that leads to extra SQL calls:

The user has traversed a subset of the program and has answered 
questions or hit triggers which set responses to track the user.  They 
hit a page which tailors content based on their previous responses or 
triggers.  If there are a number of variables that come into play to 
tailor content to this user we get those with the usual ORM and filter 
by what we need.

When I look at the SQL calls made during page creation, I see a lot of:
SELECT value FROM responses WHERE varname='blah' and user_id=1;

What would be more efficient would be if I could get all responses for a 
particular user, then pluck the particular variables out of that data 
set as/when I need them.  1 SQL call.  Is that possible?  Are there 
memory tradeoffs?  There could be potentially on the order of 100 
responses per user and each of those is a Response object.  Is there a 
way to estimate memory footprint for that?  Is this even worth the 
effort -- the individual queries are about .001s, and in total about 
0.065s for the particular page I'm looking at.

I've thought about the idea of turning the resulting list into a 
dictionary keyed by varname so I can get the Response object by varname. 
  But there are other scenarios where I'd like to filter the data in 
different ways.  So in a general case I'm looking for other ideas.

Thanks,
Rob

[1] Oregon Center for Applied Science (http://www.orcasinc.com/)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User profile and sliding date range data model?

2007-03-30 Thread Rob Hudson

James Bennett wrote:
> On 3/29/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
>> I can't think of a way to account for "up to last 3 years" and "up to
>> the next 5 years" or variation thereof.
> 
> paid_up_until = models.DateField()
> 
> Then use Python's standard 'datetime.timedelta' to handle offets;
> e.g., if a member pays up for the next three years:
> 
> p = user.get_profile()
> p.paid_up_until += datetime.timedelta(days=3*365)
> p.save()

That's a good idea.  I'm thinking that once I implement that some user 
is going to have a gap in their dues... like maybe they paid in 05, 
skipped 06, and paid 07.  I think the club officers want to track that.

I had a thought that maybe this could just be tied to another table 
called paid_dues, with a user_id and years paid for.

But if Members has a FK to Users, would my Dues model be tied to Users 
or tied to Members?  I'll have to play with that and see how it renders 
out in the admin.

Thanks for the ideas.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



User profile and sliding date range data model?

2007-03-29 Thread Rob Hudson

I'm trying to think how I can solve this problem in my data model and 
I'm coming up empty.  I thought I'd post it here to see if anyone else 
had a good idea...

I built a members-only website for due paying members.  We'd like to use 
the profile via the Django admin as a way to track which members have 
paid their dues.  At first I was looking at a BooleanField that maybe 
gets cleared at the change of the year.  But then I found out that:

* Often if a member doesn't pay, the officers won't remove them from the 
roster right away.  Only if they don't pay for 2-3 consecutive years 
will they remove the member.

* Some members pay ahead a few years, and so that would need to be tracked.

I can't think of a way to account for "up to last 3 years" and "up to 
the next 5 years" or variation thereof.

Any ideas would be much appreciated.

Thanks,
Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 Cheat Sheet

2007-02-13 Thread Rob Hudson

> Not really. Anything you can do to a tuple (which is, basically,
> iterate over it, slice it and access specific items out of it) you can
> also do to a list. A tuple is just a little bit more efficient when
> you know you're dealing with something that isn't/shouldn't be
> mutable.

Actually, I think "list_per_page" should be an integer, not a list as
it is on the cheat sheet.

If so, that means only the js option is a list.  Which means
everything that has a multiple option list is a tuple already, with
the exception of the js list.

For some reason I thought ordering took a list.

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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 Cheat Sheet

2007-02-13 Thread Rob Hudson

Very cool.

I agree with another poster, adding FK and M2M and their options would
be a nice addition if there is room.

Minor nit... It says for version 0.95 yet there is a single template
filter with footnote "In development version only."  It seems like you
might as well remove that.

This also reminds me of a question I've been meaning to ask...

Is there any reasoning to when an admin class option is a list and
when it is a tuple?  I tend to default to tuple since I don't want to
have to go look it up every time.  Can admin options be standardized
to tuples across the board to make it easy?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe 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: Filtering foreign items in admin

2007-02-10 Thread Rob Hudson

Take a look at "limit_choices_to" in the model api docs and see if
that will do what you need.

On Feb 9, 4:27 am, "Rob Slotboom" <[EMAIL PROTECTED]> wrote:
> For a several models I use a FK to photos. The drop down in admin to
> choose from lists all photos.
> Can this list be filtered so I can restrict the available photos for
> some models?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: problem with flatpages and debug=false

2007-02-05 Thread Rob Hudson

This is a known bug:
http://code.djangoproject.com/ticket/3335

On Feb 5, 8:53 am, patrickk <[EMAIL PROTECTED]> wrote:
> when I go to one of the flatpages on our site (not admin), I´m
> getting "404 page not found" - but only when debug=False.
> with debug=True, everything´s fine.
>
> any ideas?
>
> thanks,
> patrick


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Where to put function to instantiate and save a model object?

2007-02-03 Thread Rob Hudson

Russell Keith-Magee wrote:
> Look in django.contrib.auth.models for UserManager for implementation details.

Nice.  Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   3   >