|
deimos posted:I am not against storing ints where ints are due, but making them small or large really isn't saving you a lot. Still I'd love to know if it's some sort of backend issue with django so that a proper ticket can be opened. Not a backend issue, just my own stupidity. I was passing a list of strings to killed_by because i r dum.
|
# ? Apr 20, 2008 03:07 |
|
|
# ? May 15, 2024 04:55 |
|
Is there anyway to have syncdb just drop all the tables and reinsert them? At least for one application? I am porting an existing app and when I mod a table to add fk relationships, etc. it is really annoying to have to delete the tables by hand and then let django re-add them. Perfect would be leaving the django stuff alone (admin, auth, etc) but dropping all tables related to a specific app and re-adding them.
|
# ? Apr 23, 2008 00:50 |
|
syncdb can't do it, but your best bet is probably manage.py sqlclear and sqlall: sqlall [appname ...] Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s). sqlclear [appname ...] Prints the DROP TABLE SQL statements for the given app name(s). You can make a shell script to pipe the output of these into your database's command line client
|
# ? Apr 23, 2008 01:01 |
|
jarito posted:Is there anyway to have syncdb just drop all the tables and reinsert them? loaddata docs have the information on how to create these fixtures here the syncdb docs state: quote:syncdb will also search for and install any fixture named initial_data with an appropriate extension (e.g. json or xml). See the documentation for loaddata for details on the specification of fixture data files.
|
# ? Apr 23, 2008 01:15 |
|
Sounds great. That should tide me over until the schema gets a little more definite. Got another stupid admin question. I have this in my models.py:code:
code:
|
# ? Apr 23, 2008 01:51 |
|
jarito posted:Sounds great. That should tide me over until the schema gets a little more definite. Got another stupid admin question. I have this in my models.py: generally speaking you don't want nulls in tables, it does funky stuff with some queries and generally acts weird depending on implementation. As to your problem, you also need blank=True. blank controls Admin.
|
# ? Apr 23, 2008 02:08 |
|
deimos posted:generally speaking you don't want nulls in tables, it does funky stuff with some queries and generally acts weird depending on implementation. Not for much longer! On This Week in Django(great podcast), Malcom Tredinick(core commiter), said queryset-refactor will be getting merged sometime this week/next week, that branch fixes tons of SQL construction issues(including NULLS, joins, and about a billion other things).
|
# ? Apr 23, 2008 07:50 |
|
Figure I'd post this here first since I'm looking for people that would be reading this thread anyhow. Any Django programmers in the greater Atlanta area? I have a pile of programming work on my desk that is going to be impossible for me to do in this lifetime and I need some help doing the heavy lifting in the form of a contractor(s). I'm looking for Python Django (If you have good experience working in WebDev with other frameworks but, are learning Django thats fine too) HTML / CSS Experience Javascript / AJAX Experience a plus MySQL experience a necessity. We are doing very rapid application development for a big company. Not everything you do will see the light of day (public) and you WILL have to sign a NDA. This is a non-negotiable, sorry. Only get in contact with me if you understand what this means and are comfortable working with a NDA. You really have to be based in the ATL area. This can't be a telecommute thing, sorry (unless you live in a really cool exotic local and I can get my company to cover my T&E there... You better be a rockstar though ) (about 99% kidding there) GTech students. I know your probably the in the middle of your senior design work or exams. Don't worry, go ahead and shoot me an email and a resume (if you have one) as well. If your work is good enough and I can wait a bit for the semester to be over. atlbeer (at) gmail.com Things to include: - Resume - Current / previous websites with a short description of what your work for the site was, a bit about it's architecture - Open Source projects? - Have you written any Django or Python modules? Include some links. - Have you worked with other types datastores (BigTable, CouchDB, etc?) mention it - Have you had any work with Hadoop? mention it.
|
# ? Apr 23, 2008 18:25 |
|
Why's there never any Django jobs near Philly !
|
# ? Apr 23, 2008 18:47 |
|
Oh hey my perfect Job. Django with posibility of working with "quirky" backends. (Hadoop & Couch.). pls move the job to Western Australia thanks.
|
# ? Apr 24, 2008 07:52 |
|
king_kilr posted:Not for much longer! On This Week in Django(great podcast), Malcom Tredinick(core commiter), said queryset-refactor will be getting merged sometime this week/next week, that branch fixes tons of SQL construction issues(including NULLS, joins, and about a billion other things). Ohh lordy lordy, this is excellent news.
|
# ? Apr 24, 2008 08:23 |
|
Totally forgot about this, but since I did get this fixed I thought I should mention what was causing it. Wulfeh posted:I know this is a big vague, but hopefully someone may have an idea I had my objects set to a custom search manager in my models, and when I was trying to delete the model it was trying to use the search managers args, which I wasn't passing. Anyway long story short I now have: code:
|
# ? Apr 25, 2008 15:59 |
|
duck monster posted:Oh hey my perfect Job. Django with posibility of working with "quirky" backends. (Hadoop & Couch.). So just humorously I checked to see what it would take to fly out to the underside of the world (never been there before ) From Atlanta the cheapest flight (business class ).. Atlanta -> Los Angeles (4hr 52m) (+2hr layover) Los Angeles -> Bangkok (17hr 30m) (+16hr layover) Bangkok -> Perth (6hr 15m) And the return trip Perth -> Phuket (6h 15m) Phuket -> Bangkok (1h 25) (+8hr layover) Bangkok -> New York (17h 30m) (I think that's actually an over the north pole flight, kick rear end) New York -> Atlanta (2h 41m) (+4 hr layover) NINETY HOURS OF TRAVEL... for only $9k USD... My rear end feels sore just thinking about that.. Although for $17kUSD I can fly on Thai Airways... Sorry man.. It's small planet with airplanes but, that's so far away.. Hahah.. If there's anyone else in this thread that's interested I'd send an email this weekend because Monday I'm going to post a SH/SC thread and start expanding my search options.
|
# ? Apr 25, 2008 18:13 |
|
I believe that Perth is considered the world's most remote city of its size. It's a long flight even from the other big Australian cities. It's a pretty cool distinction, I think. pls move the job to Tasmania thanks (we're closer because you can trvael via Melbourne )
|
# ? Apr 26, 2008 04:10 |
|
Learning to use Django is hard, can you recommend me a book to read apart from 'The Django Book'?
|
# ? Apr 26, 2008 14:08 |
|
If you know python, the Docs are incredibly awesome and the tutorials get you 90% of the way there. If you don't know python, pick up a book on python.
|
# ? Apr 26, 2008 16:36 |
|
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.
|
# ? Apr 26, 2008 16:52 |
|
I'm starting to fairly hum in this little system The fun part is using pythons wierd little libraries in unexpected ways in django. Is there a way in Django to launch a persistant process, or ought I just fork some poo poo out the side of manage.py (yes. brutal. I know.) I wanna be able to run shortest-path searches along a dataset of around 4000 points in a digraph topology. Its not that the algorithm is slow, its bitching fast. Its loading and organising the goddamn dataset.
|
# ? Apr 26, 2008 18:52 |
|
And queryset-refactor just hit trunk: http://code.djangoproject.com/changeset/7477 YAY!
|
# ? Apr 27, 2008 04:24 |
|
king_kilr posted:And queryset-refactor just hit trunk: http://code.djangoproject.com/changeset/7477 YAY! Quite possibly the best merge since the magic removal branch hit trunk.
|
# ? Apr 27, 2008 07:05 |
|
Upon further reading, it seems the documentation (which I was reading before) when coupled with 'The Django Book' make for a good amount of well written documentation. I think I'm starting to understand what's going on. The confusion came from how different the scope is here, Rails really does tie you down and make things difficult in a lot of respects. Django only loads what it is using on each page? Rails doesn't require you to load/initialize/import anything at all, I suspect that makes each Rails app somewhat resource intensive in comparison. I see other benefits to the way Django is doing it, I'm just surprised. That amount of control and manual 'work' is unheard of in the Rails community.
|
# ? Apr 28, 2008 11:42 |
|
Nolgthorn posted:[...] The way I've seen it, without having used Rails much but working at a shop where it's used by 50% of the dev team, is that Rails goes the extra mile in terms of leveraging cleverness and magic and making decisions on your behalf. The benefit of this is that it's less work in those cases where Rails' decision-making lines up with your needs, and/or where you don't run into bugs that are made difficult to fix due to having to track down said magic. However, if you want/need to differ from Rails' opinions on things, then you have to struggle with the framework to get things done, and/or omit large gobs of functionality. Django, on the other hand, tends to not offer as much extra stuff, but that's because it wants to avoid that above situation where the user then has to fight the framework to get things done their way (with the exception of Django's ORM, which is used for the admin and generic views; but that's more of a technical constraint rather than an explicit choice made by the core team). For example, Rails tends to tie you to Prototype for Ajax stuff, insofar as its JS helper code uses Prototype only (or so I'm told); Django doesn't offer such helpers, so you can use whatever Ajax library you want. So, yea, neither approach is inherently wrong, it's just two different philosophies at work.
|
# ? Apr 28, 2008 13:50 |
|
Most notably chapters 8 and 9 of the Django Book are being really helpful, these are answering a lot of questions I had which were slowing down my learning process. Things like "Why are some of these in quotes and others not?" or "Why do some methods need to be explicitly imported and others are just magically working, how does it do that?" I generally had this feeling like I needed an instructor or a book to explain what I wasn't getting. I am loving this now, those new to this should be sure and read those chapters. Hah! I'm building my personal project in Django. It's going to be a content driven comedy web site updated and moderated by it's users, move over sa. Hahahaha!
|
# ? Apr 28, 2008 14:25 |
|
Are there any more tutorials on how to write views/urls? Or any really good examples available in the djangosites w/sources? I've linked up a pre-existing database to my django code. The admin app has incredible power, which demonstrates most everything I want my users to be able to view (search, sort by category). I have about 5,000 records that I want to be able to cross-reference with links inside records. First I'm trying something easier - I want to create a url/view so that https://www.mysite.com/english/x/ where x is a letter a-z returns all entries starting with that letter. Writing 26 different urls sounds stupid, plus I two other similar patterns with another ~250 entries. why doesn't this work? views.py code:
code:
|
# ? May 4, 2008 04:59 |
|
politicorific posted:I can define "englishdictionary" in views.py to be any letter I want, but how do I get django to determine the variable based on the url? I think Named Groups is the solution, read the section on them here Basically, change the line in urls.py to: code:
code:
ImJasonH fucked around with this message at 05:33 on May 4, 2008 |
# ? May 4, 2008 05:24 |
|
awesome! That worked perfectly
|
# ? May 4, 2008 05:52 |
|
okay two questions and this is more just to show off... urls.py code:
Basically I'd like to do the same thing as before code:
Next question regarding views/models. __str__ in model constructs the output of the database search into a single string. I need to manipulate this data separately - each piece goes to a different place. I suppose I could use .split() and create another list, but that just doesn't seem elegant enough. code:
really this goes on forever, there are 49 instances of %s and 49 different variables it's combining. There must be a better way!
|
# ? May 4, 2008 15:41 |
|
politicorific posted:Next question regarding views/models. code:
It's not 100% clear what exactly you're trying to accomplish, though, so maybe you should step back a bit and give us a better idea
|
# ? May 4, 2008 16:19 |
|
okay here I'll be explicit: Here's the assumption that I want blown apart, that an application of a project can only receive a single output from models.py. code:
then: code:
Can I use a similar admin setup like this for my applications? If so how do I address them in other modules? code:
code:
|
# ? May 4, 2008 16:55 |
|
I...I don't think you quite get this __str__ is solely a convenience method for printing out a string representation of your model object, like when you're debugging or displaying a list. "output from models.py" doesn't mean jack poo poo: you're supposed to query the database using the ORM, not parse the string representation of your model, or whatever you're trying to do. It looks like you're trying to basically build an arbitrary query front end or something (like phpMyAdmin)? It's not clear. Can you give some example use cases in plain English? I.e. "I want to find all Entry items in my database which have the word 'Foo' in their 'english' field" or etc. What is the real world problem your application is trying to model and solve here?
|
# ? May 4, 2008 20:20 |
|
I having an issue with the database not updating the coloums when the models are changed. I saw in the thread that it is a known issue. Is there a way to force it to update? I am running Django 0.96.1
|
# ? May 6, 2008 07:36 |
|
liquidfury posted:I having an issue with the database not updating the coloums when the models are changed. I saw in the thread that it is a known issue. Is there a way to force it to update? I am running Django 0.96.1 It's not just a known issue, it's just the way it's going to be. You have to recreate the database/tables when you make a change to the model. There was a schema-evolution branch in progress, but I don't know what is happening with it. Alternately, manually make the changes
|
# ? May 6, 2008 07:52 |
|
Yea, it's a decision made by the Django devs (for the time being, anyway) that having a script automagically update the DB based on changes you make to your models, isn't a good idea. There's a lot of places where such a script could gently caress things up or cause you to lose data, and they didn't want people to be tempted to run that kind of tool on live data. Or, put another way, you really ought to know at least enough about SQL to be capable of making minor changes to your DB schema, if you're going to be making sites; that's my opinion, anyway. It's really not hard to run a couple of ALTER TABLE statements during development That said, yea, it's a commonly asked-for feature and there are a few projects out there trying to address it, but nothing that's hit prime-time yet. Your best bet is to try checking out the schema-evolution branch and play with that, but it's not for the faint-hearted. Actually, I take that back - your best bet is to read a few SQL tutorials so you understand how to make the changes yourself, it really is. You'll be a much better developer for it. bitprophet fucked around with this message at 15:47 on May 6, 2008 |
# ? May 6, 2008 15:44 |
|
If you want schema migration I would check out django-evolution(on google code).
|
# ? May 6, 2008 19:37 |
|
No Safe Word posted:It's not just a known issue, it's just the way it's going to be. You have to recreate the database/tables when you make a change to the model. There was a schema-evolution branch in progress, but I don't know what is happening with it. I am not worried about loosing the data in the table. Is there a way I can force it to just recreate the models? I know sql so going in and making changes isn't an issue, but I was much happier not having to. So if I added a foreign key relation to the class I just have to add a foreign key relation to the actual tables? edit: fixed it. should have read django faq liquidfury fucked around with this message at 22:31 on May 6, 2008 |
# ? May 6, 2008 22:19 |
|
What I usually use when I want the database nuked and then resynced is a script that I run. I usually have an sqlite database on my development machine. Here's what it usually containscode:
What I'm having the most problems with is keeping test data in the face of changing models. Say I have some tests and some test fixtures which the tests load when they begin running so they have something to operate on. Now if I change the models and run the tests, all of a sudden the test data can't be loaded in by the tests because the models are different than what the test fixture was made for. I usually have a test fixture in JSON. So anyone know a good way around that?
|
# ? May 6, 2008 22:57 |
|
Bonus posted:code:
|
# ? May 7, 2008 03:58 |
|
Yes but you see, this way I get to use the awesomely cool yes program.
|
# ? May 7, 2008 12:02 |
|
Bonus posted:Yes but you see, this way I get to use the awesomely cool yes program. With "no" as an argument for extra fun.
|
# ? May 7, 2008 20:49 |
|
|
# ? May 15, 2024 04:55 |
|
I've been trying to figure this out for a little bit, and I think I'm confused. I'm trying to build a survey form. You know, the kind where it asks you questions and you fill in a circle for "Strongly Agree", "Agree," "Disagree", etc. My model has each of those in an int field with a choices enum. Now, the thing works fine. About an hour of coding, most of that typing all the questions into the verbose names, and it's done. However, the widgets look like crap. The standard RadioSelect outputs as lists. No problem, right? I just wrote a custom renderer. code:
edit: I just blanked the strings in the enum structure. I don't know if this is the "right" way to do this, but it works. Larry Horseplay fucked around with this message at 22:44 on May 7, 2008 |
# ? May 7, 2008 21:44 |