Re: How to get the items of Foreign Key

2011-10-06 Thread kenneth gonsalves
On Thu, 2011-10-06 at 23:31 -0700, Tsung-Hsien wrote: > class Item(models.Model): > name = models.CharField(max_length=250) > description = models.TextField() > > class Meta: > ordering = ["name"] > > def __unicode__(self): > return self.name > > c

How to get the items of Foreign Key

2011-10-06 Thread Tsung-Hsien
I write a model as below: class Item(models.Model): name = models.CharField(max_length=250) description = models.TextField() class Meta: ordering = ["name"] def __unicode__(self): return self.name class Photo(models.Model): item = models.Forei

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread kenneth gonsalves
On Thu, 2011-10-06 at 10:00 +0100, Chris G wrote: > > this is as simple as it gets > > https://bitbucket.org/lawgon/django-addition/overview > > Too simple for me, it doesn't run. > > chris$ python manage.py runserver > Error: No module named addition.addnums you did not follow the

question : Add HTTP-GET accessabilty to 'Poll', Based on samuraisam's django-json-rpc

2011-10-06 Thread bino oetomo
Dear All ... Reff, samuraisam's django-json-rpc is at : https://github.com/samuraisam/django-json-rpc#readme I try to implement that solution to my "Poll" app .. hope that it'll be accessible via simple HTTP-GET. What I've done : Below is mypoll/urls.py: from django.conf.urls.defaults

Re: How to make Django pick new urls immediately

2011-10-06 Thread Babatunde Akinyanmi
With django, when a url is sent to the server, the work flow is that urls.py is first run to check if an expression that matches the url submitted is available in the pattern function. If available, it runs the view function specified in the pattern. This just means that you don't have to restart y

m2m ordering doesn't seem to work as expected

2011-10-06 Thread Knack
Hi guys, from the docs I thought the following should work to get the insertion_order as default (to be recognized by serialiser etc.). The commeted lines are other unsuccessful attemps: class Thingie(models.Model): obj_id = models.CharField(max_length=32, primary_key=True) children = mod

Porting BugFix #3615 (Can't define forward references in fixtures using MySQL with InnoDB) to Django 1.3.1

2011-10-06 Thread Kirill Panshin
Hey, If you get this problem with your fixtures when loading them into MySQL InnoDB, you can use this forked branch of Django: https://github.com/kipanshi/django/tree/1.3.1.1 To install via pip: pip install -e git+git://github.com/kipanshi/ django.git@1.3.1.1#egg=django-1.3.1.1 -- Che

Re: hasNoProfanities validator - no longer exists?

2011-10-06 Thread william ratcliff
Simple filters run into problems like: http://en.wikipedia.org/wiki/Scunthorpe_problem William On Thu, Oct 6, 2011 at 10:18 PM, robinne wrote: > I've finally managed to get a basic validator to work on a model (I > used validate_slug on a model field and was able to catch it as a > ValidationE

hasNoProfanities validator - no longer exists?

2011-10-06 Thread robinne
I've finally managed to get a basic validator to work on a model (I used validate_slug on a model field and was able to catch it as a ValidationError). After getting that to work I tried to then get the validator that I actually want to work, hasNoProfanities. I have found that the validator no lon

Re: Django image upload

2011-10-06 Thread Ian
So should I put it in a try/catch block to verify it's an image? Also, how do I go about saving it as a different name (as the ID of the model, for example)? On Oct 6, 7:26 pm, Kurtis Mullins wrote: > ImageField uses PIL (Python Imaging Library) to verify if it's a valid > image, if I understand

Re: Django image upload

2011-10-06 Thread Ian
So should I put it in a try/catch block to verify it's an image? Also, how do I go about saving it as a different name (as the ID of the model, for example)? On Oct 6, 7:26 pm, Kurtis Mullins wrote: > ImageField uses PIL (Python Imaging Library) to verify if it's a valid > image, if I understand

Re: Django image upload

2011-10-06 Thread Kurtis Mullins
ImageField uses PIL (Python Imaging Library) to verify if it's a valid image, if I understand it correctly. On Thu, Oct 6, 2011 at 6:21 PM, Ian wrote: > Ah! Got it working! How do I make sure the files are only images? Is > there a way to check the extension? Also, how would I rename the > fil

Re: Django image upload

2011-10-06 Thread Ian
Ah! Got it working! How do I make sure the files are only images? Is there a way to check the extension? Also, how would I rename the file? Thanks! On Oct 6, 3:46 pm, bazaarsoft wrote: > Noticed a couple of typos in my reply: > > > I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py fo

Adding calculated field depending on admin form and inlines/related models

2011-10-06 Thread graeme
I want to store the result of an expensive calculation in my model. It should be caculated if the the current value is null. It should also be calculated if requested on the admin form (I added a Boolean field to the form for this purpose). The problem is that the calculation requires values fro

Re: show image

2011-10-06 Thread Cal Leeming [Simplicity Media Ltd]
Please don't expect any type of serious response if you don't even bother to put effort into your question. For future reference, please see - https://code.djangoproject.com/wiki/UsingTheMailingList Maybe re-post your question in the form of a question, and you might get a response. Cal On Thu,

Re: Django tutorial, cannot add "polls" to admin

2011-10-06 Thread Ser5
Ahhh, after heavy digging of the internet and gazing at example app "django-registration" I discovered that I have missed one thing - I didn't include "polls" in INSTALLED_APPS. After adding it I finally got "Polls" in the Django admin. But anyway, thank you for trying to help me =) Seems like

show image

2011-10-06 Thread electrocoder
how do user image thumbnail django admin panel? -- 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 django-users+unsubscr...@googlegro

Your Impressions on DjangoCMS

2011-10-06 Thread colinta
I would love to hear some professional opinions on how easy it is to create, maintain and support a DjangoCMS-based website. The only curve ball is that the client will need customizable forms. Otherwise it's a pretty standard site. Very recently - last week - the company I work for announced th

Re: Django tutorial, cannot add "polls" to admin

2011-10-06 Thread Yaşar Arabacı
How does your urls.py look like? Did you uncomment admin related things in there? 2011/10/6 Ser5 > Hi! Help me please to solve one tutorial problem. > > Now I'm reading the 2nd part of the tutorial and have stuck with adding > polls app to the Django admin. > Everything worked fine in the tutori

Re: How to make Django pick new urls immediately

2011-10-06 Thread Yaşar Arabacı
maybe you should restart the server? And, do you include new urls in your root url config? 2011/10/6 Kayode Odeyemi > Hello, > > I don't know if I'm the only one experiencing this. I have multiple urls.py > in different packages based on > the similarities of the modules. Everytime I add a new u

Re: Django image upload

2011-10-06 Thread bazaarsoft
Noticed a couple of typos in my reply: > I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder, file, not folder > and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'. is actually 'pluginFiles/%Y/%m/%d/%H/%M/' jay On Oct 6, 2:41 pm, bazaarsoft wrote: > > Also,

Re: Django image upload

2011-10-06 Thread bazaarsoft
> Also, I'm confused whether upload_to should be set in settings.py or > models.py It's actually a mix - if you have MEDIA_ROOT defined in settings.py, then it will use that as the first part of the path. Then, what you pass in the upload_to field will be appended to that. So, in my case, I have "

Have different databases using SQLite

2011-10-06 Thread Lars Ruoff
Hi, i'm having the Django database set up like so: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'D:\Users\Max\Projects\my4x\data\my4x.db', 'USER': '', # Not used with sqlite3. 'PASSWORD': '', #

How to make Django pick new urls immediately

2011-10-06 Thread Kayode Odeyemi
Hello, I don't know if I'm the only one experiencing this. I have multiple urls.py in different packages based on the similarities of the modules. Everytime I add a new url to urls.py, it doesn't take effect immediately. Always returning 404 until I have to do something... Can't remember what I di

How to do equivalent of LEFT JOIN ON in Django (returning all Left rows, when Right item may not exist)

2011-10-06 Thread Attempting Django
Hi guys, can anyone please give me an example of how to do equivalent of a LEFT JOIN ON in Django?? I am trying to return every row from one table on the left, with any matches in a foreign table on the right (there will be only one or NULL match possible). The issue I'm having is showing left tabl

Re: how to access a foreignKey with multiple constraints

2011-10-06 Thread msbuck
I accidently hit Send before I was finished. the development server validates this model, but I can't seem to figure out how to access the last_name and first_name fields in the template. When I do the following: {{object.last_name}} I get a Template Syntax Error. Caught ValueError while renderi

how to access a foreignKey with multiple constraints

2011-10-06 Thread msbuck
I have a legacy Oracle database which I'm trying to model. I used inspectdb which did a good job. However, a few of my tables contain two fields which combine to form a foreign key constraint. In other words the legacy database was created like this: CREATE TABLE "MY_TABLE" ("TRACKING_ID" NUMBER N

Default model manager and .objects usage in django itself

2011-10-06 Thread Guilherme Salgado
Hi there, I'm changing an existing app to add support for private objects which are accessible only to certain users. In order to make it hard to accidentally leak private data in case we forget to update one or more places to use the new (privacy-aware) API, I've changed the plain manager (.objec

Django tutorial, cannot add "polls" to admin

2011-10-06 Thread Ser5
Hi! Help me please to solve one tutorial problem. Now I'm reading the 2nd part of the tutorial and have stuck with adding polls app to the Django admin. Everything worked fine in the tutorial until I reached "Make the poll app modifiable in the admin" part. Here is the link to the tutorial page

Re: Django image upload

2011-10-06 Thread Ian
I can't seem to get it working. It won't let my sync the database with this code: image = ImageField(upload_to=None[, max_length=100, **options]) Also, I'm confused whether upload_to should be set in settings.py or models.py Thanks! On Oct 6, 6:11 am, BILLION Sébastien wrote: > Hi, > > http://

Re: Class Views

2011-10-06 Thread Vijay Khemlani
It should be "render_to_response", not "render_to_reponse", a spelling problem maybe? On Thu, Oct 6, 2011 at 12:53 PM, CrabbyPete wrote: > I have the following class defined > > class TeamView(TemplateResponseMixin, View): >template_name = 'team.html' > >def get(self, request): >

Class Views

2011-10-06 Thread CrabbyPete
I have the following class defined class TeamView(TemplateResponseMixin, View): template_name = 'team.html' def get(self, request): if 'team' in request.GET: team = Team.objects.get(id = request.GET['team']) form = TeamForm( ) else: tea

Re: static app on development server

2011-10-06 Thread brian
Nevermind. My ide doesn't do auto server restarts so django wasn't getting restarted. -- 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

static app on development server

2011-10-06 Thread brian
I can't get the static files to be served from an app dir. I have myApp/static/styles2.css The template myApp\templates\myApp\ver1\tmpl.html has {% load static %} In the settings file I have STATICFILES_FINDERS → 'django.contrib.staticfiles.finders.AppDirectoriesFinder' I

Re: How to get topics user replied?

2011-10-06 Thread Javier Guerra Giraldez
On Thu, Oct 6, 2011 at 9:41 AM, David.D wrote: > It work: > > Topic.objects.filter(pk__in=[comment.content_object.pk for comment in > Comment.objects.filter(user__exact = request.user)]) or: Topic.objets.filter (comments__user=request.user) if you add a 'reverse generic relation' field to Topi

Re: How to get topics user replied?

2011-10-06 Thread David.D
It work: Topic.objects.filter(pk__in=[comment.content_object.pk for comment in Comment.objects.filter(user__exact = request.user)]) On Oct 6, 9:13 pm, "David.D" wrote: > class Topic(models.Model): >     title = models.CharField(max_length=100) >     body  = models.TextField(_('body'), max_leng

Re: Helping someone move from Joomla to Django

2011-10-06 Thread Greg Maruszeczka
On Thu, 6 Oct 2011 06:12:21 -0700 (PDT) graeme wrote: > Joomla may have those shortcomings, but its not the only alternative. > If someone likee PHP, already knows PHP or has to use PHP, there are > a lot of PHP fraeworks: from light ones, to ones feature comparable > to > Django (although I do

How to get topics user replied?

2011-10-06 Thread David.D
class Topic(models.Model): title = models.CharField(max_length=100) body = models.TextField(_('body'), max_length=TEXT_MAX_LENGTH) user = models.ForeignKey(User, related_name='topic_user', editable=False) ... I use 'django.contrib.comments' to reply a topic. How to get topics use

Re: Helping someone move from Joomla to Django

2011-10-06 Thread graeme
Joomla may have those shortcomings, but its not the only alternative. If someone likee PHP, already knows PHP or has to use PHP, there are a lot of PHP fraeworks: from light ones, to ones feature comparable to Django (although I do not know of any framework that can match Django Admin). The best

Re: Randomly clearing database tables

2011-10-06 Thread msbuck
The behavior I was seeing was as if the tests where run without using manage.py. My app tests at this point are very simple. I use a fixture to load data to do the view tests but don't explictly delete anything from the tables. I did basically what you suggested. You can set up the environment var

Re: Field exists but django tells me "is not defined"

2011-10-06 Thread Daniel Roseman
On Thursday, 6 October 2011 13:00:11 UTC+1, gregory semah wrote: > > Sorry my mistake again... > > I mean when i write "Projet.objects.filter(fact!=None)" instead of > "Projet.objects.filter(fact=None)" > > Thanks > > You can't use != in filter, as it's a function call. You need to do `filter(

Re: Field exists but django tells me "is not defined"

2011-10-06 Thread gregory semah
Ok isolved with projet = Projet.objects.filter(fact__isnull=False) Everything 's back to normal :) On 6 oct, 14:00, gregory semah wrote: > Sorry my mistake again... > > I mean when i write "Projet.objects.filter(fact!=None)" instead of > "Projet.objects.filter(fact=None)" > > Thanks > > > > > >

Re: Field exists but django tells me "is not defined"

2011-10-06 Thread gregory semah
Sorry my mistake again... I mean when i write "Projet.objects.filter(fact!=None)" instead of "Projet.objects.filter(fact=None)" Thanks > > > > > > > > Hi All, > > > I'm dealing with really weird problem > > > My model > > class Projet(models.Model): > >       ... > >       fact = models.PositiveI

Re: Field exists but django tells me "is not defined"

2011-10-06 Thread gregory semah
I mean when i write "Projet.objects.filter(fact!=None)" instead of "Projet.objects.filter(fact!=None)" The NameError appears Thanks On 6 oct, 13:54, gregory semah wrote: > Hi All, > > I'm dealing with really weird problem > > My model > class Projet(models.Model): >       ... >       fact = mod

Field exists but django tells me "is not defined"

2011-10-06 Thread gregory semah
Hi All, I'm dealing with really weird problem My model class Projet(models.Model): ... fact = models.PositiveIntegerField('Numéro de Facture',null=True,blank=True) ... ... A simple view from this model is def facture(request, id=None): projet = Projet.objects.all()

cache_page: force reload

2011-10-06 Thread Thomas Guettler
Hi, up to now cache_page ignores "pragma no-cache" (shift-ctrl-r in firefox). I think this ticket should be looked at again: https://code.djangoproject.com/ticket/10225#comment:5 Cache middleware does not honor "Cache-Control: no-cache" in request headers {{{ A normal reload (F5 or ctrl-r) does

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Chris G
On Thu, Oct 06, 2011 at 10:09:05AM +0100, Cal Leeming [Simplicity Media Ltd] wrote: >Chris - >The only thing I can say, is that you've been given some really good >advice on this thread so far. Yes, I'm not complaining at all, the feedback has all been very helpful. I'm just rather im

Re: Question about Signals : How to get the Primary Key Value ?

2011-10-06 Thread bino oetomo
On 10/06/2011 05:11 PM, Daniel Roseman wrote: The instance is in, well, the `instance` argument. You get it from there. -- DR. Thankyou ... I got it by ---> print obj.pk Sincerely -bino- -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: weird behavoir of Excel

2011-10-06 Thread Cal Leeming [Simplicity Media Ltd]
Hi Patrick, As a quick fix, you can put "=" at the start of each field, and it should force the data to not 'auto format' (YMMV). Cal On Thu, Oct 6, 2011 at 10:13 AM, Szabo, Patrick (LNG-VIE) < patrick.sz...@lexisnexis.at> wrote: > Hi, > > ** ** > > I’m creating an EXCEL-Sheet out of Djan

Re: Django image upload

2011-10-06 Thread BILLION Sébastien
Hi, http://www.nitinh.com/2009/02/django-example-filefield-and-imagefield/ It the same for ImageField BILLION Sébastien the Answer to the ultimate question of life, the universe and everything is 42 http://www.sebastienbillion.com/ Le 06/10/2011 05:22, Ia

Re: Question about Signals : How to get the Primary Key Value ?

2011-10-06 Thread Daniel Roseman
On Thursday, 6 October 2011 10:10:09 UTC+1, bino wrote: > > Dear All .. > > From the basic tutorial of "Polls", > I add this lines to model.py > START > from django.db.models.signals import post_save > > def do_something(sender, **kwargs): > print "==START===" >

Re: Question about Signals : How to get the Primary Key Value ?

2011-10-06 Thread BILLION Sébastien
hi, obj.id ? BILLION Sébastien the Answer to the ultimate question of life, the universe and everything is 42 http://www.sebastienbillion.com/ Le 06/10/2011 11:10, bino oetomo a écrit : Dear All .. From the basic tutorial of "Polls", I add this lines to

weird behavoir of Excel

2011-10-06 Thread Szabo, Patrick (LNG-VIE)
Hi, I'm creating an EXCEL-Sheet out of Django with the following code: response = render_to_response('reportsexcel.html', {'produkte': dict(buch_pool), 'gesamt_string':gesamt_string} ,context_instance=RequestContext(request)) filename = "report.xls" response['Content-Disposition'] = 'att

Question about Signals : How to get the Primary Key Value ?

2011-10-06 Thread bino oetomo
Dear All .. From the basic tutorial of "Polls", I add this lines to model.py START from django.db.models.signals import post_save def do_something(sender, **kwargs): print "==START===" print "Called by : " , sender print "This is KWARGS :" print kwargs

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Cal Leeming [Simplicity Media Ltd]
Chris - The only thing I can say, is that you've been given some really good advice on this thread so far. These lists are really meant to be a "nudge in the right direction" rather than a "fully fledged training experience" [1]. There are plenty of django projects on Github which show a fully w

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Chris G
On Thu, Oct 06, 2011 at 01:14:37AM -0700, Daniel Roseman wrote: > On Wednesday, 5 October 2011 20:55:33 UTC+1, Chris Green wrote: > > I'm an experienced programmer (started around 1971 or so!) and I've done > lots of things over the years, much of my background is in Unix > (So

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Chris G
On Thu, Oct 06, 2011 at 11:01:13AM +0530, kenneth gonsalves wrote: > On Wed, 2011-10-05 at 23:02 +0100, Chris G wrote: > > OK, so there isn't a single simple answer. However it would still be > > really nice to see a complete two or three page django site with a > > database behind it fully implem

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Kevin
For that it's worth, I deploy my Django projects using Nginx and FastCGI. I find this solution to be working rather nicely, Nginx takes care of serving all the static content really fast and passes the app requests to Django. It's really quick and easy to set-up too. I prefer Nginx as I can bett

Re: Helping someone move from Joomla to Django

2011-10-06 Thread Kevin
I might say just 'WOW!'... I just took some time to go over the Joomla documentations to see what I was up against. Why do developers even use this thing? Sure maybe the frontend is nice and polished, but the backend looks horrible, at least compared to Django. Django code looks much more clean

Re: post_add signal for non m2m

2011-10-06 Thread bino oetomo
On 10/06/2011 01:16 PM, bino oetomo wrote: Dear All .. I read https://docs.djangoproject.com/en/1.2/topics/signals/ Looks like there is no "post_add" signal can be catched by listener function. Please ignore my previous post. I found the solution here : http://www.chrisdpratt.com/2008/02/16/s

Re: Beginner a bit lost - need some pointers please

2011-10-06 Thread Daniel Roseman
> > On Wednesday, 5 October 2011 20:55:33 UTC+1, Chris Green wrote: > I'm an experienced programmer (started around 1971 or so!) and I've done > lots of things over the years, much of my background is in Unix (Solaris). > In the last few years I have done quite a lot of web related stuff. > > I'm

Re: Report tool is supported for django .

2011-10-06 Thread Alexey Luchko
I need to make a report with django . This report supports (chart , export PDF, Excell ...,) please give me some recommendations with tool i must use for this case. To produce printable reports, you can try http://pypi.python.org/pypi/PythonReports/. -- Regards, Alexey. -- You received this