Re: User Registration: Looking for tips
Would it be possible to just use two ModelForms? -- 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: Filter based on result of model method
> articles = [article for article in > Article.objects.all().select_related('permission') if > article.permission.can_view_article(request.user)] The only problem I see is that is that 'articles' is a list, not a queryset. The reason I was using q.exclude(pk=item.pk) is because the return value is still a queryset. But that's going to result in a huge number of DB hitscurses. -- 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: Filter based on result of model method
> Everytime you call exclude (btw, this should be q = > q.exclude(pk=item.pk), no?), Yes =) I wrote that quickly with my post. > articles = [article for article in > Article.objects.all().select_related('permission') if > article.permission.can_view_article(request.user)] Good idea. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Filter based on result of model method
> As I understand it, parameters passed to filter() are translated into SQL > statements. An arbitrary python method that you write for your object can > do any number of things, which might not be translatable into SQL. So I > don't see how any "filter on the result of any method" feature would work, > other than doing exactly the implementation you describe. Curses, that's what I thought. > However, your specific use case sounds like it should be possible to avoid > iterating over everything by changing your model. Is there a reason why > each Permission model can't have a ManyToMany field with the set of users > allowed by that permission model? That'd be really hard to maintain, I think. I'd have to evaluate whether the current user could view _every_ article every time they changed their profile, registered, etc. -- 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: Filter based on result of model method
Anyone? -- 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.
Filter based on result of model method
Is there a way to filter based on the result of a model instance method? I've got a Permission model with a one-to-one relationship with an Article. The Permission model stores the different groups that the Article author said could read their article. There's about 6 groups though, so I wrote an instance method that calculates whether a given user can view an Article. I want to filter based on whether that instance method returns true or not. I could do something like the following, but it seems very inefficient. def myview(request): q = Article.objects.all() for item in q: if not item.permission.can_view_article(request.user): q = q.exclude(item.pk) -- 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: Controlling access to objects
Thanks Dan. I also found this: http://goo.gl/l2IW -- 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.
Controlling access to objects
Hi guys, I don't know whether the built-in permissions system would be appropriate here, but I want to control access to objects in one of my models, based on profile fields, like gender, age, etc. I planned to create a model "MyModelPermissions" like so: class MyModelPermissions(models.Model): mymodel = models.OneToOneField(MyModel) gender = models.CharField(choices=[('male', 'Male'),('female', 'Female'), ('both', 'Both')]) But that doesn't seem very efficient. Any ideas on how best to 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-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 1.2.1 doesn't work with South but 1.2 works? How to find the previous version Django 1.2?
Djago 1.2.1 works fine for me with South. -- 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: Thread safety with Form Wizard
Anyone? -- 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.
Thread safety with Form Wizard
Hi guys, I'm a relative newbie at using Django in an actual production setting. I'm having trouble using the form wizard at the moment, and I noticed that there is one instance of the Wizard class, instantiated in urls.py. Is there anything I should worry about as far as thread safety is concerned (i.e. should I not store any context-specific data in "self")? -- 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: Updating profiles
Just as a side note, I made the user part of my Profile model a OneToOneField. Makes it easier to reference, i.e. user.profile.FIELD vs. user.get_profile().field -- 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.
Using the FormWizard with models
Hi guys, Another question about the FormWizard: is it possible to provide an existing instance of a model for the forms in the wizard? -- 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: Uploads in the Form Wizard
What would be the best workaround (or is there one)? Perhaps overriding FormWizard.process_step()? -- 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: Uploads in the Form Wizard
Oh. Dang. Thanks for your help Russell. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Uploads in the Form Wizard
Is that in trunk (i.e. could I revert to an older SVN revision and have it work)? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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.
Uploads in the Form Wizard
Hi guys, I'm trying to use the form wizard for a model. The problem is, I have an ImageField in the last step, but I keep getting a "This field is required" on it. request.FILES contains the uploaded file, however. Can I use ImageField's in a Wizard? -- 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.
Remove a field in a form subclass
Hi guys, I've got a ModelForm defined like below: class ArticleForm(forms.ModelForm): title = forms.CharField(stuff) def custom_validator(): .. class Meta: model = Article I want to subclass it, but do _not_ want the title field, i.e. class SubArticleForm(ArticleForm): class Meta: fields = [...anything but 'title'...] But the title field still shows up. Is there a way to remove it in subclasses? -- 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: danjgo authentification
Shouldn't the form in fac_login.html target /login/? ... Even if not, that dot in the action attribute should _not_ be there, I don't think. -- 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: Giving up PHP. ...Can't decide between Django & Rails
I'm a bit of a noob as well, and know nothing about Rails, but I'd like to comment on a few issues you mentioned. 1. Non-existent template variables are replaced with the value of the TEMPLATE_STRING_IF_INVALID setting. Set that to something besides its default (an empty string) to make non-existent variables easier to find. 2. Regarding documentation, the docs at http://docs.djangoproject.com are, in my opinion, simply amazing. By far the best documentation for a free project that I've seen (but then again, I haven't seen much). And that's just a matter of opinion I guess =) 3.I have yet to encounter any problem with the dev server, although I remember issues like that from App Engine. Irritating as hell. 4. I find the error handling in Django (basically just Python error handling) works quite well. I sometimes get rather ambiguous errors, but their solutions become easier to find as you encounter them. One error I always hated with PHP was when you forgot to put a semicolon on the end of a line. PHP said the first thing on the _next_ line was unexpected. It seems ambiguous at first, but after you see it a few times, you know exactly what it means. Same with Python/Django. That's all I have to say. Hope I helped. =) -- 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: Newbie: New user creation with forms
What exactly do you mean by, "Create a user and allow that user to submit data such as messages"? -- 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: Getting strange email from "dreamhost"
Hehe, that's kinda funny...Thanks for your help Russell. =) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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.
Getting strange email from "dreamhost"
Hi guys, I've gotten two emails from "Mail Delivery Subsystem" with the subject "Your message was NOT received by django-us...@googlegroups.com!". The body is below. Anyone know why I'm getting these? Is anyone else getting them? I have no affiliation with Dreamhost or at all, so this is...strange. We're sorry.. your email was unable to be processed by our automatic support system, and so is being returned to you. We could not find your email address in our customer database and so couldn't accept your email. Due to the HUGE volume of spam we receive at this address, we've been forced to implement this new policy. Therefore, please just re-submit your message at: http://www.dreamhost.com/contact.cgi All messages submitted through that form are guaranteed to be received, even if you aren't currently a customer! Our apologies for the inconvenience, -- The Happy DreamHost Support Team! -- 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: display user.email in a custom model
Hmm, you should be able to do that. I do exactly that in one of my models. The only I differences I see between yours and mine is that you return a unicode string, rather than just a string, and you wrote self.user, rather than self.user.something. -- 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: Add message each page load
> - have you enabled the messages' context processor? Yes > - are you consuming the 'messages' variable in your templates? UmmYes? I'm displaying one message, but only 1, since I'm only setting 1 per request. That's probably the issue, but why is more than one message being set per request, or, if there is only one, why is it not being cleared? -- 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.
Add message each page load
Hi guys, How do I add a message (Django 1.2 style) each page load, and have it cleared after the request? I set up a middleware running on process_request, but I end up with a bunch of messages in the admin interface. My code: class BetaMessageSet(object): def process_request(self, request): if request.user.is_authenticated and not request.user.is_superuser: if not settings.DEBUG: return None messages.set_level(request, messages.DEBUG) beta_message = """My message"" messages.add_message(request, messages.DEBUG, beta_message) return None -- 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: Why must {% extends '' %} be first value in template? Inconvenient for ajax versions.
Something I tried once: set the 'extends' template variable in your views (middleware even, maybe) to either an empty string or the path to your template, based on the result of request.is_ajax. I'm not sure though whether Django will throw an error if extends has an empty string. Suggestion: def my_view(request): context = {} context['extends'] = 'base.html' if request.is_ajax() else '' . return render_to_response('mytemplate.html', context) template: {% extends extends %} Not sure if that will work, just a guess. -- 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.
Making email unique
Hi guys, I've got a Python website that has to integrate with a forum (i.e. when a user registers on mysite.com, they also have to be registered automatically on forum.mysite.com). That forum forces email addresses to be unique. How can I force that on Django? -- 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: Remove session on browser close
Couldn't you use Javascript for this? For example, on the onbeforeunload event, delete the sessionid cookie? -- 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.
Email address in registration form
Hi guys, I'm using a combination of the UserCreationForm and my own ModelForm of my Profile model to create a registration form. I want to get users' email addresses, however, that seems to be a field in contrib.auth.User, so it should be in UserCreationForm. I don't know whether to a. Add to the UserCreationForm, and add an email_address field or b. Add the email_address field to my custom form, and retrieve it and save it to the contrib.auth.User model after the form is submitted. Any ideas -- 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: Multiple views files
So I've got that the consensus here is to add a 'views' folder, and add my views files in that. Thanks for the 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-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: Passing message to 404
Thanks for your reply. One question though: How would I pass the message itself from view to view (the view raising the error to my 404 view)? -- 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.
Passing message to 404
Hi, Is there a way to pass a message when I create a 404 error programmatically (i.e. from a view)? In my case, I'm using get_object_or_404, and I'd like to say something like, "That user does not exist" (this is for looking at user profiles). -- 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.
Multiple views files
Hi guys, I'm thinking about making multiple views files. I'm just wondering whether: a. There's any problems with that b. many people do 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-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: Making a User Registration form
Ok, I think that'll work. I'll try 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-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: Making a User Registration form
Wait, but do profile fields get displayed as part of the form? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: Making a User Registration form
That doesn't look like it helps a whole lot actually. I don't see where I can create a registration form including my custom profile model. -- 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.
Making a User Registration form
Hi guys, What's the easiest way to make a user registration form, based on my own Profile model and the built-in user model? Writing my own form from scratch is looking like the most painless but time-consuming way. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-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: anybody tried web2py and gone back to Django?
I've noticed that there have been a lot of things in common: Web2py _didn't_ have very good docs, at least relative to Django's (which are spectacular), but now that the Web2py book is available online, that issue is kind of moot. Admin -- Web2py has two different Admins, one which doesn't have a Django equivalent (lets you manage apps, etc. from it, pretty handy) and a not-as-good-as-Django's-Admin appadmin. Although it certainly could do the job for my tiny site =) And the explicit vs. implicit imports: Personally, I love the fact that the request object is available all over the place, including models, and that I don't have to do any importing. My final complaint about Web2py is its templating engine: if I want my Dad to do the HTML on my website, I'd rather not make him learn "Python", per se, rather, I'd like him to learn a slightly different but less strict of a syntax templating engine. Ok, I'm done. Feel free to comment on anything above (including you Massimo =) -- 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: anybody tried web2py and gone back to Django?
First of all, I'd like to say that I think Web2py, and its maintainer Massimo, are awesome. =) I tried Web2py for a little while a couple months ago, but the biggest issue was poor documentation -- at the time, there was almost nothing. Now there's a whole book, online, but... Also, it was missing a few basic features Django had (session-by- session expiration for auto-logout, etc.), although I'm sure if I'd mentioned them to Massimo, he probably would've implemented them pretty quick. -- 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_evolution evolve not found
Shawn: Really? I'm not surprised, it had more than its fair share of bugs. Thanks for the link BTW. Is that your project? -- 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.
Entire site requires login
Hi guys, How would I make it so that every page requires a login? Should I use middleware or something like? -- 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: Underscores vs. Numbers
Well, to solve this, I'm planning to subclass the "get_available_name" method in django.core.files.storage.Storage to do exactly what it does now, except add a number instead of underscores. Any reason not to 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-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.
Underscores vs. Numbers
I noticed when I upload multiple files to my website with the same name, Django adds underscores to the file names. But doesn't that seems like it's less efficient than adding numbers to the end, (i.e. myfile (1).txt)? And on some OSs, a file name can be too long, which could cause problems. Anyone know why they chose to use underscores? -- 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: Hosting for django?
Webfaction, for my small site, is spectacular. Their CP is awesome (I think it's their own, not another piece of software from someone else), and they are totally Python/Django oriented (they used to be called python-hosting I think). -- 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 editor for Debian
I like to use Kate (KDE's default text editor). It has auto-indent, and syntax highlighting for Python, and Django templates. -- 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 forum
Strike what I said above. It's fixed. @derekh http://forum.python.su --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 forum
Looking at the demo, I think that is the best Python forum I've ever seen. Congrats. This would be my site's saving grace. However, I installed all the necessary programs, and I get "Cannot import name utils" from djapian. If you ever read this again, perhaps you could help with that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Return something specific on 404's on a particular path
> If they upload the image, you likely have the name of the file in your > database. Put a little IF statement in your templates. If you find > the name of the image in the db/context, serve it up. If you don't > find it, server up your default/placeholder image. Does that not > work? Yup. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Template tag for getting CSS/scripts/images
I'm considering making a custom template tag that returns a url to a css file or image file. In your opinion, is it a waste of time? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: IDE for Django and Ext JS
I use Kate for all my stuff, because, although not an IDE, it is one hell of text editor. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Forms: Set default value
Sorry, I was little unclear above. I need to set the default for a form. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Forms: Set default value
Hi, I'm defining a form model, and I have a choice field. I have the values in order, and I want one value (in the middle of the values in order) to be the default. How do I do that? Passing initial= anything doesn't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Make three columns without violating DRY
I took Alex's idea. It works great. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Make three columns without violating DRY
Awesome. I'll see what I can do with these. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Make three columns without violating DRY
The columns are actually categories. The left column is sports, etc. So I can't make it a grid like that. I don't quite see how the paginator helps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Make three columns without violating DRY
Hi, On the homepage of my website, I have three columns of articles from users. I can't quite figure out how to make those three columns without violating DRY. Now, I have a dictionary of lists, with each list being the list of articles for one column. I then loop through the lists. Example: {% for article in articles.left %} {{article}} {% endfor %} {% for article in articles.right %} {{article}} {% endfor %} {% for article in articles.center %} {{article}} {% endfor %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Logout in Firefox but not in IE 6!
It might be caching the page. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Using Signals as hooks
> But if it's a small and low volume app and you are the > only developer managing it, you could get away with it :) You hit the nail on the head ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Using Signals as hooks
Question: how often should I have a cron job work to send emails? Or should I just have it so that a few items from a task DB are done each request (e.g. split up emails into groups, and email them a few per request)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Using Signals as hooks
Thanks. On the topic of scaling, my site hasn't even been publicly released yet. However, I'll keep your advice in mind as I work on it, to keep it "future-proof". --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Using Signals as hooks
It works. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Using Signals as hooks
I'm a bit of a noob at Web Devlopment (as you already know if you've read any of my posts on here). I've read that using hooks in key places in a website can help ease future development. Can/Should Django's signals be used for that purpose? If so, to what extent should they be used? For example, on my site where users submit articles for a newsletter, one place to put a hook would be after an article is submitted. Would sending emails to admins about the new submission, as well as emails to the users who subscribe to be notified of new submissions be put in a separate function, as part of the hook, or part of the page? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Do something on model save only if a certain change was made
Let me make sure I know what to do first. Get the pk of instance being saved, get the article out of the db that has that pk, and see if the old status was pending, and the new one is accepted? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Do something on model save only if a certain change was made
Hehe, completely forgot about those. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Do something on model save only if a certain change was made
I've got a site where users make articles for the newsletter. The content of their articles is a flatpage. My article model is below. My goal is to make it so that when the model is saved, and the status is changed from pending to accepted, it creates a flapage that is an html version of the original file (the html version will be uploaded by me before saving). I thought of over- riding the save method, but that doesn't get arguments of what data is being changed. class Article(models.Model): categories = [('sports', 'Sports',), ('other', 'Other'), ('school', 'School')] user = models.ForeignKey(User) file = models.FileField(upload_to="articles/%Y/%m/%d") friendly_name = models.SlugField(max_length=100) original_name = models.CharField(max_length=100) date = models.DateTimeField(auto_now_add=True) summary = models.CharField(max_length=500) title = models.CharField(max_length=200) category = models.CharField(max_length=6, choices=categories) status = models.CharField(max_length=11, choices=STATUS_CHOICES, blank=True, default='pending') reason = models.TextField(blank=True, null=True) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Should this be its own app?
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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Should this be its own app?
I've got a website (project 'myproject'), in which people can make their own newsletter articles for submission to a group newsletter. Should everything that deals with newsletter stuff (storing articles, etc.) be in it's own app, or be part of the main app along with everything else? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: 500 Errors on 404 error?
Fixed. I had accidentally set handler404 to a blank string. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
500 Errors on 404 error?
I finally got Django to email me about 404 and 500 errors. To test it, I typed in a random path, that I knew would be a 404 error. However, I got an email, and an error page, about a 500 error. The email said the following: File "/home/schoo37/webapps/schoolgoo/lib/python2.5/django/core/ handlers/base.py", line 118, in get_response callback, param_dict = resolver.resolve404() File "/home/schoo37/webapps/schoolgoo/lib/python2.5/django/core/ urlresolvers.py", line 226, in resolve404 return self._resolve_special('404') File "/home/schoo37/webapps/schoolgoo/lib/python2.5/django/core/ urlresolvers.py", line 221, in _resolve_special return getattr(import_module(mod_name), func_name), {} File "/home/schoo37/webapps/schoolgoo/lib/python2.5/django/utils/ importlib.py", line 35, in import_module __import__(name) ValueError: Empty module name --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Reason for not allowing spaces in usernames?
On Jun 12, 6:55 am, Marco Lourowrote: > As long as you trim start and trailing spaces, there shouldn't be any > problem, but personally I wouldn't use spaces in usernames at all. Why not? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Reason for not allowing spaces in usernames?
Do you think I would have problems if I disabled the checking for spaces? When I register users, I have it done automatically (user fills out a form), and Django doesn't have a problem with a space there. It's just in the Admin interface. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Flatpages variables
Oh. Ok, I just read the docs. I'm going to use process_request. Thanks a bunch! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Flatpages variables
Sorry, should've pointed out: I'm not using Django's user system, because I've got a PHP forum that I have to integrate with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Mysql?
Why do you need shell access? Aren't you supposed to do all the coding and stuff on the local server, and then upload 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Flatpages variables
Hi, I've got a site where users must be logged in to view any pages. Logged in users may write articles for the newsletter, and upload them. I then convert the article to HTML (manually), and make it available for other users. I'd like make them available on flatpages, but I have to be able to check whether the user is logged in. Can I do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Admin Question
Ok, just determined that all I'll be doing is changing existing entries. So this is solved. 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Should I use Django?
I thought I'd tell you: I decided to switch to Django/App Engine. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 Admin Question
I want to make it so that I can just add enter the ID, and it will mark it as accepted --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 Admin Question
Sorry, I wasn't very clear. The Administration's purpose is to let me decide, from the submissions that are pending review, which ones I want to accept (change the value for the column 'status' to 'accepted' for that row) and which ones I want to not accept (change the value for the column 'status' to 'unaccepted' for that row) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django Admin Question
Hi, I've got a database of newsletter submissions from my users. Before using Django, I designed an Admin interface that listed the past 10 or so submissions that were still pending review by me, and asked for the ID of the one or ones that I wanted to accept or not accept. Is there a way to make Django Admin do something similar? Unless someone has a better idea on how I could accomplish 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Use a feature similar to the Admin sorting by date on my site?
But Django doesn't offer it bult-in? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Use a feature similar to the Admin sorting by date on my site?
Sorry, I was a bit vague. I mean, how does one do something like the Admin interface does on my site? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Use a feature similar to the Admin sorting by date on my site?
Hi guys, I'm new to Django (haven't even done more than the tutorial, actually). I'm having people submit articles for my site newsletter. I want to sort the archives of these by both name and date, almost EXACTLY like the Admin interface does it (filter by date, sort by date, by name, etc.) How would one 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Should I use Django?
It's all relatively simple stuff, I guess... 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Should I use Django?
> Is there any reason you should'nt? Plain CGI code sounds quite old > even for me ;) I'd have to rewrite everything. :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Should I use Django?
Hi guys, I'm making a small site (small for now, at least), that isn't quite finished yet. I'm the only one who is writing server-side code. Presently, I'm writing straight Python code, through CGI, on a shared hosting provider. Is there any reason why I should use Django on my site, on the Google App Engine? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Why do some shared hosting providers support Django and others don't?
Correction: I paid in advance for my current hosting provider, two years, and its only been 6 months. I can't be possibly be worth 18 months of wasted hosting. Thanks anyway, though. So long as my site still exists and I'm still using Python, I'll be reading this again in a year and a half. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Why do some shared hosting providers support Django and others don't?
So, is getting mod_python and Django worth ditching my current provider, and a dollar more a month? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Why do some shared hosting providers support Django and others don't?
http://djangofriendly.com/hosts/mochahost/ Yes they do. They don't have any reviews --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Why do some shared hosting providers support Django and others don't?
Do you guys know anything about MochaHost? http://www.mochahost.com/webhosting.php Sounds way to good to be true. . .Which probably isn't good. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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: Why do some shared hosting providers support Django and others don't?
How would using Django be any different than having a very large Python script? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---
Why do some shared hosting providers support Django and others don't?
I'm with a shared hosting company called Lunarpages. They tell me Django, by itself, even with Fast CGI, because it is a framework, is too resource intensive for them to allow. But many other shared hosting providers allow Django. So, how do those who do allow it allow users to use it without bogging down the servers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google 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 -~--~~~~--~~--~--~---