Re: Password reset to Gmail addresses fails

2017-12-04 Thread Alastair Campbell
Jason wrote: > what do you have for EMAIL_PORT and EMAIL_USE_TLS? IIRC, gmail requires > TLS to be True. > They are default (not set in the config). I believe the TLS is set by the mail agent, and the email I sent from Mutt on the command line used TLS so that appears to work. Vivek wrote: > Al

Re: Password reset to Gmail addresses fails

2017-12-04 Thread Alastair Campbell
Thanks, The django settings are very straightforward (localhost, email address set), and I've just tried sending from Mutt on that server (command line email from localhost), with the same email address, and that appears in the logs and gets delivered. But from the password reset: nothing happens

Password reset to Gmail addresses fails

2017-12-04 Thread Alastair Campbell
Hi everyone, I have a very strange problem, I'm looking for ideas on where to debug. Using the standard password reset in Django (v 1.10), it silently fails to send to Gmail addresses. There is no error generated by Django, and it works for non-Gmail addresses. In /var/log/mail.log (a Debian VM

Re: Blank output from treemenus under nginx

2011-10-18 Thread Alastair Campbell
Hi Kevin, Thanks for the tips, unfortunately I think the problem is trickier than that. The output HTML is different, because the treemenu template tags don't output anything. I.e. within a template that is otherwise working fine, you have: {% load tree_menu_tags %} {% show_menu "ukwa" %} And

Blank output from treemenus under nginx

2011-10-17 Thread Alastair Campbell
Hi everyone, I got a surprise when using treemenus, where it worked really well on my local dev (django-server) , but disappeared on live (nginx using mod_wsgi on debian). I installed the treemenu app, imported the data (menu items) from a datadump of my local app, and uploaded the templates that

Re: Structuring URLs by category?

2011-04-08 Thread Alastair Campbell
Hi Bruno, > url(r'(?P[a-z-]+)/news/$', "news.views.by_category"), >  url(r'(?P[a-z-]+)/galleries/$', > "galleries.views.by_category"), Ah, ok, thanks, I had tried that and run into a problem. I'll go back and check why that didn't work, as if that's possible that's great. > Note that if your p

Structuring URLs by category?

2011-04-08 Thread Alastair Campbell
Hi, Hopefully a newbie question with an easy answer? I have a site with various modules (news, events, pictures galleries etc.), but I would like the site to be structured by categories rather than function. It's a windsurfing site, so the categories are race, wave, freestyle, etc. In my URLs,

Re: Queryset causes error on form validation

2010-04-12 Thread Alastair Campbell
To answer my own question, it looks like you can't do this: class LinkForm(ModelForm): event = forms.ModelChoiceField(queryset=Event.objects.filter(start_date__lte=today).order_by('-start_date')[:15]) The limit (of 15) will be counted as another 'slice' when the form is validated. I got aroun

Queryset causes error on form validation

2010-04-11 Thread Alastair Campbell
Hi Everyone, I'm getting an AssertionError from a modal form: "Cannot filter a query once a slice has been taken." But only when it is bound. My model is pretty simple: class Link(models.Model): title = models.CharField("Listings title", max_length=100) # other fields event = models.

Re: passing more information with formsets

2010-03-17 Thread Alastair Campbell
On Wed, Mar 17, 2010 at 7:02 PM, Dennis Kaarsemaker wrote: > In the view function, you could add an attribute (say, instance :-)) to > each form in the formset. That to me is a better way than doing weird > magic in a template. You're probably right, but I couldn't work that out for formsets: htt

Re: More tutorials and recipes?

2010-03-17 Thread Alastair Campbell
> On Mar 17, 11:23 am, Jirka Vejrazka wrote: >> > What I am looking for is something that goes beyond the tutorials to >> > bridge the gap to the detail of the modules. Are there any? I found the best next step was the "Practical Django Projects" book: http://apress.com/book/view/1430219386 (I n

Re: passing more information with formsets

2010-03-17 Thread Alastair Campbell
On Tue, Mar 16, 2010 at 7:46 PM, Dennis Kaarsemaker wrote: > Each ModelForm has an instance attribute, so you can use > {{ form.instance.whatever }} Hi Dennis, Unfortunately it is not a model form. The form creates an "entry", which is de-normalised data taken from the person (member) details and

Re: how to make radio buttion selected as form is loaded

2010-03-15 Thread Alastair Campbell
On Mon, Mar 15, 2010 at 10:26 AM, Daniel Roseman wrote: > Assuming that 'groupA' is a model field, there's no such property as > 'selections.groupA', because as you've stated, selections is a > queryset - ie a collection of model instances, not a single one. > > However in general you'd be better

passing more information with formsets

2010-03-14 Thread Alastair Campbell
Hi, I have a formset that is working well, but I'd like to use other information within that loop: {% for form in formset.forms %} [Member name would go here] {{ form }} {% endfor %} There is a queryset of member objects from the same view that matches the forms in the formse

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alastair Campbell
On Mon, Jan 18, 2010 at 5:25 PM, Alex Robbins wrote: > Hmm, you might also look at just doing something like > Event.objects.values_list > ('classes_involved__parent_disciplines__name', flat=True).distinct(). > That works on some relations, but I haven't tested it in your case. I tried that and a

Re: Efficient access through two manytomany layers

2010-01-18 Thread Alastair Campbell
On Mon, Jan 18, 2010 at 2:59 PM, Alex Robbins wrote: > Hmm, you posted the save method for your Event model, but not the > definition. I think you haven't gotten any feed back because no one > really knows what you are asking. Could you show the Event model, and > then show what a finished save sh

Efficient access through two manytomany layers

2010-01-17 Thread Alastair Campbell
Hi everyone, I have something that works, but I'm guessing it's *very* inefficient, I'm guessing that nested for-loops for two layers of many to many fields is bad, but how could I go about this better? The aim is for my admin users to fill in the sub-categories (classes), and for the system to w

Re: form.has_changed always true?

2010-01-11 Thread Alastair Campbell
On Fri, Jan 8, 2010 at 1:09 AM, Karen Tracey wrote: > Using the instance parameter is the POST leg also allows you to simply > save() the form to get the changes to the instance saved.  There is then no > need to individually copy each of the fields from the form's cleaned_data > dict to the model

Re: form.has_changed always true?

2010-01-07 Thread Alastair Campbell
Hi Margie, Thanks for the tip, when I do that, every filled-in field is returned as changed. I've put the model form definition and the view up here: http://dpaste.com/142308/ Any idea what I'm doing wrong? Perhaps something to do with loading the form with data in the first place? Kind regards

form.has_changed always true?

2010-01-06 Thread Alastair Campbell
Hi everyone, I've been looking for a simple way to send an email when a user updates their profile. After some digging I found form.has_changed() which appears to fit the bill. However, it always seems to return true, so I could end up bombarding our elderly admin lady with lots of useless emails

Re: FF3 src error in django admin calendar

2009-07-08 Thread Alastair Campbell
Ok, I think I got to the bottom of this, it's a combination of TinyMCE and Firefox 3.5 Unfortunately my Firebug expertise isn't that great, but with a few alert boxes, it is the IF statement in DateTimeShortcuts.js that isn't firing: var scripts = document.getElementsByTagName('script'); for (va

Re: FF3 src error in django admin calendar

2009-07-08 Thread Alastair Campbell
On Wed, Jul 8, 2009 at 1:08 PM, Karen Tracey wrote: > If the source for the page shows that the img src > values are relative, not absolute, it really sounds like the problem is your > ADMIN_MEDIA_PREFIX setting. My setting is: ADMIN_MEDIA_PREFIX = '/media/admin/' Also: MEDIA_URL = 'http://ukwin

FF3 src error in django admin calendar

2009-07-08 Thread Alastair Campbell
Has anyone else started getting application error emails from the Django admin after updating to Firefox 3.5? I haven't had much change to investigate, but I get 500 error emails with: ValueError: invalid literal for int(): 706/img/admin/icon_clock.gif Looking via Firebug, the src for the image

Re: Login during registration

2009-01-21 Thread Alastair Campbell
Thanks Bruno, Looks like out emails crossed in the ether! The error message didn't really help, it was failing at the auth stage, which doesn't help debugging. My colleague had to add debug code to Django auth to figure out the issue. I was just surprised that @login_required didn't check for i

Re: Login during registration

2009-01-21 Thread Alastair Campbell
To answer my own question... I got some help at work, and established that the login was failing because it is using the hashed password, not the raw one. That means that there is no way for me to use the activation stage to log the person in (apart from asking them for their details again). I ca