Re: Multiple model inheritance

2013-01-05 Thread Peter of the Norse
I’m not sure that’s possible. Even abstract Models do magic in the background. Specifically there's the _meta class attribute that gets inherited. If you were to try it, only one of the _metas would be included. On Dec 31, 2012, at 6:12 AM, Mattias Linnap wrote: > Hi all, > > I would like to

Re: Help implement CSS into Django!!!!

2013-01-05 Thread Nikolas Stevenson-Molnar
In a production environment, yes your static files (incl CSS) will need to be served outside of Django (can be on the same server, but it's generally recommended to use a separate serve or CDN). On your local development server (where you're using the runserver command), you can use the built-in

RE: How to add an element of derived data to a Django model?

2013-01-05 Thread Babatunde Akinyanmi
I apologize for adding noise to the thread. I didn't read this thread before replying. Nkryptic is correct. Sent from my Windows Phone -Original Message- From: nkryptic Sent: 1/5/2013 11:59 PM To: django-users@googlegroups.com Cc: Saqib Ali Subject: Re: How to add an element of derived

RE: How to add an element of derived data to a Django model?

2013-01-05 Thread Babatunde Akinyanmi
Hi. Have a look at the django tutorial and take note of how the Poll object is_published method is added to the admin interface (I think it's the part 2 of the tutorial) Sent from my Windows Phone -- From: Saqib Ali Sent: 1/5/2013 10:25 PM To:

Help implement CSS into Django!!!!

2013-01-05 Thread Czaro
I've been trying to get my CSS to work with my python powered site forever but I have no luck. I read the djangobook and a massive load of other resources but they all say a different thing and nothing worked for me. I would appreciate a few helpful steps on how to get my CSS to work. Some

InMemoryUploadedFile no `encoding` Attribute

2013-01-05 Thread Braden Walters
I've had a bit of an issue with InMemoryUploadedFile instances that come in request.FILES to a view. I passed one of them to another constructor to initialise it, and then I tried to access the `encoding` attribute (which appears in the help() for the class). I followed the class hierarchy and

Re: Get objects sorted by time of last comment

2013-01-05 Thread akaariai
On 5 tammi, 06:41, Vibhu Rishi wrote: > Hi Anssi, > > Thanks for the comment. > > I was thinking that if I have to do the last comment hackery for all the > objects would it also work if I > * add a last_comment_time field to the models I use with comments. > * modify the

Re: dynamically chaining q objects with &/|

2013-01-05 Thread Peter of the Norse
I’ve ben going over your code and it looks like everything is wrong. Reduce is unnecessary here. filter_keys is clobbered each time through the formset loop. You're double adding terms to the final_query. How I would do it: SearchFormSet = formset_factory(F.SearchForm,

Re: Modelforms and class based views

2013-01-05 Thread nkryptic
Multiple forms with generic views are a problem - you can't really use the form processing ones as they expect a single form. But, say you want a view that has a Pet form and and Owner form class Owner(models.Model): name = models.CharField(max_length=100) email =

Re: how to create a databse

2013-01-05 Thread Subodh Nijsure
On Ubuntu following works - Run: sudo dpkg-reconfigure mysql-server-5.1 Now this will allow you set password for 'root' user. Les assume you want to create user joe and create database joedb , want to assign password 'joepassword' Now login to the mysql as: mysql -u root

Re: How to add an element of derived data to a Django model?

2013-01-05 Thread nkryptic
Don't add it to the fields for the ModelAdmin, add it to the 'list_display': class myModelAdmin(admin.ModelAdmin): list_display = ('a', 'b', 'c') On Saturday, January 5, 2013 4:25:11 PM UTC-5, Saqib Ali wrote: > > > I tried Aaron's method. Django validated the model. > However, when I added

Re: How to add an element of derived data to a Django model?

2013-01-05 Thread Saqib Ali
I tried Aaron's method. Django validated the model. However, when I added property "c" to the administration interface's list of fields, It threw an error: 'myModelAdmin.fields' refers to field 'status' that is missing from the form. Request Method:GETRequest URL:http://VVV/admin/Django

Can't set static file directory.

2013-01-05 Thread Mārtiņš Jakubovičs
Hello. I try a lot of things and can't understand, why not working STATIC_ROOT and MEDIA_ROOT in settings.py. I want, that all my media and static folders is in different place that python files, so I set media, static and templates to different place. Templates TEMPLATE_DIRS works well, bet

Re: Django app custom settings testing

2013-01-05 Thread nkryptic
I think you're finding out that there are many different approaches to reusable app configuration, but all have their trade-offs. I think there is also some middle ground between always checking for the value and loading it initially, and that's to be able to reload. In your app's settings

Re: How to add an element of derived data to a Django model?

2013-01-05 Thread Aaron C. de Bruyn
I think you're looking for something like this on a model: @property def is_bigger(self): return self.a > self.b -A On Sat, Jan 5, 2013 at 9:16 AM, Babatunde Akinyanmi wrote: > I think you can write a function that returns a > b and then make it a > getter method

Re: how to create a databse

2013-01-05 Thread Francis Kayiwa
On Sat, Jan 5, 2013 at 9:41 AM, ANKIT BAGARIA wrote: > I have installed mysql as databse and i am not able to create a database. I > know the command for it but dont know where to type it. Django tutorials > tell to run the command in database interactive. But I am not

RE: How to add an element of derived data to a Django model?

2013-01-05 Thread Babatunde Akinyanmi
I think you can write a function that returns a > b and then make it a getter method with python's property. i would have given an example but typing code from my phone isn't very appealing. Sent from my Windows Phone -Original Message- From: Saqib Ali Sent: 1/5/2013 5:50 PM To:

Re: How to add an element of derived data to a Django model?

2013-01-05 Thread donarb
On Saturday, January 5, 2013 8:48:00 AM UTC-8, Saqib Ali wrote: > > > I have a Django Model as follows: > > > class myModel(models.Model): > > a = models.IntegerField() > > b = models.IntegerField() > > > I want to add a models.BooleanField() named c to the myModel class. > However

RE: how to create a databse

2013-01-05 Thread Babatunde Akinyanmi
Follow these steps: 1. Visit google.com 2. Type in the field - how to create a MySQL database Trust me, google knows everything; you will get more than enough answers. Sent from my Windows Phone -- From: ANKIT BAGARIA Sent: 1/5/2013 5:45 PM To:

How to add an element of derived data to a Django model?

2013-01-05 Thread Saqib Ali
I have a Django Model as follows: class myModel(models.Model): a = models.IntegerField() b = models.IntegerField() I want to add a models.BooleanField() named c to the myModel class. However the value of c is simply derived from a and b so I don't want it to be stored in the

how to create a databse

2013-01-05 Thread ANKIT BAGARIA
I have installed mysql as databse and i am not able to create a database. I know the command for it but dont know where to type it. Django tutorials tell to run the command in database interactive. But I am not able to figure out how to to so. Please help me in creating a database. Thankyou.

Re: django on windows azure

2013-01-05 Thread Daniel González Sánchez
Hello Eugeny, I'm also interested in porting my django system to the Azure SQL Cloud service (not necessarily porting to Windows) Any new or which option did you choose? Cheers Dani On Tuesday, February 7, 2012 6:36:01 AM UTC+1, Eugeny Klementev wrote: > > Hello, > > I'm porting django

Documentation of app_directories.Loader

2013-01-05 Thread Per-Olof Åstrand
I had a problem interpreting the documentation of app_directories.Loader in https://docs.djangoproject.com/en/dev/ref/templates/api/#loading-templates(I use the dev version of Django). As I read the documentation, I should put the templates for an app in app_name/templates/*.html > whereas to

Re: Get objects sorted by time of last comment

2013-01-05 Thread Victor Rocha
Hi Vibhu, You have more than one option, I think: 1)Modify model's Meta class and add an order_by = ('-comment__creation_date',) 2)Make a view that does just that last_threads_commented = Thread.comments.order_by('-comment__creation_date') 3)Make a custom template tag that does all of the heavy