runserver cache my template files

2012-06-21 Thread Tomás Garzón Hervás
Hi, I've updated to django 1.4 and I have many "cache" problems with runserver when I change only templates files in my project. If I change my source code of html file, when I go to browser to view this page, I can't see the new code in my html file. I have to reboot the runserver and reload t

Django learning

2012-06-21 Thread lovetoprogram
I tried to do this according the tutorial. >>> from django import template >>> t = template.Template('My name is {{ name }}.') >>> c = template.Context({'name': 'Adrian'}) >>> print t.render(c) My name is Adrian. >>> c = template.Context({'name': 'Fred'}) >>> print t.render(c) My name is Fred. But

autodiscover problem in Django 1.4

2012-06-21 Thread yillkid
Hi all ! When I use admin.autodiscover() in urls.py, browser will show "The model User is not registered",but reload again, show normally, just happen in version 1.4 without 1.1, something wrong? -- You received this message because you are subscribed to the Google Groups "Django users" gro

Duplicate rows with same key in DB?

2012-06-21 Thread ydjango
I have code as view_a(request): Populate my_a, my_b and my_c... try: tp = TP.objects.get(a__exact = my_a, b__exact = my_b) except TP.DoesNotExist, e: tp = TP() tp.a = my_a tp.b = my_b tp.c = my_c tp.save() else: tp.c = my_c tp.save() This view

Re: New to DJANGO

2012-06-21 Thread Thomas Lockhart
On 12-06-21 9:37 PM, LJ wrote: I started out learning Django using the "Writing your first Django app" article: https://docs.djangoproject.com/en/dev/intro/tutorial01/ This is a very well-written tutorial that goes through each part in detail. +1 anyone starting with Django is wasting time if t

Re: New to DJANGO

2012-06-21 Thread LJ
I started out learning Django using the "Writing your first Django app" article: https://docs.djangoproject.com/en/dev/intro/tutorial01/ This is a very well-written tutorial that goes through each part in detail. Please note, at the bottom of each section there is a link to the next section. The

New to DJANGO

2012-06-21 Thread Jeff Silverman
I am new to Django. I am trying to get the Class version of hello_world to work. I cannot find a good full example of the code that works. I have made multiple view.py files and urls.py files trying to get it to work. I cannot seem to come up with the right url to pass the variables name and

Re: Returning JSON error when catching Django exception

2012-06-21 Thread Oleg Korsak
I'm not sure, but there must be a 404 template :) 22.06.2012 0:24 пользователь "Taras_96" написал: > Ok - I'm pretty sure that I should be returning 500s. Is there any way of > catching 404s and returning a JSON response for them as well? > > > On Friday, 22 June 2012 00:08:39 UTC+10, Kurtis wrot

What happens underneath when I save to a model with ManyToMany relationships?

2012-06-21 Thread LJ
I have a Python script that will be called daily from a scheduled service or daemon. The script uses MySQLdb to read a csv file and import data into a MySQL database that is used in my Django application. Some of the models contain ManyToMany relationships. I am directly inserting the relations

Re: I need something to help with.

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
Hi Oladipupo, It's always great to see people wanting to get involved. There are plenty of 'easy pickings' tickets on the Django tickets queue.. or if you don't have enough time/energy to do code contributions, then you could assist users with problems on the mailing list, or contribute to discus

Re: Monitoring cache usage?

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
Oh also - I'm not entire sure it's possible to break down hits based on key prefix, at least easily. You might be able to analyse each one of the data slabs/pages/chunks, see which keys are inside, and relate that back to the number of hits against it. The following article goes into more detail:

Re: Monitoring cache usage?

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
A quick search on Google found the following: https://github.com/dlrust/python-memcached-stats https://developers.google.com/appengine/docs/python/memcache/clientclass http://code.google.com/p/memcache-top/ http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/ If yo

Re: Monitoring memory usage of an external component

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
Depending on the web application server you use, this can usually restrict the memory limit for you - uWSGI is a fine example of this. You can also use the 'poor mans' memory checks by checking the resident memory usage (not sure what that func is in Java), and checking if its over a certain limit

Re: strftime

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
Hi Armagan, I would suggest investigating what the 'date' variable contains.. You can do this by doing: print type(date) print dir(date) print date I'd also recommend going back through your code and seeing how the date object is instantiated. For future reference, you do really need to provide

Re: New to Django, need help starting

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
+1 Personally, I'd really recommend having virtualbox/vmware instance running the same stack as your production environment (i.e. the env where you are going to deploy code to) so you can ensure no horrible sys lib bugs kick in (lxml is a pain for this!!). But if this is too much to start with, th

Re: Installing Django @ Shared Host

2012-06-21 Thread Cal Leeming [Simplicity Media Ltd]
Unless they provide some sort of SaaS service where they take care of deployment for you, then you need shell access. There are plenty of Django friendly shared hosts if you are not comfortable deploying your own stack on a dedi/colo/IaaS cloud - see previous threads on this topic. Personal advice

Installing Django @ Shared Host

2012-06-21 Thread Miguel Guirao
Hi all, I have a hosting service from ApolloHosting.com. I don't have SSH access neither unsecure telnet to my account. I can FTP into my account. I have Python 2.5. I'm under Linux. Is there a way I could install django under these circunstances?? Best Regards, Miguel Guirao -- You received

Re: Getting the last modified datetime from a DateTimeField

2012-06-21 Thread Jesus Noland
I was always getting the date when the model was last modified when using 'm.date' On Thursday, June 21, 2012 2:35:02 PM UTC-7, Jesus Noland wrote: > > Thank you very much. I am understand now. Sorry it took so long to reply > back. > -- You received this message because you are subscribed to

Re: Getting the last modified datetime from a DateTimeField

2012-06-21 Thread Jesus Noland
Thank you very much. I am understand now. Sorry it took so long to reply back. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/7l1BiweMkwUJ. To post to thi

Re: Returning JSON error when catching Django exception

2012-06-21 Thread Taras_96
Ok - I'm pretty sure that I should be returning 500s. Is there any way of catching 404s and returning a JSON response for them as well? On Friday, 22 June 2012 00:08:39 UTC+10, Kurtis wrote: > > I'm not sure if returning a response is any different in middleware than > it would be in a normal v

Messages framework not including tags

2012-06-21 Thread bax...@gretschpages.com
I've read the docs: https://docs.djangoproject.com/en/1.3/ref/contrib/messages/ I have the MessageMiddleware in place. I have the SessionMiddleware in place (before MessageMiddleware) django.contrib.messages.context_processors.messages in in the context processors django.contrib.messages in i

Saving ManyToMany models

2012-06-21 Thread LJ
I am having trouble saving entities to my models that have ManyToMany relationships. I have a Student object that inherits from a Person: class Person(models.Model): first_name = models.CharField(max_length=30) middle_name = models.CharField(max_length=30, blank=True) last_name = mode

Re: New to Django, need help starting

2012-06-21 Thread Christopher Downard
It's useful to use virtualenv despite a slight learning curve. I didn't do that at first and now I'm going back and using virtualenv now because I've learned that the version of Django does matter depending on what you want to do and it's easier to be able to isolate versions. i.e. Django1.4 doesn

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-21 Thread Ian
On Thursday, June 21, 2012 4:37:35 AM UTC-6, Melvyn Sopacua wrote: > > Which is /exactly/ why I mention it. If the default value is inserted > instead of an empty string, you can pre-insert the default value and > have it linked to an invalid entry. Any attempts to insert the default > value on

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-21 Thread Ian
On Wednesday, June 20, 2012 1:38:45 PM UTC-6, André Pang wrote: > > 1. In Oracle's case, what if you have a model with a primary key that's > a CharField? I suspect that Oracle backend will coerce that to be > null=True, so now you have a primary key field that could have NULL. > Primary keys

Re: Custom model field as foreign key

2012-06-21 Thread Melvyn Sopacua
On 20-6-2012 19:38, Melvyn Sopacua wrote: > On 19-6-2012 17:02, Kurtis Mullins wrote: >> hmm, maybe you need a custom Select Widget for your custom field? Or check >> out the select widget and see if it's looking for any _meta information on >> the field that determines how the widget is displayed.

Re: Returning JSON error when catching Django exception

2012-06-21 Thread Kurtis Mullins
I'm not sure if returning a response is any different in middleware than it would be in a normal view. In that case: return HttpResponse(json_data, mimetype="application/json") On Thu, Jun 21, 2012 at 6:54 AM, Taras_96 wrote: > Does anyone have opinions on the best way of having middleware cat

Re: Our thanks/acknowledgments for Django

2012-06-21 Thread Kurtis Mullins
Very nice Cal! On Wed, Jun 20, 2012 at 9:59 PM, Daniel Sokolowski wrote: > Impressive and it more than does satisfy my curiosity; in this industry I > find the moment you start doing custom code it's hard to estimate - > especially on the larger projects. Super thanks > > > On 20/06/2012 20:11,

Stuck with a dynamic form within formwizard

2012-06-21 Thread het.oosten
On Django 1.2.3 i am trying to get a dynamic form working. On the first page a user have to give their address/client id and on the second page customers can order dishes for catering. To dynamically add forms on the second page i use http://code.google.com/p/django-dynamic-formset/ Here is my mo

Re: cad application

2012-06-21 Thread Jani Tiainen
21.6.2012 14:40, Satvir Toor kirjoitti: can we make cad applications through the django??? If any one know about a link where i can find such information just tell me. I could not find any information regarding it. Of course it is possible, though it all depends what you mean by "cad applic

Re: cad application

2012-06-21 Thread Marcin Tustin
Which parts of a CAD application, exactly, do you think Django might be helpful with? It could certainly provide an interface to a storage backend. On Thu, Jun 21, 2012 at 7:40 AM, Satvir Toor wrote: > can we make cad applications through the django??? If any one know > about a link where i can

cad application

2012-06-21 Thread Satvir Toor
can we make cad applications through the django??? If any one know about a link where i can find such information just tell me. I could not find any information regarding it. -- Satvir Kaur satveerkaur.blogspot.in -- You received this message because you are subscribed to the Google Groups "

Re: Time zone (Django 1.4) questions

2012-06-21 Thread Aymeric Augustin
Hi Klaas, Le mardi 12 juin 2012 13:13:14 UTC+2, Klaas van Schelven a écrit : > > 1] Migration of non-UTC to UTC: is there any script / best practice > available? > Django's documentation mentions that all data should be converted to UTC > when switching to USE_TZ=True. See: > https://docs.djan

Re: django.test HTTP/XMLRPC Testing with use of settings.TEST_DATABASE_NAME

2012-06-21 Thread Елена Платонова
Hello. Perhaps you need to use LiveServerTestCase, but it appears only in Django 1.4. https://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs#django.test.LiveServerTestCase четверг, 26 февраля 2009 г., 17:54:25 UTC+4 пользователь x_O написал: > > Hi > > Recently I'm trying to write t

Returning JSON error when catching Django exception

2012-06-21 Thread Taras_96
Does anyone have opinions on the best way of having middleware catch exceptions, and instead of rendering the error into a HTML template, to return a JSON object? Currently I have the middleware below that catches exceptions, and if it can find an extra user error message, puts that onto the

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-21 Thread Melvyn Sopacua
On 20-6-2012 21:38, André Pang wrote: > On 6/20/2012 11:46 AM, Melvyn Sopacua wrote: > >> On 20-6-2012 20:31, André Pang wrote: >>> Right. There's currently no way to enforce required=True at the database >>> level. >> >> So, your model clearly defines that it doesn't allow empty values, yet >> so

Re: strftime

2012-06-21 Thread robin nanola
i think i would be better if you read python datetime docs http://docs.python.org/library/datetime.html#datetime.date.strftime On Thu, Jun 21, 2012 at 4:47 PM, armagan wrote: > Hi, > > I'm trying to show the date in rss with this function > > def item_pubdate(self, item): > > date

Re: setting up new django project

2012-06-21 Thread Harjot Mann
you can use both methods.If you are getting a permission denied error by giving full path, then you have to change the permissions by using following command: sudo chmod +x /usr/local/bin/django-admin.py but its not necessary to give the whole path, infact the alternate method is easier. In most

Re: setting up new django project

2012-06-21 Thread Gelonida N
On 05/28/2012 04:53 AM, xaegis wrote: Hello, this is my first time posting to a list! I am running python 2.7 with django 1.4 installed on Ubuntu 12.04 I am having trouble creating new projects with django. Whenever I use the command: Code: sudo /usr/local/lib/python2.7/dist-packages/django/bi

strftime

2012-06-21 Thread armagan
Hi, I'm trying to show the date in rss with this function def item_pubdate(self, item): date = item.delivery_date return date.strftime("%d/%m/%y") But I have an error 'str' object has no attribute 'tzinfo'. Can you help me? How I code the function? -- You received this