Database error: Table 'test_XXX.django_content_type' doesn't exist

2010-10-27 Thread girish shabadimath
Hi all, im using django 1.2 there are two databases involved in my project (default and XYZ (used only for migration)) i use a consistant MySQL storage type for all apps, all models (including m2m). This is done by registering a post-syncdb signal in management.py file which converts all tables

Re: Django form show initial prepopulate on edit

2010-10-27 Thread Hudar
Hi, Yes, because i use appengine, so django model not supported. Btw i fixed the problem , by using {{ postForm.category }} instead, and put the css class by define category = forms.CharField(widget = forms.TextInput(attrs={'class':'somecssclass'}) instead of wrote it in html. Thanks. On Oct

django erest interfac

2010-10-27 Thread sami nathan
hi for django restfull interface i am using the link given below is it correct i am experiencing error in that steps http://code.google.com/p/django-restful-model-views/ please visit this and tell me -- You received this message because you are subscribed to the Google Groups "Django users" grou

Using localflavor with admin?

2010-10-27 Thread Victor Hooi
Hi, Is there any way to combine the localflavor module (http:// docs.djangoproject.com/en/dev/ref/contrib/localflavor/) with Django's in-built admin module? For example, I'd like to create a model with say, a Postcode and phone- number field, and have these validated in the admin, as per the rule

Re: Multiple database issue v1.2.3 - Django reading the wrong database

2010-10-27 Thread Russell Keith-Magee
On Wed, Oct 27, 2010 at 1:13 AM, Stodge wrote: > I have two PostgreSQL (postgresql_psycopg2) databases defined in my > settings; default and scenes. > > If I perform a filter using the 'scenes' DB I get the expected > results: > > Scene.objects.filter(name__contains='ME').using('scenes') > [, ] >

Re: Import csv file in admin

2010-10-27 Thread Jorge
On Oct 27, 7:43 pm, Jorge wrote: > > On 27/10/2010, Daniel Roseman wrote: > > > > You're setting the values on `self` in the form's save method. In > > > other words, you're setting them on the *form*, not the instance. You > > > should be setting them on `form_instance`. > > > > Also, don't co

Model Inheritance.

2010-10-27 Thread Tom Eastman
I'm working with model inheritance, and I need to convert my objects into instances of its subclass. Is there an easy way to do this? Looking at the example in: http://docs.djangoproject.com/en/1.2/topics/db/models/#multi-table-inheritance I have a whole bunch of 'Place' objects that are i

Re: Import csv file in admin

2010-10-27 Thread Jorge
On Oct 27, 1:58 pm, Jirka Vejrazka wrote: > If you don't mind me asking, why do use ModelForm and not the ORM > directly? I'm just curious as using just a model (possibly wirh model > validation) seems like easies approach. > >   Cheers > >     Jirka Hi Jirka! The idea behind the modelform is

Re: Displaying (only) custom form fields in a template.

2010-10-27 Thread ShawnMilo
I found a solution, but it's kind of ugly. In the form I added this: self.fields[field_name].is_custom = True And in the model: {% for field in form %} {% if field.field.is_custom %} {{ field.label }} {{ field }}

Re: overriding save-method

2010-10-27 Thread Patrick
hm .. i thought of that too but i considered it not to be the best approach. i will try that snippet though.. thank you! On 27 Okt., 15:49, Shawn Milochik wrote: > Try this instead: > > http://djangosnippets.org/snippets/1478/ > > Or you could do it manually in your model: > > 1. Add field _value

Re: help with model definition

2010-10-27 Thread pixelcowboy
The second solution would be great, but is the relationship inherited? I didnt think that was possible. Will try it out, first solution is also an option. Thanks for your help. On Oct 27, 1:35 pm, Marc Aymerich wrote: > On Tue, Oct 26, 2010 at 6:21 PM, pixelcowboy wrote: > > > I have a question r

Displaying (only) custom form fields in a template.

2010-10-27 Thread Shawn Milochik
I'm using Django 1.1. I have a forms.Form that has fields in it, and I'm dynamically creating custom fields, each with a name beginning with 'custom_.' In my template I'm already displaying the non-custom fields. I need to be able to show just the custom fields. How do I iterate through only the

Re: Factory Squirrel

2010-10-27 Thread Łukasz Rekucki
On 27 October 2010 22:17, Phlip wrote: > Djangoes: > > RoR has a fixture system called Factory Girl, which I suspect > constructs objects in native Ruby, not in JSON/YAML. > > If nobody ports it to Django I would; under the name "Factory > Squirrel". http://github.com/dnerdy/factory_boy Also, th

Re: help with model definition

2010-10-27 Thread Marc Aymerich
On Tue, Oct 26, 2010 at 6:21 PM, pixelcowboy wrote: > I have a question regarding the best way to conceptualize a model. I > have a tasks model, which I want to hook to a few different other > models: The model Project, the model Company and a few other undefined > models. The problem is that I wa

Re: What does an ideal django workflow setup look like?

2010-10-27 Thread Ken
Ok - I put together more research. It's a huge pile of links. Hope this helps as additional places to learn/look. As a disclaimer, I'm a noob, which is why I am providing Internet research instead of a personal expert opinion. --Simon Willison (co-Founder of Django) answered the question at Q

Factory Squirrel

2010-10-27 Thread Phlip
Djangoes: RoR has a fixture system called Factory Girl, which I suspect constructs objects in native Ruby, not in JSON/YAML. If nobody ports it to Django I would; under the name "Factory Squirrel". This post is about the first method I'd add to such a module. Another kewt RoR fixture feature is

Re: help with model definition

2010-10-27 Thread urukay
well, u can add multiple FK relations to your model e.g.: company = models.ForeignKey(Company, blank=True, null=True) other_model = models.ForeignKey(OtherModel, blank=True, null=True) And then in form you just define clean method which will ensure that one and only one FK relation will be create

Re: How can you change the color of the form's error messages

2010-10-27 Thread Shawn Milochik
The errors are given a standard 'error' class. You can just add CSS to modify it to your tastes. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this

How can you change the color of the form's error messages

2010-10-27 Thread Akn
Hi all, How can I customize the error message that comes from a form from (e.g. change the color) 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-us...@googlegroups.com. To unsubscribe from thi

Django form show initial prepopulate on edit

2010-10-27 Thread Hudar
Hi, Just wondering, how we could show initial value on the edit form. Let say we have code like this to retrive the data ; if request.method == 'GET': post = models.Post.get_by_key_name(key_name) editPostForm = postform.PostForm(initial={ 'title': post.title,

Re: problems using apps in main project (NameErrors)

2010-10-27 Thread Piotr Zalewa
just add before code: import site :) On 10/27/10 15:13, wawa wawawa wrote: > Hi Piotr, > > On 27 October 2010 15:54, Piotr Zalewa wrote: >> If you want to have the apps in apps folder you need to put them on the >> python path, so eithor modify the python path environment variable or >> (prefere

Re: problems using apps in main project (NameErrors)

2010-10-27 Thread wawa wawawa
Hi Piotr, On 27 October 2010 15:54, Piotr Zalewa wrote: > If you want to have the apps in apps folder you need to put them on the > python path, so eithor modify the python path environment variable or > (prefered) modify manage.py and add > site.addsitedir(path('apps')) Many thanks for the resp

Problems limiting get_next_by_FOO inside a django view?

2010-10-27 Thread tricks
have used get_next_by_FOO inside my view to display an absolute url for the following item within a set of records however when it gets to the end of the query set an error is raised. how do I stop my view from raising this error and instead just outputting some html letting me know that it has co

Re: Override DECIMAL_SEPARATOR in certain cases?

2010-10-27 Thread Joachim Pileborg
Seems weird that no one have had this problem before... Maybe no one is using any other locale than en-us? Anyway, I solved it by making a custom template filter called "dotify", which if it gets a floating point number, converts it to a string, and replaces all commas with "dots": def dotify(val

Re: How do you create a view that returns the next object in a given list?

2010-10-27 Thread tricks
get_next_by_FOO http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.get_next_by_FOO -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe

Re: How do you create a view that returns the next object in a given list?

2010-10-27 Thread tricks
get_next_by_FOO http://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.get_next_by_FOO -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe

Re: problems using apps in main project (NameErrors)

2010-10-27 Thread Piotr Zalewa
Hi If you want to have the apps in apps folder you need to put them on the python path, so eithor modify the python path environment variable or (prefered) modify manage.py and add site.addsitedir(path('apps')) zalun On 10/27/10 14:50, wawa wawawa wrote: > Hi All, > > I've spent the last hour o

problems using apps in main project (NameErrors)

2010-10-27 Thread wawa wawawa
Hi All, I've spent the last hour or so looking for a clear and simple explanation to this but I've been unsuccessful. Maybe someone here could help me (please!) What do I need to do to make sure my created apps are useable? This is the structure of my "XMLmunger" project. In order to simplify m

Re: overriding save-method

2010-10-27 Thread Shawn Milochik
Try this instead: http://djangosnippets.org/snippets/1478/ Or you could do it manually in your model: 1. Add field _value_json to your model. 2. Add functions (get_value, set_value) which do the simplejson work. 3. Add a property named 'value' with get_value and set_value as its getter and sette

Re: Django job needed

2010-10-27 Thread roberto
http://code.djangoproject.com/wiki/DjangoJobs http://djangozen.com/jobs/ http://www.python.org/community/jobs/ Good luck ! On Oct 26, 10:41 pm, Venkatraman S wrote: > On Wed, Oct 27, 2010 at 1:04 AM, Swordfish wrote: > > Hi everybody! I'm looking for a job deals with Django. > > Interesting in

overriding save-method

2010-10-27 Thread Patrick
hi, i am trying to override the save-method of one of my models. i want to save the json-representation of any object in a text field. somehow it doesn't seem to work. class Setting(models.Model): name = models.CharField(max_length=100) value = models.TextField() def save(self, *args

Open Source Developer Network for Django Developers

2010-10-27 Thread Sandra
We release an innovative social network and collaboration platform with capabilities to develop your Django project alone or together with like-minded developers, e.g. code hosting with 2 GB free disk space. The project is open source and free-of-charge. Take a look under http://bettercodes.org Re

Re: change the default widget to a field in a modelform

2010-10-27 Thread refreegrata
If somebody know some way to save a Manytomany field (the departments) manually in the view and not with form.save() would be helpful. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroup

Re: change the default widget to a field in a modelform

2010-10-27 Thread refreegrata
Yes, I know that, this is strange. My models. -- Table 1: Enterprise Table 2: Department with : fk_enterprise = models.ForeignKey(Enterprise) Table 3: Item with: fk_departament = models.ManyToManyField(Departament)

Re: Database Setup

2010-10-27 Thread Sithembewena Lloyd Dube
Thanks Everett! On Sat, Oct 23, 2010 at 4:24 AM, Everett wrote: > Thanks everyone for all your help! I found a binary for Python 2.7 > Here's a the link: http://www.codegood.com/archives/129 > Just in case someone stumbles upon these posts. > > On Oct 16, 3:58 pm, Karen Tracey wrote: > > 2010/1

How do you create a view that returns the next object in a given list?

2010-10-27 Thread tricks...@googlemail.com
I have a view that displays object information when the correct URL is provided however I would like to create a similar view that returns url information from the record that is located next. So in essence take the info from my first view, list/order it in some way preferably by date and return t

Re: Problem with Mysql Quires in django

2010-10-27 Thread Daniel Roseman
On Oct 27, 10:19 am, Jagdeep Singh Malhi wrote: > hi > I want to use this mysql Query > " SELECT count(*) as class_roll_no FROM student_profile where > class_roll_no !='00 '  "; > in my  view file > > Is it possible? > > I try this code > view.py file is : > > from django.shortcuts import render_t

Re: How to display image in django template

2010-10-27 Thread girish shabadimath
Another way for static images: Its good to have all html related stuffs (html files, images, ..etc) in one directory (ex: html directory) In settings.py there is a field called TEMPLATE_DIR, add the absolute-path to the html directory to this filed ex: TEMPLATE_DIR = 'path-to-html-directory', in

Problem with Mysql Quires in django

2010-10-27 Thread Jagdeep Singh Malhi
hi I want to use this mysql Query " SELECT count(*) as class_roll_no FROM student_profile where class_roll_no !='00 ' "; in my view file Is it possible? I try this code view.py file is : from django.shortcuts import render_to_response from mysite.student.models import Profile from django.db.mo

Re: interface django and rest

2010-10-27 Thread sami nathan
But is telling about piston is i am very beginner of django i want to inerface django and RESTFULL service and i am also blinking with what to do with my wsdl file Please help by THANKS -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: interface django and rest

2010-10-27 Thread Jirka Vejrazka
> Please Suggest me an tutorial for interfacing django and  restfuli thanks Hi Sami, you might want to check this out: http://bitbucket.org/jespern/django-piston/wiki/Home Jirka -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

interface django and rest

2010-10-27 Thread sami nathan
Please Suggest me an tutorial for interfacing django and restfuli 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-u

Re: Import csv file in admin

2010-10-27 Thread Daniel Roseman
On Oct 27, 4:27 am, Jorge wrote: > I'm trying to poblate a database with a csv file using the modelform > in Admin site. Here's the files: > > Models.py: > > class Data(models.Model): >         place = models.ForeignKey(Places) >         time = models.DateTimeField(blank=True) >         data_1 = m

Re: for loop logic in template

2010-10-27 Thread Daniel Roseman
On Oct 27, 5:33 am, jimgardener wrote: > hi > I have a model with 3 fields > class Employee(models.Model): >     name=models.CharField(max_length=50) >     home_address=models.TextField(blank=True) >     change_filter=models.IntegerField() > > I am creating a modelform using this class as model. >

Re: change the default widget to a field in a modelform

2010-10-27 Thread Daniel Roseman
On Oct 26, 7:54 pm, refreegrata wrote: > maybe I not explain correctly. For any modelForm the forms for a field > "ManytoMany"  are "select multiple". If I want to change this I must > to redefine the widget for that field in the declaration of the > "modelForm". This works correctly, I can transf

Re: Editing user profiles via "inlines" breaks password management in admin site

2010-10-27 Thread derek
Actually, it seems more complex... you now have a 2 stage operation to carry out what should be a relatively(?) simple operation - add a user with their details. I have *exactly* the same problem as the original user - is there no one else who has managed to create a usuable User+Profile admin ed

Import csv file in admin

2010-10-27 Thread Jorge
I'm trying to poblate a database with a csv file using the modelform in Admin site. Here's the files: Models.py: class Data(models.Model): place = models.ForeignKey(Places) time = models.DateTimeField(blank=True) data_1 = models.DecimalField(max_digits=3, decimal_places=1,