Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.

Bonus posted:

On our Django project, we're using jQuery and stuff works out just fine. You make views that serve the data that's requested asynchronously and then just write the jQuery to call them. Like king_kilr said, you can also use Django's serialization features in the views that are served up asynchronously. I like either serializing stuff into JSON and then reading it with the javascript or just directly sending html.

Funnily enough I'm working on that now in our app, but I've hit an issue.

The problem is when making a Ajax request, when I load a view because it extends the template above it and it loads in the whole page and not just the fragment.

I tried to pass a view variable from request.is_ajax() and put a {% if %} tag around the extend, it doesn't work - so what I'm having to do is create two versions of the same template, one without the extend.

It seems very anti-DRY, but I can find any other solution to it.

Adbot
ADBOT LOVES YOU

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.
Yea, I think I've kinda got it now - it's still a bit messy, but I had to fix some inheritance and I have my AJAX fragments which contain my login, and my non-ajax stuff too. It's starting to work out.

It's a pity, as some PHP frameworks I've used are able to handle this no problem :/

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.
The last Django application I worked on was in 0.96 and I'm trying to
get used to the new stuff in there.

I've been following the docs here: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#id2
trying to use the formset_factory on some forms.

I have a Contact model, and associated through a FK it has several
ContactNumber and ContactEmail instances. I've used ModelForm to
create the forms and it works successfully if I just have one instance
of the number and email, but when I try to create a formset for it, I
get this problem:

'ContactNumberFormFormSet' object has no attribute 'save'

But as far as I can see, I've followed the docs correctly??

I've pasted the code for my model, form and view below:

Contact,ContactNumber,ContactEmail models: http://paste.ifies.org/158
Forms: http://paste.ifies.org/161
View: http://paste.ifies.org/160

Any help on this would be appreciated

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply