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
duck monster
Dec 15, 2004

bitprophet posted:

Model subclassing is still not officially in, but the queryset-refactor branch (which will hopefully hit trunk in the next, I dunno, month or two maybe?) has implemented it: http://code.djangoproject.com/changeset/7126#file8

So if you're willing to use an unstable branch, you could check out that version of Django and give it a whirl. I haven't used it at all.


Depends partly on what you mean by "easier"; PHP's syntax is a little closer to Java than Python's is (what with the semicolons and curly braces and all). In terms of overall web development paradigms, I've never used Struts so I can't really say there.

PHP's syntax is sort of like javas. But honetstly, PHP's actual language isn't in the ballpark. Python does real OO, and does it loving well (Granted php5 is starting to look a bit more like real oo) and for added fun, you can still hang out in java land using Jython (or c# land using ironpython) and it all works smooth as poo poo. Hell, Java's Groovy is a pretty much self confessed rip of python but java-ish.

In re to the glowing review a bunch of posts back. Python is awesome, but its threading won't get you multiple core utilisation without some deep thought. Incidently tell guido to make that global interpreter lock gtfo, since thats what holds the multicore stuff back.

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Oh hey my perfect Job. Django with posibility of working with "quirky" backends. (Hadoop & Couch.).

pls move the job to Western Australia thanks.

duck monster
Dec 15, 2004

I'm starting to fairly hum in this little system :cool:

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.

duck monster
Dec 15, 2004

ATLbeer posted:

BTW, how the gently caress do you triple post!

Its that drat robot again :argh:

duck monster
Dec 15, 2004

For Django hosting, checkout Slicehost. Its just a dirtcheap vHost, and they are pretty cool guys. Select debian (naturally), apt-get up to python 2.5, follow the apache->django setup and serve django like a motherfucker. too easy.

And by cheap I mean 'absurdly cheap'.

duck monster
Dec 15, 2004

mod_python is loving terrible, unless you need to do a very small subscript of 'very wierd' apache tasks (such as rolling a http auth driver or something).

I blame it almost entirely for being the reason python is not the dominant web coding language on the net.

And for the loving life of me I still can't work out the caching.

duck monster
Dec 15, 2004

Yeah the python path thing can be whack. All sorts of python frameworks do it to (Webware for python, a tomcat style stack , does the same) but it really is for the best.

The best thing you can do for your security is to keep the python path AWAY from your main module hidey hole , and just bring in the standard modules it needs. That way if someone somehow manages to code inject or exploit an exec or something then you at least minimise the damage. Its only a mild protection, but if you combine it with , say , a chroot jail, you can pretty much wall off a section of your server thats public facing.

Of course all the cool kids serve out of vhosts these days anyway, so its probably moot.

duck monster
Dec 15, 2004

Mod python also lets you write custom authentication drivers for apache using python

So you can write a handler that covers a particular directory authing off your models, but passing the request back into apache.

Not sure how it works with lighthttpd.

duck monster
Dec 15, 2004

deimos posted:

gently caress mod_python TBH. Seriously, don't use it.

The alternative is mod_perl, or writing a C handler. gently caress that. mod_python is goofy, but it works. This isnt a content handler, its an authentication handler.

The only other way I can see it being done is to write a custom PAM handler using, I dunno, something.

duck monster
Dec 15, 2004

the talent deficit posted:

Not ideal, but is there a reason you can't just save the image to the filesystem, then pass the url to the request context? (Or redirect to it)? Just setup a cron to periodically remove images.

This is probably the best way, since you could then cache the image to save CPU

edit: Variation on the pattern. You point apache to the image directory where it shits out the image. Set it up so that if it 404s , it will fall back to the code that generates the image, which would then serve the image up for it (and supress the 404 code from being sent to the browser, because thats bad mojo) and then in future django wouldnt even need to be hit for it.

disclaimer: I know how to do it and make it work with mod_python by writing a custom handler, but I have no idea how to make it work for django.

duck monster fucked around with this message at 06:40 on Oct 11, 2008

duck monster
Dec 15, 2004

http://code.djangoproject.com/wiki/Dia2Django

Its a plug in script for Dia (which is a slut to get running on Os/X, but thats another story) that shits out model files out of UML drawings.

Works a loving charm!

duck monster
Dec 15, 2004

pluggables is worth a browse as well.

But I can give you the big picture right here;-

Work out your data structure. Write it using the model specification syntax (Just properties on some descended classes). Its pretty easy.

Get your graphic designer (or do it yourself) to draw a template. I just use dreamweaver and drop the tags into it.

Now write a bunch of views that take data from the models and poo poo them into the templates

shazam. you have a django app!

duck monster fucked around with this message at 09:14 on Oct 13, 2008

duck monster
Dec 15, 2004

Congrats.

I had started on a book on Boa-Constructor a while back, but it started becoming clear that the system had no future because the guy who maintains/coded it works at a ponderously glacial speed and is alergic to collaborating with people who want to help him.

Then I started on a book on Python Webware, but gave that up too because it was getting clear it was being majorly eclipsed by Django

I suck at future prediction. I'm sure this english lit degree will become handy ONE day.

duck monster
Dec 15, 2004

Google just open-sourced its jaiku engine which it uses to power its twitter knockoff, jaiku. And its all django!


http://code.google.com/p/jaikuengine/

Rock with the pros.

This is really simple nice code.


edit: Actually on further reading, its kinda wierd code, I guess thats cos its a django/app-engine app that I *think* was a twisted web app at one point. Not sure, but its got that smell about it.

duck monster fucked around with this message at 15:10 on Mar 16, 2009

duck monster
Dec 15, 2004

Django is just python, and python done right is allll about objects.

Start off with a pen and paper, get all your objects (Think laterally! Player. Game board. Card. So on, all those things are objects.) Draw lines and poo poo between them describing how they interact.

Now turn those objects into bunches of fields and poo poo and figure out how to turn those lines into relations (many-many one-one so on) and methods.

Then turn that into a model.py file and turn your views.py file into a big firetruck to drive the models around and poo poo out html using them.

Its all about objects. Modern software design always should be.

duck monster
Dec 15, 2004

Keep in mind the relational stuff does, as far as I'm aware, the joins at the python side rather than the mysql side.

Is there a way to use views as a back-end to a model to force the joins to operate smoothly at the mysql side

duck monster
Dec 15, 2004

Ansible posted:

Still a bit stuck on this but think I'm on the right track using model manager:

Whenever I reference a "Food" object, either through the Consumption model or directly, I want to have a few defined queries that will do some simple arithmetic and return a nutrient value. Nutrients are in value per 100g of Food, and modified by the measure and consumption amount.

So for example, when I loop through Consumption items, I want a Calorie query that will select a specific Nutrient item based on dynamic Food id and a static Nutr_Def id, then take (nutrient.value/100) * measure.grams * consumption.amount.

Is a model manager the correct way to do this, and if so should it be extending the Food model or should I put it in the consumption or measure models?

What are you doing your UML in?


edit: Oh yeah, I found a python script once that transformed dia UML into django models. Bit clunky, but it worked!

duck monster
Dec 15, 2004

deimos posted:

django now runs on Glassfish V3. Huzzah. Now there's no platform left to escape the power of django.

I've always wanted to enhance my Django experience with the joys of configuring a mindfuckingly huge number of complicated XML files.

duck monster
Dec 15, 2004

Pants down lads, its time to start whacking off

http://www.optaros.com/blogs/alfresco-django-integration-now-available-google-code

poo poo just got very loving pro. Want to offer your client the ability to edit his site in loving word , and synch it to your django site using the native sharepoint menus? Congratulations champ, you just got a pay rise!

duck monster
Dec 15, 2004

jupo posted:

This really is brilliant. One of the biggest hurdles the company I work for have faced with Django is actually selling it to clients due to how relatively unknown it is. I've honestly never heard of Alfresco before but looking at their client base this is just the kinda thing we need to pitch Django at an "enterprise" (I just threw up a little) level.

Alfresco is very loving cool, because it lets you automate business processes and do things like hook up with an ISO quality consultant or whatever and implement paper trail management and poo poo like that.

If you get into the workflows part of it, it starts to get really cool. Someone goes into word, fills in an order request, publishes it into an alfresco folder using words sharepoint interface, the thing then automatically forwards it to your manager, who reviews, ticks off, then fires a pair of copies into the purchases and engineering, meanwhile your customer logs into your django based portal (all authenticating from the same AD source) , reviews progress, and possibly adds a comment.

And you could impement that poo poo in a couple of days.

Double points if you replace the customers shared drives with the alfresco repository (It has a samba interface) , and start porting their ad-hoc internal processes into proper business flows.

Alfresco is serious enterprise poo poo, and it isn't microsoft, so theres geek cred right there.

Theres nothing it can do that sharepoint can't also do, and theres probably a few things sharepoint does better, but sharepoint can also be ridiculously frusturating, and I'm not aware of any django interfaces into sharepoint yet.

Quick note though: These guys also do a drupal add on for alfresco, and hosed if I can get it to work :(

duck monster
Dec 15, 2004

I tend to just use one app and many controller files organised by theme, per file.

I do wish Django insisted on putting controller methods in objects. Its probably just my OO dysfunction, but exposed functions make me barf.

duck monster
Dec 15, 2004

Magicmat posted:

So the answer is that Django development is no better on Windows than Rails?

Man, maybe I should just give in and do ASP.Net. At least that IDE is awesome.

It works great. I use Eclipse with PyDev and it works fantastic.

There are also python plugins for Netbeans and Visual Studio.

Python is a microsoft anointed first class citizen on the Windows platform.

duck monster
Dec 15, 2004

devilmouse posted:

I realize that's how django wants it done, but not how I want to do it. :colbert:

My deeply ingrained OO-tendencies and code organizations are in a fight with django!

I hear you man. I adore django, but occasionally I want to start punchups with it for letting you put functions outside of classes. I grew up on smalltalk (hence my Obj C love) so Im a bit of an OO zealot.

duck monster
Dec 15, 2004

MEAT TREAT posted:

I just noticed something that is missing from the OP. A list of good web hosts!

I just started using http://www.webfaction.com/ and after dicking around with other hosts these guys are a dream to work with. Being able to SSH into the my shared hosting and configure my own apache server is amazing!

Before that I tried using A small orange, and it didn't work out too well.

Hey thats a pretty neat thing. I'm still a slicehost guy, but for smaller projects thats a pretty good deal.

duck monster
Dec 15, 2004

If I wanted first class functions I woulda stuck with scheme.

*thats* how you do functions right.

duck monster
Dec 15, 2004

Its probably worth pointing out if you are not the sysadmin of the box, installing apps in /srv or /django or any other such top level directory will deeply annoy most sysadmins, because its funadamentally at odds with the posix scheme and I might you run the risk of breaking your backup plans if you have those cheap vhost backups that just backup /etc /home /opt and /var (or whatever)

A lot of the better datacenter setups have funky arangements that put 'static' and 'not so static' directories in different SAN clusters that will have different approaches to raid and backups to optimise for read vs write (ie slow writes on USR , /tmp stays on local blade and /var might have something thats a bit more balanced between read and writes

duck monster fucked around with this message at 16:52 on Oct 20, 2009

duck monster
Dec 15, 2004

yoyo

http://code.djangoproject.com/wiki/ProfilingDjango

Run your code through that bad boy and try and figure out where its lingering.

http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/

If you dont have access to kCacheGrind, WinCacheGrind should provide a pretty good profiling client

kcachegrind is phenomenal though.

Also, try using SQLite and see if the problem persists. I realise you don't want to use sqlite production, but it'll give a reasonable comparison to confirm against re your performance issues.

Also read this:
http://code.google.com/p/django-pyodbc/wiki/Settings

And try and work out whats your connection pooling and cacheing policy. You dont want it having to re-establish a connection each page load, you'll want a reasonable sized pool of connections with as much persistance as possible

duck monster fucked around with this message at 07:13 on Dec 15, 2009

duck monster
Dec 15, 2004

Big protip: Just stumbled across context processors. Makes life a HELL of a lot easier filling the template stuff thats persistant across all pages.

Unless theres an easier way to do the

{% extends 'blah.html' %}

and actually fill the poo poo in with blah without having to pass the same variables in every drat view.

duck monster
Dec 15, 2004

I'm having a problem with Django spitting blood about an underlying MySQL view.

I have a MySQL view that looks like this:

code:
SELECT 
    `prepaid`.`id` AS `id`,
    `prepaid`.`balance` AS `balance`,
    `line`.`customer_id` AS `customer_id`,
    `line`.`extension` AS `extension` 
FROM  `opensips`.`cdr_prepaid` AS `prepaid` 
JOIN 
      `opensips`.`vtel_line` AS `line` 
ON
  `line`.`extension` + _latin1'@url.of.client.com'  = `prepaid`.`account`   
The problem is when using inspectdb now , it vomits all over the floor when using inspectdb.
code:
class CustomerBalances(models.Model):
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.5/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/python2.5/site-packages/django/core/management/commands/inspectdb.py", line 22, in handle_noargs
    for line in self.handle_inspection(options):
  File "/usr/lib/python2.5/site-packages/django/core/management/commands/inspectdb.py", line 47, in handle_inspection
    relations = connection.introspection.get_relations(cursor, table_name)
  File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/introspection.py", line 53, in get_relations
    my_field_dict = self._name_to_index(cursor, table_name)
  File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/introspection.py", line 46, in _name_to_index
    return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name))])
  File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/introspection.py", line 38, in get_table_description
    cursor.execute("SELECT * FROM %s LIMIT 1" % self.connection.ops.quote_name(table_name))
  File "/usr/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 86, in execute
    return self.cursor.execute(query, args)
  File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 168, in execute
    if not self._defer_warnings: self._warning_check()
  File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 82, in _warning_check
    warn(w[-1], self.Warning, 3)
  File "/usr/lib/python2.5/warnings.py", line 62, in warn
    globals)
  File "/usr/lib/python2.5/warnings.py", line 102, in warn_explicit
    raise message
_mysql_exceptions.Warning: Truncated incorrect DOUBLE value: '@customer.url.com'
Why the gently caress is it nosying about in the view structure like that? Can I tell it "Django, that view is for another app, not for you, just pay attention to the tables please."

Occasionally and very randomly the app crashes with the same bug, despite the fact that the table/view in question isn't used at all, nor is there a schema in models.py for it.

Very loving annoying. This , by the way, is why magic is bad for frameworks.

Any solutions?

edit: seems like changing the string "addition" to a CONCAT() does the trick, but I still dont understand why Django cares about the views. Not for you Django!

duck monster fucked around with this message at 04:58 on May 11, 2010

duck monster
Dec 15, 2004

Anyone got a good suggestion for rolling back user creation when the profile record creation shits itself?

duck monster
Dec 15, 2004

entr0py posted:

Any particular reason you aren't simply using transactions?

Very good question. There is no reason, and I shall do this pronto.

Another question for folks. What are people using to implement CMS type functionality. My current work project is using django-cms and I can safely say its a steaming pile of turds. Its illogically laid out, and I cant find any straight forward way to stop it clobbering HTML entered into it, making it basically useless for our site.

But I have no idea what a good alternative is? Its not implausible to roll my own, but seriously what a drag...

duck monster
Dec 15, 2004

Any thoughts on good strategies for doing partial log ins.

The site Im working on has to take someones details, do an email confirm, THEN get their credit card details. Once the balance is positive, they can log in.

So I want to log them in partially, but not fully. If that makes any sense.

Theres already a pretty large site existing, and I dont want to change 100+ methods to be "aware" of this.

duck monster
Dec 15, 2004

Jonnty posted:

This sounds like something for permissions and groups - add them to "partial" group first, then move them to the "full" when their balance is positive.

Hmm. At the moment I'm using the 'active' flag (That triggers after the initial email confirmation). Maybe the trick might be to not use the usual @decorator to enforce log-in, and just match the username and password for the credit-card screen.

Sort of seems funky to me, but I think it'll work. I think.

The big catch is I might need to manually stuff the user/customer objects. In the command line util I wrote I'm creating a "bogo-request" that can emulate the request structure for certain functions and poo poo.

duck monster
Dec 15, 2004

Jonnty posted:

Everything you're doing sounds horrendously hacky. What do you think is wrong with using permissions and groups as they're meant to be used?

not rewriting a about 5-10K+ lines of horribly complicated pre-existing voip provider code because the boss had a brain-fart about login sequences. Theres a few hundred pages of configurator in this loving thing and its servicing tens thousands of customers. Not loving with that code is a high priority for me.

duck monster fucked around with this message at 01:45 on Nov 2, 2010

duck monster
Dec 15, 2004

Jonnty posted:

But surely you're writing the django code on top of all this?

No thats the django. Theres literally hundreds of pages of dynamic content in this site, poo poo, just in the administration alone, let alone the reseller sites, user pages and more, and it uses django's libraries under the hood for a bunch of configuration scripts and all the various mechanics hooking a VOIP website and the underlying mechanics of the provider.

duck monster
Dec 15, 2004

code:
#!/usr/bin/python
from django.core.management import setup_environ
import settings

setup_environ(settings)

from yourapp.daemon import *

rundaemon()

I put all my code in the daemon.py file, stuff it in cron and go from there. Its a handy way of doing regular tasks with the benefits of all your models etc.

I'd love to see someone put together a good ncurses (for headless boxes) templatey-menuey-inputy type library for django. Something like "Edit up your screens on this package, load em in your view, and capture the output in some controllers.

It'd make writing code for sysadmin stuff *really* easy

duck monster
Dec 15, 2004

Anyone ever encountred this. Happens the same in MySQL or Postgres (or more or less. Some sort of bitch-out about character lengths)

code:
bash-3.2# ./manage.py version
Unknown command: 'version'
Type 'manage.py help' for usage.
bash-3.2# ./manage.py syncdb
Syncing...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_admin_log
Creating table django_session
Creating table django_site
Creating table directory_account
Creating table directory_contactcard
Creating table directory_language
Creating table directory_biography
Creating table directory_keywords
Creating table directory_accountlanguage
Creating table directory_industryassociation
Creating table directory_industryassociationmembership
Creating table directory_socialnetwork
Creating table directory_marinadata
Creating table directory_publicity
Creating table directory_media
Creating table directory_exhibition
Creating table directory_exhibitor
Creating table directory_account_industryassociationmembership
Creating table south_migrationhistory

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yyes^H^Hb
Please enter either "yes" or "no": yes
Username (Leave blank to use 'root'): 
E-mail address: w!w.w.w!~!
Error: That e-mail address is invalid.
E-mail address: [email]duckmonster@mydilz.nik[/email]
Password: 
Password (again): 
Superuser created successfully.
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/Library/Python/2.6/site-packages/South-0.7.3-py2.6.egg/south/management/commands/syncdb.py", line 90, in handle_noargs
    syncdb.Command().execute(**options)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py", line 103, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/Library/Python/2.6/site-packages/django/core/management/sql.py", line 182, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/Library/Python/2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Library/Python/2.6/site-packages/django/contrib/auth/management/__init__.py", line 28, in create_permissions
    defaults={'name': name, 'content_type': ctype})
  File "/Library/Python/2.6/site-packages/django/db/models/manager.py", line 135, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 379, in get_or_create
    obj.save(force_insert=True, using=self.db)
  File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 456, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 549, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "/Library/Python/2.6/site-packages/django/db/models/manager.py", line 195, in _insert
    return insert_query(self.model, values, **kwargs)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 1518, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 788, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "/Library/Python/2.6/site-packages/django/db/models/sql/compiler.py", line 732, in execute_sql
    cursor.execute(sql, params)
  File "/Library/Python/2.6/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Python/2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: value too long for type character varying(50)
Unfortunately I cant seem to get the bloody thing to tell me what part of my code this is in, and I have no idea how to convince it to tell me.

FWIW Heres my models:

code:
# -*- coding: utf-8 -*-
# auto generated from an XMI file
from django.db import models

from django.utils.encoding import force_unicode

def getUnicode(object):
	if (object == None):
		return u""
	else:
		return force_unicode(object)
		

#
class Account(models.Model):
	companyname = models.CharField(max_length=255, null=False, default="", blank=True, )
	user = models.IntegerField(null=True, blank=True, )
	registrationdate = models.DateTimeField(null=True, blank=True, )
	modificationdate = models.DateTimeField(null=True, blank=True, )
	newsletter = models.BooleanField(default=False, null=False, blank=False, )
	listingtype = models.IntegerField(null=True, blank=True, )
	termsandconditionsversion = models.IntegerField(null=True, blank=True, )
	parentaccount = models.IntegerField(null=True, blank=True, )
	servicingregion = models.CharField(max_length=32, null=False, default="", blank=True, )
	servicingcountry = models.CharField(max_length=32, null=False, default="", blank=True, )
	servicingcity = models.CharField(max_length=32, null=False, default="", blank=True, )
	servicingradius = models.CharField(max_length=32, null=False, default="", blank=True, )
	contact = models.ForeignKey('ContactCard', blank=False, null=False, default=1, related_name='%(class)s_contact', )
 	billing = models.ForeignKey('ContactCard', blank=False, null=False, default=1, related_name='%(class)s_billing', )
 	parent = models.ForeignKey('self', blank=True, null=True, related_name='%(class)s_parent', )
 
	class Meta:
		verbose_name = 'Account'
		verbose_name_plural = 'Accounts'
		

	table_group = ''


#
class ContactCard(models.Model):
	telephone = models.CharField(max_length=32, null=False, default="", blank=True, )
	email = models.CharField(max_length=32, null=False, default="", blank=True, )
	website = models.CharField(max_length=32, null=False, default="", blank=True, )
	addressline1 = models.CharField(max_length=255, null=False, default="", blank=True, )
	addressline2 = models.CharField(max_length=255, null=False, default="", blank=True, )
	city = models.CharField(max_length=255, null=False, default="", blank=True, )
	state = models.CharField(max_length=255, null=False, default="", blank=True, )
	country = models.CharField(max_length=32, null=False, default="", blank=True, )
	cardtype = models.IntegerField(null=True, blank=True, help_text=ur'''CardType should represent whether its a billing address, contact etc.''', )

	class Meta:
		verbose_name = 'ContactCard'
		verbose_name_plural = 'ContactCards'
		

	table_group = ''


#
class Language(models.Model):
	languagename = models.CharField(max_length=32, null=False, default="", blank=True, )
	unicodepage = models.CharField(max_length=32, null=False, default="", blank=True, )

	class Meta:
		verbose_name = 'Language'
		verbose_name_plural = 'Languages'
		

	table_group = ''


#
class Biography(models.Model):
	content = models.TextField(null=False, default="", blank=True, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 	language = models.ForeignKey('Language', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'Biography'
		verbose_name_plural = 'Biographies'
		

	table_group = ''


#
class KeyWords(models.Model):
	content = models.CharField(max_length=32, null=False, default="", blank=True, )
	language = models.ForeignKey('Language', blank=False, null=False, default=1, )
 	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'KeyWords'
		verbose_name_plural = 'KeyWordses'
		

	table_group = ''


#
class AccountLanguage(models.Model):
	primary = models.BooleanField(default=False, null=False, blank=False, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 	language = models.ForeignKey('Language', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'AccountLanguage'
		verbose_name_plural = 'AccountLanguages'
		

	table_group = ''


#
class IndustryAssociation(models.Model):
	name = models.CharField(max_length=255, null=False, default="", blank=True, )
	logourl = models.URLField()
	websiteurl = models.URLField()
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'IndustryAssociation'
		verbose_name_plural = 'IndustryAssociations'
		

	table_group = ''


#
class IndustryAssociationMembership(models.Model):
	title = models.CharField(max_length=255, null=False, default="", blank=True, )
	account = models.ManyToManyField('Account', blank=False, null=False, default=1, through='Account_IndustryAssociationMembership', )
 	industryassociation = models.ForeignKey('IndustryAssociation', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'IndustryAssociationMembership'
		verbose_name_plural = 'IndustryAssociationMemberships'
		

	table_group = ''


#
class SocialNetwork(models.Model):
	type = models.IntegerField(null=True, blank=True, )
	url = models.URLField()
	username = models.CharField(max_length=255, null=False, default="", blank=True, )
	secret = models.CharField(max_length=1024, null=False, default="", blank=True, )
	writepermission = models.BooleanField(default=False, null=False, blank=False, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'SocialNetwork'
		verbose_name_plural = 'SocialNetworks'
		

	table_group = ''


#
class MarinaData(models.Model):
	name = models.CharField(max_length=255, null=False, default="", blank=True, )
	ismarina = models.BooleanField(default=False, null=False, blank=False, )
	maxdraught = models.FloatField(null=True, blank=True, )
	maxlength = models.FloatField(null=True, blank=True, )
	vhfchannels = models.CharField(max_length=255, null=False, default="", blank=True, )
	date = models.DateTimeField(null=True, blank=True, )
	lattitude = models.FloatField(null=True, blank=True, )
	longtitude = models.FloatField(null=True, blank=True, )
	marinefacilities = models.TextField(null=False, default="", blank=True, )
	nearbyfacilities = models.TextField(null=False, default="", blank=True, )
	berthstableu12 = models.CharField(max_length=255, null=False, default="", blank=True, )
	berthstable13t24 = models.CharField(max_length=255, null=False, default="", blank=True, )
	berthstable25t34 = models.CharField(max_length=255, null=False, default="", blank=True, )
	berthstable50t60 = models.CharField(max_length=255, null=False, default="", blank=True, )
	berthstableo60 = models.IntegerField(null=True, blank=True, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'MarinaData'
		verbose_name_plural = 'MarinaDatas'
		

	table_group = ''


#
class Publicity(models.Model):
	type = models.IntegerField(null=True, blank=True, )
	refersto = models.IntegerField(null=True, blank=True, )
	title = models.CharField(max_length=255, null=False, default="", blank=True, )
	content = models.TextField(null=False, default="", blank=True, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 	language = models.ForeignKey('Language', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'Publicity'
		verbose_name_plural = 'Publicities'
		

	table_group = ''


#
class Media(models.Model):
	mediatype = models.CharField(max_length=32, null=False, default="", blank=True, )
	path = models.CharField(max_length=255, null=False, default="", blank=True, )
	title = models.CharField(max_length=255, null=False, default="", blank=True, )
	keywords = models.CharField(max_length=255, null=False, default="", blank=True, )
	description = models.TextField(null=False, default="", blank=True, )
	parentrec = models.IntegerField(null=True, blank=True, )
	ispublic = models.BooleanField(default=False, null=False, blank=False, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'Media'
		verbose_name_plural = 'Medias'
		

	table_group = ''


#
class Exhibition(models.Model):
	name = models.CharField(max_length=255, null=False, default="", blank=True, )
	location = models.TextField(null=False, default="", blank=True, )
	datefrom = models.DateTimeField(null=True, blank=True, )
	dateto = models.DateTimeField(null=True, blank=True, )
	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 
	class Meta:
		verbose_name = 'Exhibition'
		verbose_name_plural = 'Exhibitions'
		

	table_group = ''


#
class Exhibitor(models.Model):
	issponsor = models.BooleanField(default=False, null=False, blank=False, )
	isexhibitor = models.BooleanField(default=False, null=False, blank=False, )
	name = models.CharField(max_length=255, null=False, default="", blank=True, )
	description = models.TextField(null=False, default="", blank=True, )
	exhibition = models.ForeignKey('Exhibition', blank=False, null=False, default=1, )
 	account = models.ForeignKey('Account', blank=False, null=False, default=1, )
 	logo = models.ForeignKey('Media', blank=False, null=False, default=1, related_name='%(class)s_logo', )
 
	class Meta:
		verbose_name = 'Exhibitor'
		verbose_name_plural = 'Exhibitors'
		

	table_group = ''


# Many To Many Tables 

#
class Account_IndustryAssociationMembership(models.Model):
	account = models.ForeignKey('Account')
	industryassociationmembership = models.ForeignKey('IndustryAssociationMembership')
I cant see anything wrong there. Its autogenerated from a UML diagram, and has a few hand tweaks, but yeah. :confused:

duck monster
Dec 15, 2004

Captain Capacitor posted:

Run "./manage.py sql" to create the SQL commands for all of the tables involved and you can see which one has a limit of 50.

None of them :(

code:
bash-3.2# ./manage.py sqlall directory | grep 50
ALTER TABLE "directory_account" ADD CONSTRAINT "parent_id_refs_id_5030256d" FOREIGN KEY ("parent_id") REFERENCES "directory_account" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "directory_account" ADD CONSTRAINT "contact_id_refs_id_8d33500a" FOREIGN KEY ("contact_id") REFERENCES "directory_contactcard" ("id") DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "directory_account" ADD CONSTRAINT "billing_id_refs_id_8d33500a" FOREIGN KEY ("billing_id") REFERENCES "directory_contactcard" ("id") DEFERRABLE INITIALLY DEFERRED;
    "berthstable50t60" varchar(255) NOT NULL,
bash-3.2# 
bash-3.2# 

duck monster
Dec 15, 2004

Bingo! By shortening the name of that table to the super descriptive
'DAIM' the migrations all run sanely without making GBS threads themselves.

What a *stupid* bug. Its been reported to hell and back on the django bug tracker, but I see no evidence at all of it being either fixed or that there is any desire to fix it. :(

Apparently it might break older code SOMEHOW. v:shobon:v

All I could really find was a cobwebbed bug tracker, and some douchebag developers pouring piss and venom on some poor newbie that tripped over it.

duck monster fucked around with this message at 05:07 on Jan 17, 2011

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Mulozon Empuri posted:

Was there nothing to be found in your database log?

Nope!

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