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
Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
Anyone managed to get Django working with MSSQL? I can make little to no sense/progress with what I found while googling.

Adbot
ADBOT LOVES YOU

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
How/where do I turn off the conversion of linebreaks to paragraphs in the admin interface (TextField)? I just want a nice clean HTML-capable textarea.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

bitprophet posted:

What exactly do you mean? AFAIK TextField should not be doing anything special when it displays in a template unless you pipe it through the 'linebreaksbr' or similar template filters. Where exactly is it changing line breaks to paragraphs - where is your inputted text displaying?
The admin interface automatically converts line breaks to paragraphs when it saves to the database, as far as I can tell. When I put in my own paragraphs, there are extra p tags strewn around that aren't from me.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

bitprophet posted:

That can't be right - a literal, normal TextField should save plain text to the database 100% literally, with zero HTML whatsoever unless you've entered it yourself.

Where are you viewing "the database" exactly? I'm guessing that the P tags are getting inserted by some post-database process, or by whatever tool you use to view the source (e.g. Firebug's HTML viewer seems to 'tidy' the HTML and might end up appearing to insert extra tags like that).

But, again, a normal, unaltered (meaning no save() override in the model or anything) TextField should never be performing any sort of transform on your data, period. So something else should be going on here.


StabbinHobo, you don't work in the journalism field, do you? Not at a paper in JC perhaps?
Holy poo poo you're right. I loving hard-coded them into the template. Firefox/bug "tidied" them, turning one broken set of tags into two, giving me the illusion that paragraph tags were stuffed in all over the place.

Today, I am that programmer.

Typh fucked around with this message at 23:15 on Mar 28, 2008

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

bitprophet posted:

Nah, everyone does this, and more often than they admit. It's part of the job, we have so many different scenarios and environments and variables (in the non code sense) floating around that it's stupidly easy to make silly mistakes like that.

The trick is not spending too long chasing any one "bug"...we tend to get like bulldogs and latch onto a single issue and beat our heads on it for extended periods. If the entire bug hunt is predicated on a mistake, we've just wasted hours of our time (experience talking here :() so it's good to develop a habit of "ok I just passed the two-hour mark without making much real progress - time to take a step back and try a different approach".
I was digging through the admin code, running from file to file, function to function, trying to track down where it was coming from. Why didn't I check the database to see if it was really there.

Anyways, back to loving Django.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
I read Dive Into Python, the Django docs, and the first seven chapters of The Django Book. Now there's not much I can't do or figure out using the docs and the IRC channel.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
How in the hell do you people handle dynamic menus? I just want a simple submenu on my sections, but have no idea how to go about pulling the relevant subsections (which could be flatpages or not). Flatpages I can get because I gave them a section property, but regular urls/views I have no idea how to specify their parents/pull them out. Without data duplication anyways.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
So, did anyone get tickets to Djangocon after? If so, let's meet up.

Typh fucked around with this message at 13:02 on Aug 11, 2008

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

Space Kimchi posted:

When 1.0 rolls out, is it likely that if I upgrade my existing applications will work just fine (none of them use any particularly fancy or hackish features) or will there likely be some problems to crop up?
There will be problems because of newforms-admin.

I'm running trunk for new development and the pre-newforms-admin tag for everything before the merge (http://code.djangoproject.com/svn/django/tags/notable_moments/pre-newforms-admin/). I just symlink (well, junction on windows) to a different version when I need to.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
Woo! As fascinating as Malcolm's talk on the ORM was, I couldn't wait to get to watch James Bennett's reusable apps presentation (and the schema panel!). I didn't realize until I got there that presentations were happening at the same time.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
I just have a search keyword assigned to the documentation search box. So when I need to find something, I just type "dj [search term]" in my address bar.

Typh fucked around with this message at 21:50 on Oct 8, 2008

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
I've been using Django for over two years and template tags still drive me loving batty, especially when paired with forms. Can anyone comment on how the hell to encapsulate form processing logic so I don't need to write the same code all over my project? Group post here.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
Elaborate, please. The form logic isn't specific to any view, so why would it live in one? Are you suggesting that I should duplicate form processing across all views that use the same form?

Edit: Here is my template tag http://dpaste.com/129111/
I'd rather save myself the duplication and cheese the redirect. Surely there's a better way.

Typh fucked around with this message at 18:35 on Dec 4, 2009

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

MonkeyMaker posted:

Form validation goes in forms.py. Form processing goes in views.py since you could want it processed differently depending on the 'location' of the save. Template tags are NOT the place for anything like this.

If it's one form that's in multiple spots so you don't want multiple views for processing it, just make one and always direct it to that one. Forms/views from one app can hit views from another app just fine.

The Django docs on forms are actually really good (until you get into formsets, then it's a little wanting). I'd give them another read if I was you.
But if I use a separate view for processing, what do I do when the form is invalid? I'd need to set up a way to return them back to the view they came from.

Which is something I don't have to do if I use a template tag.

I understand "that's not what template tags are for", but the options presented otherwise do a much worse job of staying generic.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
Form validation doesn't automatically go back to the URL you came from. Usually you call it from the view that loaded it originally anyways, and since you haven't redirected, that's where you end up again.

I'm not making excuses to justify doing it the wrong way, I'm looking for pieces I might be missing to do it cleanly the "right" way.

The URL isn't enough info because I need the objects from the original view to populate the form. Which as far as I can tell leaves me to stuff them in the form or session, which is pretty lame.

I'm trying now to call the form processing view from my original view. Not ideal, but will hopefully cut the duplication down to a single line.

Typh fucked around with this message at 20:36 on Dec 4, 2009

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

LuckySevens posted:

I'm a moron. I just spent 2 hours trying to get a custom comment system preview to display properly. I couldn't work out why it was giving me a 404. I tried everything, even ported it into another project and somehow it worked there. I made a post here with all the info, and it wasn't until I was seconds away from posting that I saw it.

I put the urlpattern under my flatpages. please tell me im not the only one to have done this :(
At least once a month, my friend, at least once a month.

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!

Hanpan posted:

Can anyone recommend me a decent UK Django host which is fairly affordable? We just need some cheap, reliable and fast.
http://www.webfaction.com/

They are my go-to host for anything that doesn't need a VPS.

Adbot
ADBOT LOVES YOU

Typh
Apr 18, 2003

LAY EGG IS TRUE!!!
This has been tripping me up so often lately that I'm starting to wonder if I have a workflow issue or if I'm the only one using django migrations https://code.djangoproject.com/ticket/23410

How the heck are you supposed to work on/test a migration (ie data migration) if you can't reliably roll it backwards/forwards without random other apps rolling back too?

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