Re: Verticity
On Nov 13, 2:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > http://www.verticity.com > > On Nov 13, 2:26 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > Verticity is currently hiring software enginers and programmers > > specialy dot net developers in thier regional office Karachi. > > little about verticity inc: > > > VertiCity was founded on the premise that through the medium of the > > internet geographic barriers could be broken down and a truly global > > city, where IT services could be provided for clients throughout the > > world, would be created. Our REMS (Remote Employee Management System) > > allows our clients to take advantage of a pool of highly talented and > > cost effective IT professionals. Our services enable IT Application > > Development process to become efficient and cost effective. Not only > > have our services reduced our clients IT costs by up to 80%, but by > > providing them highly qualified professionals, VertiCity has also > > saved them immeasurable hours of search time and have made offshore > > outsourcing seamless and without borders. > > > Verticity, Inc is a privately held and funded conglomeration of web/ > > software technologies and services -first started in 2001. We are > > rooted in product and have produced innovations in distinct and > > growing B2B spaces. Many of our professionals are experts in their > > fields and by tapping into our resources, clients are able to take > > advantage of Verticity's outsourcing model which has proved to be > > highly effective and cost-saving. > > > At Verticity, we help clients innovate their businesses to achieve > > extraordinary results from their customer relationships, business > > operations, and technology. Verticity's promise to our clients: to do > > whatever it takes to deliver the right business results, on time and > > on budget. We have consistently delivered on this promise, achieving > > success for our clients. Not happy? > > > Clients choose Verticity for our commitment to their success, our > > dedication to delivering our promise, and the straightforward and > > collaborative way we work with them. Not many companies give their > > clients complete control over their offshore team. Verticity prides > > itself on that.- Hide quoted text - > > - Show quoted text -+ Well Silver glad to see this news tht verticity inc http://www.verticity.com has several openings in their company. Verticity inc http://www.verticity.com is a largest software House in the IT world and peoples recomend verticity for development. thnx for sharing such nice knowledgement. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: use the same database for different web sites
On Tue, 2007-11-13 at 21:48 -0800, [EMAIL PROTECTED] wrote: > Dear Django Friends, > I started the tutorial in the Docs folder. So i had a mysite folder > and inside that i had a polls subfolder. Everything works fine. Then i > wanted to try the generic codes in a new folder, also a subfolder of > mysite, called genpolls. I created the views, urls and models python > files i.e .py files. > Then i get a programmer error that the table genpolls_polls > doesn't exist. After much checking i find that the database tables are > named polls_poll and polls_choice because of the path to folder > "polls" when i first created the database. Thus the path from the > genpolls folder( where the models, urls, and views files reside) gives > a table name = "genpolls_polls" which doesn't match any table in the > database. > >So how to use the same database for two separate programs or web > sites. Since table name are a combination of application name and model name, by default, normally things will "just work". You appear to have changed the application name mid-stream, which is why you're seeing something go a bit awry. Fortunately, you can have full manual control over the database table name. See http://www.djangoproject.com/documentation/model-api/#db-table . Regards, Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
use the same database for different web sites
Dear Django Friends, I started the tutorial in the Docs folder. So i had a mysite folder and inside that i had a polls subfolder. Everything works fine. Then i wanted to try the generic codes in a new folder, also a subfolder of mysite, called genpolls. I created the views, urls and models python files i.e .py files. Then i get a programmer error that the table genpolls_polls doesn't exist. After much checking i find that the database tables are named polls_poll and polls_choice because of the path to folder "polls" when i first created the database. Thus the path from the genpolls folder( where the models, urls, and views files reside) gives a table name = "genpolls_polls" which doesn't match any table in the database. So how to use the same database for two separate programs or web sites. I could put the models.py file in the "polls" folder, rename it to modelsg.py and import the Poll and Choice classes from there and it worked. But one would like to keep separate folders for separate site files/code. Thanks much for your suggestions. Being new to Django there may be, probably is, a simple solution i haven't found yet. Just starting the fun, Markandeya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Hybrid-django server leaving connections open...
On Nov 13, 5:04 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 11/13/07, John Penix <[EMAIL PROTECTED]> wrote: > > > We've stuck a bit of ORM-using code from our "pure" django server into > > another server that was only using django templates. We have been seeing > > connections left open occasionally. I browsed the mailing list archives and > > it sounds like django should be closing the connection. I'm wondering if we > > aren't always tripping the code that closes the database connection since > > this server is not using django to generate responses. > > Because it's oriented around web serving, Django closes the connection > on the "request_finished" signal; if that signal is never fired, > Django will not close the connection. Additionally, if something else > requires database access after the signal is fired, a new connection > will be opened and will not be closed. Cool. So I'm guessing that if we send that signal as described here: http://code.djangoproject.com/wiki/Signals The connection should get closed. I'll report back if it doesn't work. Thanks! John > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Ordering by related table problem
On 11/14/07, Malcolm Tredinnick ([EMAIL PROTECTED]) wrote: >On Tue, 2007-11-13 at 15:19 -0700, Scott SA wrote: >> Hi, >> >> Okay, I've been having trouble getting this to work, though it _looks_ easy. >My results have proven otherwise (django 0.96, by the way.. I'm modifying an >esisting system, not creating a new one so don't have an upgrade option right >now). >> >> For simplicity, heres a table overview >> >> Any suggestions would be greatly appreciated, > >It's probably bug #2076. Thanks. I was close by trying the select related but I see now I messed up on the django table prefix. I needed the app-name prefixing the table i.e. recs = Table_1.objects.select_related().order_by('app_table_2.name') instead of: recs = Table_1.objects.select_related().order_by('table_2.name') The first example works as desired, the second hurls errors. Thanks agian! Scott --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Accessing legacy DBs with table-less models
Bugger, the view approach won't work as the SQL query takes parameters. On Nov 14, 3:59 pm, Tomek <[EMAIL PROTECTED]> wrote: > Thanks for that. You just gave me a good idea. I could simply replace > that crazy SQL code with an equivalent view! This way I don't have to > write any nasty code to deal with old craziness. > > In the last 10 minutes I have looked again at django_restapi code and > I have discovered an example for dealing with resources which don't > map 1:1 to Django models. There might be some interesting ideas there > too. > > cheers, > -tomek > > On Nov 14, 3:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > On Wed, 2007-11-14 at 02:36 +, Tomek wrote: > > > Wow, what a quick reply! Thanks Malcolm. > > > > I'm pretty new to Django so excuse my inability to express myself in > > > Django terms. > > > > I agree with your comments regarding taking the right approach to > > > solving the problem (how very Pythonic of you :-) > > > I tried django_restapi because it offered a quick starting point for > > > some proof of concept prototypes which I am most likely to throw away > > > anyway. > > > > When I say that I want to create a model for a custom SQL query I mean > > > exactly that. I would like to have a model class which behaves just > > > like any other model but with some exceptions: > > > > - it would be read only > > > - there is no table corresponding to the model class > > > - when retrieving records/instances of the model a custom query is > > > executed instead of whatever query Django would generate > > > automatically. > > > A model represents the Python view of a table or a view at the database > > level, not the output of a custom SQL query (unless that query is a > > view). > > > If you want customisation beyond that level, you're no longer using > > Django's ORM, although you might be able to fake it with save() methods > > on your model and stuff like that. Wouldn't be the first project I ever > > undertook with Django, though. > > > Again, Django's ORM is designed to represent database tables (actually, > > it's designed to provide persistent storage for Python objects, but it > > happens to work in reverse, too). It turns out, since database views are > > like tables, we can handle views. If you want more customisation than > > that, it rapidly gets more fiddly. Not impossible, but harder. > > > So your approach sounds wrong to me. Instead of trying to force things > > into Django's ORM easily, you'll either need to spend some time > > understanding the deep internals or write your own objects that look a > > lot like models but aren't really models. > > > Malcolm > > > -- > > Borrow from a pessimist - they don't expect it > > back.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Accessing legacy DBs with table-less models
Thanks for that. You just gave me a good idea. I could simply replace that crazy SQL code with an equivalent view! This way I don't have to write any nasty code to deal with old craziness. In the last 10 minutes I have looked again at django_restapi code and I have discovered an example for dealing with resources which don't map 1:1 to Django models. There might be some interesting ideas there too. cheers, -tomek On Nov 14, 3:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-11-14 at 02:36 +, Tomek wrote: > > Wow, what a quick reply! Thanks Malcolm. > > > I'm pretty new to Django so excuse my inability to express myself in > > Django terms. > > > I agree with your comments regarding taking the right approach to > > solving the problem (how very Pythonic of you :-) > > I tried django_restapi because it offered a quick starting point for > > some proof of concept prototypes which I am most likely to throw away > > anyway. > > > When I say that I want to create a model for a custom SQL query I mean > > exactly that. I would like to have a model class which behaves just > > like any other model but with some exceptions: > > > - it would be read only > > - there is no table corresponding to the model class > > - when retrieving records/instances of the model a custom query is > > executed instead of whatever query Django would generate > > automatically. > > A model represents the Python view of a table or a view at the database > level, not the output of a custom SQL query (unless that query is a > view). > > If you want customisation beyond that level, you're no longer using > Django's ORM, although you might be able to fake it with save() methods > on your model and stuff like that. Wouldn't be the first project I ever > undertook with Django, though. > > Again, Django's ORM is designed to represent database tables (actually, > it's designed to provide persistent storage for Python objects, but it > happens to work in reverse, too). It turns out, since database views are > like tables, we can handle views. If you want more customisation than > that, it rapidly gets more fiddly. Not impossible, but harder. > > So your approach sounds wrong to me. Instead of trying to force things > into Django's ORM easily, you'll either need to spend some time > understanding the deep internals or write your own objects that look a > lot like models but aren't really models. > > Malcolm > > -- > Borrow from a pessimist - they don't expect it > back.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Accessing legacy DBs with table-less models
On Wed, 2007-11-14 at 02:36 +, Tomek wrote: > Wow, what a quick reply! Thanks Malcolm. > > I'm pretty new to Django so excuse my inability to express myself in > Django terms. > > I agree with your comments regarding taking the right approach to > solving the problem (how very Pythonic of you :-) > I tried django_restapi because it offered a quick starting point for > some proof of concept prototypes which I am most likely to throw away > anyway. > > When I say that I want to create a model for a custom SQL query I mean > exactly that. I would like to have a model class which behaves just > like any other model but with some exceptions: > > - it would be read only > - there is no table corresponding to the model class > - when retrieving records/instances of the model a custom query is > executed instead of whatever query Django would generate > automatically. A model represents the Python view of a table or a view at the database level, not the output of a custom SQL query (unless that query is a view). If you want customisation beyond that level, you're no longer using Django's ORM, although you might be able to fake it with save() methods on your model and stuff like that. Wouldn't be the first project I ever undertook with Django, though. Again, Django's ORM is designed to represent database tables (actually, it's designed to provide persistent storage for Python objects, but it happens to work in reverse, too). It turns out, since database views are like tables, we can handle views. If you want more customisation than that, it rapidly gets more fiddly. Not impossible, but harder. So your approach sounds wrong to me. Instead of trying to force things into Django's ORM easily, you'll either need to spend some time understanding the deep internals or write your own objects that look a lot like models but aren't really models. Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Accessing legacy DBs with table-less models
Wow, what a quick reply! Thanks Malcolm. I'm pretty new to Django so excuse my inability to express myself in Django terms. I agree with your comments regarding taking the right approach to solving the problem (how very Pythonic of you :-) I tried django_restapi because it offered a quick starting point for some proof of concept prototypes which I am most likely to throw away anyway. When I say that I want to create a model for a custom SQL query I mean exactly that. I would like to have a model class which behaves just like any other model but with some exceptions: - it would be read only - there is no table corresponding to the model class - when retrieving records/instances of the model a custom query is executed instead of whatever query Django would generate automatically. Now, I don't know if any of that actually makes any sense. If there is a better way then I'm all ears. I read up on model managers but as far as I can tell a manager belongs to a model. I don't actually have a model into which I could put a custom manager which would manage my custom SQL. The custom SQL statement is rather long and ugly with multiple joins. I can't clean it up for now because that would involve cleaning up all the legacy tables used in the query and I need to avoid that for now. As for the example, there is not much that I can give you. I have inherited some old code and I need to replicate its functionality. I want to create a sort of a web service where a resource can be accessed using its URI and it's sent back to the client in either XML or JSON format. To that effect, all I can show you is the legacy SQL query which I need to execute and somehow represent its result as a QuerySet. Here it is: my $sql =<= 0 SQL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Ordering by related table problem
On Tue, 2007-11-13 at 15:19 -0700, Scott SA wrote: > Hi, > > Okay, I've been having trouble getting this to work, though it _looks_ easy. > My results have proven otherwise (django 0.96, by the way.. I'm modifying an > esisting system, not creating a new one so don't have an upgrade option right > now). > > For simplicity, heres a table overview > > Table_1 > some_field > other_field > fk_table_2 > > Table_2 > name > ... > > > The selection looks like this: > > recs= Table_1.objects.filter(some_field='xyz') > > then, I want to sort by Table_2.name so in theory, it should be: > > recs= recs.order_by('fk_table_2.name') > > ... or to approximate the online docs example: > > recs= recs.order_by('fk_table_2.name','other_field') > > This results in: > ERROR: missing FROM-clause entry for table > > Any suggestions would be greatly appreciated, It's probably bug #2076. Regards, Malcolm -- If Barbie is so popular, why do you have to buy her friends? http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Accessing legacy DBs with table-less models
Hi All, I am using "django_restapi" (http://code.google.com/p/django-rest- interface/) to quickly gain access in a RESTful way to some tables in a legacy database. I am only really interested in reading the records and sending them back in XML or JSON format. I don't need to create, update or delete any records. So far "django_restapi" works great for the simple case of accessing individual models. But as soon as I try to do anything more useful I get stuck. I have an old Perl script which accesses the same legacy database and using a custom SQL query returns a bunch of records. I would like to add a new model to my RESTful Django app which would perform the equivalent query. I don't want to do it in a view because then I will have to write all that boiler-plate code that's already in "django_restapi", such as handling errors, returning correctly formatted and serialised query sets etc. I want to write a dynamic model which doesn't correspond to any real table and plug it straight into "django_restapi". The dynamic nature of this model would come from the fact that it has to dynamically compute query sets using custom SQL statements. I don't seem to be able to find anything relevant to this problem anywhere. Surely it must be a frequently encountered problem. I would appreciate any help I can get with this. cheers, -tomek --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: initial data ignored for Form with __init__
On 11/13/07, Ken <[EMAIL PROTECTED]> wrote: > > I'm using 0.96. I define the following form > > class TForm(forms.Form): > admin = forms.ChoiceField() > x = forms.IntegerField() > > def __init__(self, data=None, **kwargs): > super(TForm, self).__init__(data, kwargs) > admins = [(a.name, a.name) for a in Admin.objects.all()] > self.fields['admin']._set_choices(admins) I think you want: Super(TForm, self).__init__(data, **kwargs) (Note the ** in front of kwrags) You're passing a dict as a second positional argument here instead of expanding that dict to keyword arguments. Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
initial data ignored for Form with __init__
I'm using 0.96. I define the following form class TForm(forms.Form): admin = forms.ChoiceField() x = forms.IntegerField() def __init__(self, data=None, **kwargs): super(TForm, self).__init__(data, kwargs) admins = [(a.name, a.name) for a in Admin.objects.all()] self.fields['admin']._set_choices(admins) Then, I instantiate it so: f = TForm(initial={'x': 23}) If I dump out the table with as_table(), the initial x value is not in the form. If I comment out the __init__ "constructor", initial is honored and I see the initial x value as specified. I define an __init__ for the purpose of setting choices on the admin ChoiceField. I can initialize x manually in the __init__ function as follows: def __init__(self, data=None, **kwargs): super(TForm, self).__init__(data, kwargs) admins = [(a.name, a.name) for a in Admin.objects.all()] self.fields['admin']._set_choices(admins) if kwargs.has_key('initial'): vinit = kwargs['initial'] if vinit.has_key('x'): self.fields['x'].initial = vinit['x'] Can someone explain why initial is ignored when I define my own __init__? Is there a prescription for defining your own __init__ when you sub-class Form and/or Model? I'm no Python expert and definitely a newb when it comes to its new-style classes, so please take it easy on me. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding QuerySets
On Tue, 2007-11-13 at 22:23 -0200, Ronaldo Z. Afonso wrote: > Hi all, > > Is it possible to join two, or more, querySets? > For example: > > q = q1 + q2 > > Being q the union of q1 and q2. It's spelt "|", so q1|q2 is meant to work. It even does work sometimes, but not always (another one of those cases of SQL generation that is easy to break when you put your back into it). It's being fixed, though. The workaround is just to write the union in Python. Use itertools.chain if you don't care about the ordering, or write your own merge-sort iterable if you want to sort the two. Or, if you've only got a few hundred results, say, just join a couple of Python lists and use list sorting. (If you really care, problems will arise if either q1 or q2 could possibly be empty, and there might be some other cases as well). Regards, Malcolm -- Plan to be spontaneous - tomorrow. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Hybrid-django server leaving connections open...
On 11/13/07, John Penix <[EMAIL PROTECTED]> wrote: > We've stuck a bit of ORM-using code from our "pure" django server into > another server that was only using django templates. We have been seeing > connections left open occasionally. I browsed the mailing list archives and > it sounds like django should be closing the connection. I'm wondering if we > aren't always tripping the code that closes the database connection since > this server is not using django to generate responses. Because it's oriented around web serving, Django closes the connection on the "request_finished" signal; if that signal is never fired, Django will not close the connection. Additionally, if something else requires database access after the signal is fired, a new connection will be opened and will not be closed. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Ordering by foreign key, class Meta
On Wed, 2007-11-14 at 00:00 +, Michael wrote: > Thanks Malcolm, this helped me on one problem I had. But, I've > another similar problem but in my case, I've multiple foreign keys, so > I'm not sure what to do about the database table name part. > > My models: > class Member(models.Model): > # first_name, last_name, etc. > class Meta: > ordering = ['first_name', 'last_name'] > > class Team(model.Model): > foreman = model.ForeignKey(Member) > operator = model.ForeignKey(Member) > # and more ForeignKey(Member) fields > class Meta: > ordering = ['foreman',] > > > In the admin interface this orders the Teams by the first_name, > last_name of the foreman, which is what I want. But in my view, when > I try to get a list of Teams using: > all_teams = Team.objects.all() > > the result isn't sorted by the foreman's [first_name, last_name]. I > don't know what it's sorted by, it's not id either. Try inspecting the SQL that Django generates for this statement (if you don't know how, see the FAQ, but db.connection.queries is the place to look) to see what's being generated. You may well be totally screwed here, in which case I'm not going to worry about it too much, since this feature is effectively broken in trunk. When it works, that's fine. But it's not robust and is very unpredictable. That's why I've rewritten it in the branch. So if the SQL generated is broken, I can't really offer much hope except to say "wait a little longer" until we get the rewrite finished. I'm targetting end of the month (Django sprint) for a rough completion date. Malcolm -- On the other hand, you have different fingers. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Feeds
On 14-Nov-07, at 4:39 AM, Miguel Galves wrote: > I dont understand your question. What do you mean by > "if you want a feed, you have to give one"... if you want a feed, you have to give an absolute url -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImportError: No module named mysql.base
Thanks Karen. I was a little wary about compiling my own copy of mysqldb, but it appears as though that's my only option in this circumstance. It's amazing how many little things I'm used to Linux doing for me... doing all that by hand on CentOS wasn't nearly as fun as I remember it being :) Thanks again! Josh On Nov 13, 5:29 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > That ticket you found suggests the real problem is not a missing mysqldb, > but a too-old version. I know nothing of CentOS or yum -- is it possible > there is a more uplevel package available for you to install? That would be > the easiest solution. If not, you could download/build/install mysqldb > yourself, as suggested in this thread: > > http://groups.google.com/group/django-users/browse_thread/thread/788d... > > One other option might be to use Django's mysql_old backend: > > http://groups.google.com/group/django-users/browse_thread/thread/98e6... > > Karen > > On 11/12/07, Josh <[EMAIL PROTECTED]> wrote: > > > > > Hi everyone! I'm trying to get one of our servers set up with Django, > > and everything seems to work fine up until I try to syncdb. > > > This is the output I get: > > > manage.py syncdb > > Traceback (most recent call last): > > File "manage.py", line 11, in ? > > execute_manager(settings) > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > __init__.py", line 277, in execute_manager > > utility.execute() > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > __init__.py", line 225, in execute > > self.fetch_command(subcommand).run_from_argv(self.argv) > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > base.py", line 70, in run_from_argv > > self.execute(*args, **options.__dict__) > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > base.py", line 83, in execute > > self.validate() > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > base.py", line 110, in validate > > num_errors = get_validation_errors(s, app) > > File "/usr/lib/python2.4/site-packages/django/core/management/ > > validation.py", line 22, in get_validation_errors > > from django.db import models, connection > > File "/usr/lib/python2.4/site-packages/django/db/__init__.py", line > > 23, in ? > > backend = __import__('%s.base' % settings.DATABASE_ENGINE, {}, {}, > > ['']) > > ImportError: No module named mysql.base > > > I did a search for "No module named mysql.base" and found > >http://code.djangoproject.com/ticket/5531but I'm not sure what I'm > > supposed to do with the information found on that page. The platform > > is CentOS 5 (I believe), and I am using rev. 6669 of Django. I > > installed MySQL-python with yum. When I run python and import django > > or import MySQLdb, I get no errors. I can communicate just fine with > > the mysql database from the interactive shell. > > > Ideas? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 403 errors handler
On Mon, 2007-11-12 at 23:29 -0800, eXt wrote: > Hi! > >I'd like to know if there is any method to handle 403 errors and > display pretty error pages for them. > >I need to handle some errors raised by Admin (raised when a user > clicks an add symbol but doesn't have the permission to add a new > object). > > In the Admin code I have found add_view function of ModelAdmin which > does: > > if not self.has_add_permission(request): > raise PermissionDenied > > Then there is django.core.handlers.base.py and: > (...) > except exceptions.PermissionDenied: > return http.HttpResponseForbidden('Permission denied h1>') > > which causes me to receive ugly untranslated "Permission denied" page. > Django has a handler for 404 is it possible to write one for 403? I would write a response middleware that inspects the response for respnsoe.status == 404 and then goes from there. The only reason 404 errors are handled slightly specially in Django is because you can raise an Http404 *exception* and that gets caught by the request handling loop. No other status codes (except for uncaught exceptions) are triggered by exceptions. In all these cases, you just return an HttpResponse class with the right status code set. Malcolm -- Everything is _not_ based on faith... take my word for it. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using Django Template Engine
On Mon, 2007-11-12 at 23:04 -0800, Brot wrote: > Hello, > > I found a code example for "Using Markup" in the django wiki: > http://code.djangoproject.com/wiki/UsingMarkup > I need a similar solution, but with the internal django template > library. Is there any solution for this requirement? > > I would like to store little html/template chunks in a database and > use them in a "normal" django template. I wouldn't use a markup- > language. The reason is, that I would like to use the template > functionality (e.g: url tag). I don't think you have explained your problem very well. Perhaps a (very short) example might help you to illustrate what's going wrong. You can store whatever you like in the database and use the model fields in a template directly, so I'm not really sure what you are asking that goes beyond that. Malcolm -- Always try to be modest and be proud of it! http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Adding QuerySets
Hi all, Is it possible to join two, or more, querySets? For example: q = q1 + q2 Being q the union of q1 and q2. Thanks. Ronaldo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Hybrid-django server leaving connections open...
Hi, We've stuck a bit of ORM-using code from our "pure" django server into another server that was only using django templates. We have been seeing connections left open occasionally. I browsed the mailing list archives and it sounds like django should be closing the connection. I'm wondering if we aren't always tripping the code that closes the database connection since this server is not using django to generate responses. Has anyone had to insert code to close connections when running a "hybrid" django setup like this? Thanks, John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Ordering by foreign key, class Meta
Thanks Malcolm, this helped me on one problem I had. But, I've another similar problem but in my case, I've multiple foreign keys, so I'm not sure what to do about the database table name part. My models: class Member(models.Model): # first_name, last_name, etc. class Meta: ordering = ['first_name', 'last_name'] class Team(model.Model): foreman = model.ForeignKey(Member) operator = model.ForeignKey(Member) # and more ForeignKey(Member) fields class Meta: ordering = ['foreman',] In the admin interface this orders the Teams by the first_name, last_name of the foreman, which is what I want. But in my view, when I try to get a list of Teams using: all_teams = Team.objects.all() the result isn't sorted by the foreman's [first_name, last_name]. I don't know what it's sorted by, it's not id either. I also tried: all_teams = Teams.objects.all().order_by('foreman')# returns the same as above, again not sorted. [1] all_teams = Teams.objects.all().order_by('appname_member.first_name') # returns error on eval, unknown column 'appname_member.first_name'. The order_by(tablename.field) worked in another model with only one reference to the foreign key (so, thanks for that tip, I missed it in the docs.) I didn't expect [1] to work, but don't know how to specify that I want the sorting based on the foreman's first_name, last_name. Any suggestions? Is this possible using order_by()? I can do it by hand if not, but it'd be cleaner and simpler if I don't have to. Many thanks. Michael On Oct 19, 7:11 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Orderingby related fields is a bit crufty at the moment and it doesn't > always work (e.g. ticket #2076). The general idea is that you have to > use the database table name(!) followed by a dot followed by the target > model field name (not the column name). This is actually documented > athttp://www.djangoproject.com/documentation/db-api/#order-by-fieldsbut > you have to read it carefully. > > The good news is that this will shortly change so that you will be able > to write person__nameLast in your case, just like you do for filters. > That code is currently in the queryset-refactor branch and will be > merged with trunk as soon as a few more slightly tricky problems with > queries are ironed out. > > By way of example and as a sneak preview, [1] and [2] (in the Meta > class) show the new syntax (that's a new test file on that branch). > > [1]http://code.djangoproject.com/browser/django/branches/queryset-refact... > > [2]http://code.djangoproject.com/browser/django/branches/queryset-refact... > > Regards, > Malcolm > > -- > Remember that you are unique. Just like everyone > else.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: KeyError, Submit Empty Field and Form Validation
This was an excellent response, and helped me immediately. Thank you. ~G~ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Feeds
Kenneth, I dont understand your question. What do you mean by "if you want a feed, you have to give one"... I'm trying to create one :-) On Nov 12, 2007 10:08 AM, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > On 12-Nov-07, at 5:32 PM, Miguel Galves wrote: > > > I'm giving a feed to index.html. > > > > Do I really need to have an absolute URL in my model? It seems to > > me that > > this need makes the app less portable. > > if you want a feed you have to give one - could you paste the your > view for index.html? > > -- > > regards > kg > http://lawgon.livejournal.com > http://nrcfosshelpline.in/web/ > > > > > > -- Miguel Galves - Engenheiro de Computação Já leu meus blogs hoje? Para geeks http://log4dev.com Pra pessoas normais http://miguelcomenta.wordpress.com "Não sabendo que era impossível, ele foi lá e fez..." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
German django forum
Hi, there is a new Forum for django help/support in german, if you speak german check it out: http://www.django-resource.de/ See you there, Jan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
sebey: a python overview you can go through in an hour or 2 is byteofpython. it's very short, and though u wont get everythng in it, it gives you a feel for what python is about. i lso find reading the django code can be very informative (after u have got some python under your belt) you can get the byteofpython from the playwithpython yahoo group On Nov 13, 10:29 pm, Raisins <[EMAIL PROTECTED]> wrote: > I love Instantd Django. I made installing and depolying django and > python a breeze also I can move from my work to home every easy just > by carrying around my thumbdrive. I highly suggest it to anyone on the > fence about either Python or django. I haven't found an easier cleaner > way to deploy them anywhere. > > On Nov 13, 2:37 pm, cjl <[EMAIL PROTECTED]> wrote: > > > Sebey: > > > You may want to check out a tutorial I am working on: > > >http://www.instantdjango.com > > > It provides a 'newbie-friendly' introduction to Django, even if you're > > not familiar with Python yet. > > > I haven't finished the second chapter yet, but I think the first > > chapter will help get you started, or at least help you figure out if > > Python and Django is right for you. > > > -CJL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django profiler to find a project weak spots
hey, i have been rather interested in the profiling of my django apps (i'm a not-very-newbie) will look at it and provide useful (i sincerely hope) feedback On Nov 12, 6:23 pm, Dima Dogadaylo <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote a Django pofiler that can be used to find weak performance > spots in Django projects, i.e. to find how many SQL-queries are used > per page, how heavy html-pages are, etc. > > The source code of the script and examples of usage are available > here:http://www.mysoftparade.com/blog/django-profile-sql-performance/ > > I wrote it because realised that sometimes it's easy to eventually > miss select_related() for an QuerySet and end with dozens of SQL > queries per page. > > --http://www.mysoftparade.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Ordering by related table problem
Hi, Okay, I've been having trouble getting this to work, though it _looks_ easy. My results have proven otherwise (django 0.96, by the way.. I'm modifying an esisting system, not creating a new one so don't have an upgrade option right now). For simplicity, heres a table overview Table_1 some_field other_field fk_table_2 Table_2 name ... The selection looks like this: recs= Table_1.objects.filter(some_field='xyz') then, I want to sort by Table_2.name so in theory, it should be: recs= recs.order_by('fk_table_2.name') ... or to approximate the online docs example: recs= recs.order_by('fk_table_2.name','other_field') This results in: ERROR: missing FROM-clause entry for table Any suggestions would be greatly appreciated, Thanks, Scott --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: [i18n] Questions on how it works...
Nicolas Steinmetz a écrit : > Any idea about this ? my fault, I forgot the locale middleware and I set a "conf/locale" structure within my app whereas it should be just "locale". This way, I do not need blocktrans any longer. So it's solved... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django Evolution!
On Nov 13, 4:08 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > Announcing Django Evolution! > > > http://code.google.com/p/django-evolution/ Good job! I hope the best for the project. -- Nicolás Miyasato --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
I love Instantd Django. I made installing and depolying django and python a breeze also I can move from my work to home every easy just by carrying around my thumbdrive. I highly suggest it to anyone on the fence about either Python or django. I haven't found an easier cleaner way to deploy them anywhere. On Nov 13, 2:37 pm, cjl <[EMAIL PROTECTED]> wrote: > Sebey: > > You may want to check out a tutorial I am working on: > > http://www.instantdjango.com > > It provides a 'newbie-friendly' introduction to Django, even if you're > not familiar with Python yet. > > I haven't finished the second chapter yet, but I think the first > chapter will help get you started, or at least help you figure out if > Python and Django is right for you. > > -CJL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Exposing Django to a Java Client
Dear Django Users, Some while ago in May Brian Corrigan mentioned the following solution to exposing Django to an outside application to me. On May 24, 12:32 pm, brian corrigan <[EMAIL PROTECTED]> wrote: > We have used Django along side Java applications by using Jython and > HTTP requests from the Java to Django and vice versa. So if your > colleagues need more "serious" application features there are ways to > plug them into Django (although I'm sure some people might not agree > with the method) :) Brian, could you describe in a few words how that works? I imagine the following: You pack every request int a url and post parameters. That's easy, as long as it is well documented. Now the result of such an operation may be of any content type. As long as you you can control the format of the response, you can easily create some protocol that your application understands. Now unfortunately that is not true for the whole admin branch of the urls. That's sort of sad, because you would have to rewrite a lot of those CRUD operations in some way. I imagine that maybe some sort of middleware could take care of catching the reponse and converting it into the corresponding protocol? as always: thanks for your answers, Oliver --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Missing Documentation cross-reference to shortcuts ?
On 11/13/07, jfine <[EMAIL PROTECTED]> wrote: > I've added this problem to that ticket. Please don't do that: we generally operate on a principle of one ticket per issue, and one issue per ticket. Piling a bunch of different things into one ticket just makes it impossible to sort them out and deal with. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Simple save() override not working
I should clarify: it's not failing, it just doesn't seem to be calling the custom save method... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Simple save() override not working
I know, I've seen a million posts about this, but they all seem to relate to m2m fields. While I do have an m2m field in the table (blog entry <-> tags), it's one of the simple fields I'm having trouble with. def save(self): > import datetime > if not self.publish_date and self.state == 2: > self.publish_date = datetime.date.today() > return super(BlogEntry, self).save() > This override works when in the shell, but not through the admin interface. I am just not understanding why it would fail on this simple field. Thanks, Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Missing Documentation cross-reference to shortcuts ?
glopglop wrote: > A lookup on google shows that the page > http://www.djangoproject.com/documentation/shortcuts/ > isn't linked from anywhere on the documentation (and the site), and I > had to search it to find it. > > (see > http://www.google.com/search?hl=fr=1=link%3Ahttp%3A%2F%2Fwww.djangoproject.com%2Fdocumentation%2Fshortcuts%2F=Rechercher=) > ) > > > I don't know where it belongs to, but at least we could make it > available from the tutorial (where it's used first ?) > > I dont know how to check for orphans, but this may not be the only > page : maybe it could be automated as a test ? I had a similar problem with static_files - see http://code.djangoproject.com/ticket/5916 I've added this problem to that ticket. -- Jonathan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
Sebey: You may want to check out a tutorial I am working on: http://www.instantdjango.com It provides a 'newbie-friendly' introduction to Django, even if you're not familiar with Python yet. I haven't finished the second chapter yet, but I think the first chapter will help get you started, or at least help you figure out if Python and Django is right for you. -CJL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django Evolution!
On Nov 13, 8:08 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > Announcing Django Evolution! > > > http://code.google.com/p/django-evolution/ Good job, Russ and Ben! The project gets the smiley seal of approval :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Missing Documentation cross-reference to shortcuts ?
A lookup on google shows that the page http://www.djangoproject.com/documentation/shortcuts/ isn't linked from anywhere on the documentation (and the site), and I had to search it to find it. (see http://www.google.com/search?hl=fr=1=link%3Ahttp%3A%2F%2Fwww.djangoproject.com%2Fdocumentation%2Fshortcuts%2F=Rechercher=) ) I don't know where it belongs to, but at least we could make it available from the tutorial (where it's used first ?) I dont know how to check for orphans, but this may not be the only page : maybe it could be automated as a test ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Dynamic ImageField
No worries, I'm just trying to make sense of all the options. : ) Nonetheless, is there any documentation on what I can get out of each field in the save_file method, or examples of how I can access the filename and directory where the file is being saved within this method? Marcin's first example works great for me when I check/create the directory structure before the save and perform resizing after the save, but I'm having trouble putting these actions into the overridden method (that whole DRY thing...). Also, I tried using ideas from the AutoImageField in Marcin's second example, but my image resizing seemed to be getting the wrong file_path and failing silently. For some examples, I wrote a get_upload_to method for dynamic uploading as such: def get_upload_to(self, field_attname): return 'img/user/%d/%s' % (random.randint(10, 99), self.id) and I tried getting the filename within the save_file method as such: file_name = os.path.join(settings.MEDIA_ROOT, getattr(new_object, self.attname)) Thanks for any help! On Nov 13, 11:30 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Nov 13, 2007 11:03 AM, Peter <[EMAIL PROTECTED]> wrote: > > > Also, is there a big reason to override this vs the _save_FIELD_file > > method as shown in this example: > >http://gulopine.gamemusic.org/2007/11/customizing-filenames-without-p... > > I'll admit, that post was thrown together in a hurry, in response to > several questions that I kept answering with "it'll be better when my > filestorage work makes it into trunk". I felt it was better to have > something out there in the meantime, and I didn't research what > solutions others had come up with. > > In my opinion, the FileField (or ImageField) subclass approach linked > by Marcin is much simpler and cleaner than my own, and requires much > less ugly hackery. > > That said, this should all get better when my filestorage work makes > it into trunk. ;) > > -Gul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Dynamic ImageField
On Nov 13, 2007 11:03 AM, Peter <[EMAIL PROTECTED]> wrote: > Also, is there a big reason to override this vs the _save_FIELD_file > method as shown in this example: > http://gulopine.gamemusic.org/2007/11/customizing-filenames-without-patching.html I'll admit, that post was thrown together in a hurry, in response to several questions that I kept answering with "it'll be better when my filestorage work makes it into trunk". I felt it was better to have something out there in the meantime, and I didn't research what solutions others had come up with. In my opinion, the FileField (or ImageField) subclass approach linked by Marcin is much simpler and cleaner than my own, and requires much less ugly hackery. That said, this should all get better when my filestorage work makes it into trunk. ;) -Gul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: XMLField validation within a model
On 11/12/07, jim <[EMAIL PROTECTED]> wrote: > 2. Do I need to call the validation explicitly? Validation will be done automatically by forms generated from this model (e.g., the admin). It will not be done automatically by a raw save() of an object (since save() assumes you've validated the data in advance) or by forms you write yourself, unless you explicitly add the correct validation. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: XMLField validation within a model
OK.. i got the first part.. NULL and '' are different from the db perspective: sqlite> CREATE TABLE t2( a TEXT NOT NULL); sqlite> insert into t2 values(''); sqlite> select * from t2; sqlite> insert into t2 values('ttt'); sqlite> select * from t2; ttt sqlite> insert into t2 values(NULL); SQL error: t2.a may not be NULL jim On Nov 12, 6:00 pm, jim <[EMAIL PROTECTED]> wrote: > How does one validate the xml being inserted into a table? I have the > following model: > > class FlightReservation(models.Model): > """ > """ > departing_itin = models.XMLField(ITIN_RELAXNG_SCHEMA_PATH) > returning_itin = models.XMLField(ITIN_RELAXNG_SCHEMA_PATH) >... > > I have the JING_PATH set in my settings.py > > However, when I inserted a row, : > > 1. It does not complain even if the above two fields are blank. (I was > expecting it to complain) > 2. Do I need to call the validation explicitly? > > thanks > Jim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Dynamic ImageField
Thanks for posting the example links. Is there any documentation on "save_file" and what each field actually is for this method? I was using some random numbers in the folder creation and wanted to make sure the folders exist before I save the file. Also, is there a big reason to override this vs the _save_FIELD_file method as shown in this example: http://gulopine.gamemusic.org/2007/11/customizing-filenames-without-patching.html Regards, Peter On Nov 8, 11:26 pm, cschand <[EMAIL PROTECTED]> wrote: > Hi Marcin >It's working... Thankyou very much :) > > cschand > > On Nov 8, 6:46 pm, Marcin Mierzejewski <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > Yes, you > > can:http://scottbarnham.com/blog/2007/07/31/uploading-images-to-a-dynamic... > > > Regards, > > Marcin > > > On Nov 8, 2:08 pm, cschand <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > Can we make dynamic ImageFields?uploadfile to /media/avatar/ > > > username or userid/- Hide quoted text - > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
> well I have a book on php,apache and mysql so are there? any > differences between mysql and postgreSQL for django > (proforanmce features etc.) They're becoming closer in terms of their features. A couple observations in my experience: - MySQL tends to be faster and have some nice "my site mostly reads data and doesn't have so much writing" optimizations (mostly through table-types) - the prevaling intarweb "knowledge" says that MySQL is faster under light load, but doesn't scale as well as PostgreSQL (PG) under heavy transactional load (again, load for reading vs. load for writing may be important here). - PG supports much more ANSI SQL. MySQL is coming closer, but it's still missing some things that I reach for regularly. And some of MySQL's table-types don't support all features (such as transactions) though this allows for some of the optimizations mentioned above. Many hosting services have older versions of MySQL which drive me absolutely bonkers for its lack of certain features (views, sub-queries, etc) - I find MySQL easier to install and administer. PG has a much more "enterprisy" feel to it with the management overhead that goes along with it. This may be the reason more hosting services tend to offer MySQL. - MySQL has full-text search (FTS). The most recent release of PG now has finally integrated their plugin FTS into the default deployment which should close this gap. - MySQL used to have the edge for Win32 deployment, but PG now works on NT-based Win32 (Win2k and WinXP...likely Vista too) - both have their own replication/load-balancing schemes that can be used Fortunately, since they're both free, you can download both and take 'em for a test drive to see which you prefer. Django's ORM also abstracts out many of the differences between them, so it's not as significant unless you're reaching into an extra() call to use some server-specific code. Where it matters, I try to test with Django's "big 3"...PG, MySQL, and sqlite just to make sure it works on all three, but for my quick/development tests, I tend to prefer sqlite for its in-memory DB. Just my thoughts on factors. Weigh against what you need and decide accordingly. -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
well I have a book on php,apache and mysql so are there? any differences between mysql and postgreSQL for django (proforanmce features etc.) On Nov 13, 1:36 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 13-Nov-07, at 6:55 PM, sebey wrote: > > > has anyone tryed this I guess you have ken but is a good and quick way > > to learn django and python and sql (mysql is it or again silly?) this > > is really intersting I loved to learn more > > for me - while learning django, I always had Python in a Nutshell, > and the wrox book on postgresql open on my desk for reference and > practice. I now have diveintopython and the interactive postgresql > manual open on my laptop while I do django on my desktop. Am learning > all the time. (that is when I have time to code, which is not very > often). Incidently, if you want to learn sql, postgresql makes far > more sense than mysql. > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How put admin in deployment
On Tue, 2007-11-13 at 14:56 +, mamcxyz wrote: > In test mode, I can acces the "admin" site, but when I deploy the site > I can't do it. > > Before, I setup another fastcgi process to it, but I think that is > overkill (I must run this under a VPS). Any trick to put admin under > the regular fastcgi process? I run my blog under fastcgi on dreamhost with admin without any special tricks. Why can't you access /admin/? What is the error? -- http://www.mysoftparade.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How put admin in deployment
In test mode, I can acces the "admin" site, but when I deploy the site I can't do it. Before, I setup another fastcgi process to it, but I think that is overkill (I must run this under a VPS). Any trick to put admin under the regular fastcgi process? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Circular dependencies problem
Ok, I will do like this. Thanks On Nov 13, 12:03 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Am Dienstag, 13. November 2007 12:00 schrieb [EMAIL PROTECTED]: > > > But then this N:M field would only be used some times... it doesn't > > seam as a good way to do this. > > > I could always create a big app with all the models but I would like > > to be able have apps for each main class so my views.py is cleanly > > separated. > > 'manage.py startapp' creates 'views.py'. But for every application > that has more then 200 lines of code, I would use create a directory > called 'views' and but views there. Example > > views/__init__.py (Empty. File is needed) > user.py > mm.py > discussions.py > > HTH, > Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How much memory does a django instance need was Does Hostmonster support Django?
On 13-Nov-07, at 7:10 PM, Forest Bond wrote: > I guess maybe you could try to reduce your imports. heavy use of PIL and reportlab is there even though there are at the most three users at a time. I remember running 4 sites on pre .91 django on zettai and keeping well within the 64 mb limit. Sigh. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
No need for FileField
Hi, I have model Object and I want to store 0..N files for each. To keep the files together the files should be saved under a directory like this: .../objects/ID/ FileField does not support this. Now I found a simple solution, that I want to share. The solution is simple: I don't need FileField. It is redundant to store the file names in the database. An other point: there is a break in the transaction flow (filesystem can't rollback like a database). I just upload to .../objects/ID/ and there is a method of the model Object which returns the list of all uploaded files. This just calls os.listdir(). Here is the code, which uses urlquote() to convert the unicode filenames. # Python import os import urllib # Django from django.conf import settings from django.utils.http import urlquote class Attachment(object): def __init__(self, obj, filename=None, fs_name=None): self.obj=obj if filename: assert not fs_name self.filename=filename else: assert not filename self.filename=urllib.unquote(fs_name) assert self.filename.find("/")==-1, self.filename def __cmp__(self, other): assert isinstance(other, Attachment), other return cmp(self.fs_name, other.fs_name) def __repr__(self): return '<%s.%s %s>' % (self.__class__.__module__, self.__class__.__name__, self.fs_name) def get_directory(self): return os.path.join(settings.ATTACHMENT_UPLOAD_TO, str(self.obj.id)) directory=property(get_directory) def get_fs_name(self): fs_name=urlquote(self.filename) return os.path.join(self.directory, fs_name) fs_name=property(get_fs_name) def get_absolute_url(self): return urlquote("%sobject/%d/attachment/%s" % ( settings.SCRIPTNAME, self.obj.id, self.filename)) def delete(self): os.unlink(self.fs_name) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How much memory does a django instance need was Does Hostmonster support Django?
Hi, On Tue, Nov 13, 2007 at 07:41:17AM +0530, Kenneth Gonsalves wrote: > On 12-Nov-07, at 6:25 PM, Forest Bond wrote: > > Maybe you need to decrease your ServerLimit? Each forked server process > > leads to increased memory usage. For a really low volume site, you can get > > away with ServerLimit 1, although I'd be sure to host your media files in a > > different instance (webfaction has docs for doing this somewhere). > > did that > > > Make sure that Django and Python debug settings are disabled, too > > (apache2.conf PythonDebug, settings.py DEBUG). > > did all this - I am still getting around 35 MB per instance. And it > is not the fault of webfaction. The same site on my local machine > gives the same figure. This on the latest svn in both cases. The last > time I looked at these figures, it was around 12-15mb an instance. > Any other clues? This is probably normal memory usage. This is not a problem, as long as it doesn't grow much beyond that, right? I have two small sites that share a lot of code running on a webfaction account. With ServerLimit 1 and media hosted on the main apache instance (which doesn't count against me for RAM usage), I stay pretty constant at 32-35MB. I don't think it would be possible to get much lower than that. Libraries have to get loaded somewhere, afterall. I guess maybe you could try to reduce your imports. -Forest -- Forest Bond http://www.alittletooquiet.net signature.asc Description: Digital signature
Re: learning django and python
On 13-Nov-07, at 6:55 PM, sebey wrote: > has anyone tryed this I guess you have ken but is a good and quick way > to learn django and python and sql (mysql is it or again silly?) this > is really intersting I loved to learn more for me - while learning django, I always had Python in a Nutshell, and the wrox book on postgresql open on my desk for reference and practice. I now have diveintopython and the interactive postgresql manual open on my laptop while I do django on my desktop. Am learning all the time. (that is when I have time to code, which is not very often). Incidently, if you want to learn sql, postgresql makes far more sense than mysql. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
binding data with imageupload in newforms
hi, I have a form to edit some data which is spread over two models. In this case, I have to retrieve the existing data from the models, bind that to the form and open the form. One of the fields happens to be an image field. The newforms documentations says this: file_data = {'mugshot': {'filename':'face.jpg' ... 'content': }} what is this that has to be put into the 'content'? If I leave it blank, I get a validation error as no file uploaded. I tried get_foo_url(), but that doesnt work either. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django authentification application with openid using django auth contrib
Version 0.2 : - include new patch for django_openid 2.0 - clean code. New username_control decorator - fix yadis import - urls localization You could downlad it here : http://django-authopenid.googlecode.com/files/django_authopenid-0.2.tar.gz Documentation : http://code.google.com/p/django-authopenid/wiki/README enjoy, - benoît --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Time zone problem
Hi, In my settings.py I have TIME_ZONE set to 'Europe/Warsaw'. When printing the settings.TIME_ZONE and os.environ['TZ'] in my views.py I am getting strange results. TIME_ZONE always returns 'Europe/Warsaw', but os.environ['TZ'] returns one of 'Europe/Warsaw' and 'America/Chicago'. It's not regular, and does not depend on how many times I refresh the page. There are many DateTime fields in my models which makes the TZ problem very confusing. Using Apache 2.0.59 & mod_python 3.1.4 (python 2.4.2) on FreeBSD 6.2 RELEASE-p2 Thanks, -- Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
On 13-Nov-07, at 6:04 PM, sebey wrote: > is that a joke or for real? sorry don't get it for real - you cant learn python or sql through django - so make a systematic plan of learning the two *while* you are learning django. Meaning that, dont first go and learn python and *then* learn django -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
is that a joke or for real? sorry don't get it On Nov 13, 1:47 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 12-Nov-07, at 9:02 PM, sebey wrote: > > > good thanks for can I learn python with django > > while learningdjango(): > python.learn() > sql.learn() > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: learning django and python
is that a joke or for real? sorry don't get it On Nov 13, 1:47 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 12-Nov-07, at 9:02 PM, sebey wrote: > > > good thanks for can I learn python with django > > while learningdjango(): > python.learn() > sql.learn() > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ImportError: No module named mysql.base
That ticket you found suggests the real problem is not a missing mysqldb, but a too-old version. I know nothing of CentOS or yum -- is it possible there is a more uplevel package available for you to install? That would be the easiest solution. If not, you could download/build/install mysqldb yourself, as suggested in this thread: http://groups.google.com/group/django-users/browse_thread/thread/788d7b4683388ebf/5a3a11b2540768ae One other option might be to use Django's mysql_old backend: http://groups.google.com/group/django-users/browse_thread/thread/98e68571ef8ea3a2/8bd50c74f9f31091 Karen On 11/12/07, Josh <[EMAIL PROTECTED]> wrote: > > > Hi everyone! I'm trying to get one of our servers set up with Django, > and everything seems to work fine up until I try to syncdb. > > This is the output I get: > > manage.py syncdb > Traceback (most recent call last): > File "manage.py", line 11, in ? > execute_manager(settings) > File "/usr/lib/python2.4/site-packages/django/core/management/ > __init__.py", line 277, in execute_manager > utility.execute() > File "/usr/lib/python2.4/site-packages/django/core/management/ > __init__.py", line 225, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File "/usr/lib/python2.4/site-packages/django/core/management/ > base.py", line 70, in run_from_argv > self.execute(*args, **options.__dict__) > File "/usr/lib/python2.4/site-packages/django/core/management/ > base.py", line 83, in execute > self.validate() > File "/usr/lib/python2.4/site-packages/django/core/management/ > base.py", line 110, in validate > num_errors = get_validation_errors(s, app) > File "/usr/lib/python2.4/site-packages/django/core/management/ > validation.py", line 22, in get_validation_errors > from django.db import models, connection > File "/usr/lib/python2.4/site-packages/django/db/__init__.py", line > 23, in ? > backend = __import__('%s.base' % settings.DATABASE_ENGINE, {}, {}, > ['']) > ImportError: No module named mysql.base > > I did a search for "No module named mysql.base" and found > http://code.djangoproject.com/ticket/5531 but I'm not sure what I'm > supposed to do with the information found on that page. The platform > is CentOS 5 (I believe), and I am using rev. 6669 of Django. I > installed MySQL-python with yum. When I run python and import django > or import MySQLdb, I get no errors. I can communicate just fine with > the mysql database from the interactive shell. > > Ideas? Thanks! > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Circular dependencies problem
Am Dienstag, 13. November 2007 12:00 schrieb [EMAIL PROTECTED]: > But then this N:M field would only be used some times... it doesn't > seam as a good way to do this. > > I could always create a big app with all the models but I would like > to be able have apps for each main class so my views.py is cleanly > separated. 'manage.py startapp' creates 'views.py'. But for every application that has more then 200 lines of code, I would use create a directory called 'views' and but views there. Example views/__init__.py (Empty. File is needed) user.py mm.py discussions.py HTH, Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Circular dependencies problem
But then this N:M field would only be used some times... it doesn't seam as a good way to do this. I could always create a big app with all the models but I would like to be able have apps for each main class so my views.py is cleanly separated. Any more ideas? please. Regards, Luís On Nov 13, 8:25 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Am Dienstag, 13. November 2007 09:08 schrieb Thomas Guettler: > > > > > Am Dienstag, 13. November 2007 03:35 schrieb [EMAIL PROTECTED]: > > > Hello, > > > > i'm new to django so excuse if this is a really stupid question. > > > > I have these three apps with are inter dependable, how can I make this > > > work in Django maintaining all of this modules separate. > > > Do you really need three applications (user, multimedia, discussion)? > > > Maybe you can build one application with one model. You can put the > > source into different files: > > > #models.py: > > from models_user import User > > from models_mm import Multimedia > > from models_discussion import Discussion > > Sorry, even this won't help you. Maybe you could > single out the User class if you create a N:M Field > on Discussion, and write a property to access > the discussion object like a foreign key. > > class User(...): > def get_discussion(self): > from ... import Discussion > return discussion=Discussion.get(user=self) > discussion=property(get_discussion) > > Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
[i18n] Questions on how it works...
Hello, I read the i18n documentation but I'm not really at ease with it. If I understood well : * To translate models, I need to use gettext_lazy or ugettext_lazy * In template : ** I need to set {% load i18n %} at the top of my template (should it be only in base.html or to any template part I call) ** "blocktrans" must be within a loop or if statement so that it works. There is no way to say that my template must be globally translated ? It's a little bit strange to set trans or blocktrans tag everywhere I need a translation... (I know that some element may not be translated but...) So far, I start generated my po files but does not manage to get some values translated. I should have missed something but do not see what :-( For ex, I tried with some values I get from CHOICES in my models : {% blocktrans %}{{ profile.get_civility_display }}{% endblocktrans %} I got : KeyError at /cv/John-Doe/ u'profile.get_civility_display' What sounds me strange is that I use gettext_lazy and no longer ugettext_lazy (maybe I generated po file when I used ugettext instead of _lazy). Any idea about this ? Nicolas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Verticity
http://www.verticity.com On Nov 13, 2:26 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Verticity is currently hiring software enginers and programmers > specialy dot net developers in thier regional office Karachi. > little about verticity inc: > > VertiCity was founded on the premise that through the medium of the > internet geographic barriers could be broken down and a truly global > city, where IT services could be provided for clients throughout the > world, would be created. Our REMS (Remote Employee Management System) > allows our clients to take advantage of a pool of highly talented and > cost effective IT professionals. Our services enable IT Application > Development process to become efficient and cost effective. Not only > have our services reduced our clients IT costs by up to 80%, but by > providing them highly qualified professionals, VertiCity has also > saved them immeasurable hours of search time and have made offshore > outsourcing seamless and without borders. > > Verticity, Inc is a privately held and funded conglomeration of web/ > software technologies and services -first started in 2001. We are > rooted in product and have produced innovations in distinct and > growing B2B spaces. Many of our professionals are experts in their > fields and by tapping into our resources, clients are able to take > advantage of Verticity's outsourcing model which has proved to be > highly effective and cost-saving. > > At Verticity, we help clients innovate their businesses to achieve > extraordinary results from their customer relationships, business > operations, and technology. Verticity's promise to our clients: to do > whatever it takes to deliver the right business results, on time and > on budget. We have consistently delivered on this promise, achieving > success for our clients. Not happy? > > Clients choose Verticity for our commitment to their success, our > dedication to delivering our promise, and the straightforward and > collaborative way we work with them. Not many companies give their > clients complete control over their offshore team. Verticity prides > itself on that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Verticity
Verticity is currently hiring software enginers and programmers specialy dot net developers in thier regional office Karachi. little about verticity inc: VertiCity was founded on the premise that through the medium of the internet geographic barriers could be broken down and a truly global city, where IT services could be provided for clients throughout the world, would be created. Our REMS (Remote Employee Management System) allows our clients to take advantage of a pool of highly talented and cost effective IT professionals. Our services enable IT Application Development process to become efficient and cost effective. Not only have our services reduced our clients IT costs by up to 80%, but by providing them highly qualified professionals, VertiCity has also saved them immeasurable hours of search time and have made offshore outsourcing seamless and without borders. Verticity, Inc is a privately held and funded conglomeration of web/ software technologies and services -first started in 2001. We are rooted in product and have produced innovations in distinct and growing B2B spaces. Many of our professionals are experts in their fields and by tapping into our resources, clients are able to take advantage of Verticity's outsourcing model which has proved to be highly effective and cost-saving. At Verticity, we help clients innovate their businesses to achieve extraordinary results from their customer relationships, business operations, and technology. Verticity's promise to our clients: to do whatever it takes to deliver the right business results, on time and on budget. We have consistently delivered on this promise, achieving success for our clients. Not happy? Clients choose Verticity for our commitment to their success, our dedication to delivering our promise, and the straightforward and collaborative way we work with them. Not many companies give their clients complete control over their offshore team. Verticity prides itself on that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: CSS problem
Thank you Lazlo, today your my hero! David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: max_length / Upgrade error in tutorial part 1 (polls)
Thanks for clarifying that Matt - I thought I was going crazy. On Nov 13, 11:01 am, Matt McClanahan <[EMAIL PROTECTED]> wrote: > On Nov 13, 12:38 am, [EMAIL PROTECTED] wrote: > > > I am stepping through Dajngo Tutorial (Part 1, to create polls > > application) and get this error. > > > Unexpected keyword argument 'max length' when running "manage syncdb" > > > If I change it to "maxlength" it works: > > This is the proper solution when using the latest Django release. A > version of Django has not yet been released which uses max_length. > > > Without using the documentation from previous version - what can I do > > to fix this? > > The documentation found athttp://www.djangoproject.com/documentation/0.96/ > is the right version to refer to when using the latest release 0.96.1. > > Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: max_length / Upgrade error in tutorial part 1 (polls)
On Nov 13, 12:38 am, [EMAIL PROTECTED] wrote: > I am stepping through Dajngo Tutorial (Part 1, to create polls > application) and get this error. > > Unexpected keyword argument 'max length' when running "manage syncdb" > > If I change it to "maxlength" it works: This is the proper solution when using the latest Django release. A version of Django has not yet been released which uses max_length. > Without using the documentation from previous version - what can I do > to fix this? The documentation found at http://www.djangoproject.com/documentation/0.96/ is the right version to refer to when using the latest release 0.96.1. Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
max_length / Upgrade error in tutorial part 1 (polls)
I am stepping through Dajngo Tutorial (Part 1, to create polls application) and get this error. Unexpected keyword argument 'max length' when running "manage syncdb" If I change it to "maxlength" it works: I did see note in tutorial regarding old version and I was using an earlier version (0.96) - I then loaded the latest version by: - delete django directory from "site package" - download 0.96.1 files (tar.gz) - run python setup.py install Still get the same error... Without using the documentation from previous version - what can I do to fix this? I believe I am running latest version. Import django Django.VERSION I see latest version (0.96.1) Any other ideas, short of going back to previous version documents? (which doesn't *really* solve the problem) Many Thanks Liam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Circular dependencies problem
Am Dienstag, 13. November 2007 09:08 schrieb Thomas Guettler: > Am Dienstag, 13. November 2007 03:35 schrieb [EMAIL PROTECTED]: > > Hello, > > > > i'm new to django so excuse if this is a really stupid question. > > > > I have these three apps with are inter dependable, how can I make this > > work in Django maintaining all of this modules separate. > > Do you really need three applications (user, multimedia, discussion)? > > Maybe you can build one application with one model. You can put the > source into different files: > > #models.py: > from models_user import User > from models_mm import Multimedia > from models_discussion import Discussion > Sorry, even this won't help you. Maybe you could single out the User class if you create a N:M Field on Discussion, and write a property to access the discussion object like a foreign key. class User(...): def get_discussion(self): from ... import Discussion return discussion=Discussion.get(user=self) discussion=property(get_discussion) Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Circular dependencies problem
Am Dienstag, 13. November 2007 03:35 schrieb [EMAIL PROTECTED]: > Hello, > > i'm new to django so excuse if this is a really stupid question. > > I have these three apps with are inter dependable, how can I make this > work in Django maintaining all of this modules separate. Do you really need three applications (user, multimedia, discussion)? Maybe you can build one application with one model. You can put the source into different files: #models.py: from models_user import User from models_mm import Multimedia from models_discussion import Discussion Since all depend on each other, I would not call each an application. All three together build an application. Thomas > > discussion: > from osite.user.models import User > from osite.multimedia.models import Multimedia > class Discussion(models.Model): > author = models.ForeignKey(User) > ... > > class Comment(models.Model): > author = models.ForeignKey(User) > multimedia = models.ForeignKey(Multimedia) > > > user: > from osite.discussion.models import Discussion > class User(models.Model): > discussion_on_profile = models.ForeignKey(Discussion) > -- > > multimedia: > from osite.user.models import User > from osite.discussion.models import Discussion > > > class Multimedia(models.Model): > author = models.ForeignKey(User) > discussion = models.ForeignKey(Discussion) > ... > class Album(models.Model): > author = models.ForeignKey(User) > ... > > With best regards, > > Luis > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---