Re: jsi18n date and time formating

2010-10-19 Thread timc3
For example: formats['DATETIME_FORMAT'] = 'N j, Y, P'; On Oct 17, 10:13 pm, timc3 <t...@timc3.com> wrote: > I am using jsi18n for trying to internationalize some Javascript and > its work fine. > > But I am wondering how to translate the datetime format used (based on > PH

Re: "No module named copycompat" error

2010-10-19 Thread timc3
>From a python prompt can you do: from django.utils import copycompat If not, Django might not be imported properly. Also check your PYTHONPATH. On Oct 18, 10:57 pm, mathphreak wrote: > I just upgraded my computer to Ubuntu 10.10, and now running "python > manage.py

Re: Newbie question: How should I structure my very simple project / app?

2010-10-19 Thread timc3
Take a look at: http://lincolnloop.com/django-best-practices/projects/layout.html After you have done the tutorials and stuff. Tim. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Passing file to .net web service

2010-10-19 Thread timc3
Well are you doing that in a page request? Is it timing out? Also if you are doing this with large files its going to eat memory and processing power like you couldn't believe. I would hand this off to another service or daemon, or in my case Celery to do the work. On Oct 19, 10:58 am, Pradnya

jsi18n date and time formating

2010-10-17 Thread timc3
I am using jsi18n for trying to internationalize some Javascript and its work fine. But I am wondering how to translate the datetime format used (based on PHP's date) to a format that Javascript can parse? Thanks -- You received this message because you are subscribed to the Google Groups

Re: URL reverse failed for urlencoded string

2010-02-03 Thread timc3
Then it doesn't match the plus sign. I guess I need to put something in my regex to match that as well? -- 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

Re: URL reverse failed for urlencoded string

2010-02-02 Thread timc3
Well the space was still an issue it seems. I have the following urlconf: url(r'^group_view/(?P[-\w\s]+)/$', 'mysite.views.vs_group_view', name="group_view"), Which matches the whitespace but my URL reverse match still breaks. Any ideas? -- You received this message because you are

Re: URL reverse failed for urlencoded string

2010-02-02 Thread timc3
To answer my own question I think this has more to do with matching a URL that has a string in it to my urls.py. So this should really be about creating the correct entry in my urls to match spaces.. -- You received this message because you are subscribed to the Google Groups "Django users"

Re: any suggestion about how to build Continuous testing for django project?

2010-02-02 Thread timc3
Or you could try BuildBot. -- 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-users+unsubscr...@googlegroups.com. For more

URL reverse failed for urlencoded string

2010-02-02 Thread timc3
I am working with an external REST Provider whose GUIDs might have spaces, plus signs and a few other characters in (I can't change this). In my template I use the following, which normally works except when their are encoded characters in the string: {% url group_view group.groupName|urlencode

Re: Strange widget and form problem

2009-05-11 Thread timc3
> [snip] > > "Just updated to trunk" doesn't actually tell us what level you are at.  I > know there was very recently (within the last couple of hours) a fix made > for a recent bug introduced in upload file handling.  I do not not if you > are running with that fix or not. > > So first, make

Strange widget and form problem

2009-05-11 Thread timc3
I have just updated to trunk and now I get a problem uploading files into a filefield so I did an interactive session in shellplus and got the following: In [1]: from testsite.media.forms import MediaObjectForm In [2]: d = {u'path': "my test image.png"} In [3]: f = MediaObjectForm(d) In [4]:

Re: Newbie: Trying to apply JS code to Django forms code

2009-03-14 Thread timc3
Checkout the forms documentation for information on how to change what the ModelForms generates: http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index You should be able to change the types of fields and fields names/ids/ class names to then hook into your javascript.

Re: Where do we put our templates?

2009-03-14 Thread timc3
I usually create a template directory in the application directory, and then sub directories underneath that. Helps when you need to start translating I have found. Or you could check out Bradley's GitHub project here: http://github.com/bradleywright/django-layout/tree/master

Re: Subquery has too many columns

2009-03-14 Thread timc3
Well I fixed this by updating to the latest django trunk. --~--~-~--~~~---~--~~ 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

Subquery has too many columns

2009-03-14 Thread timc3
This is a continuation of a thread I started a couple of months ago but didn't have time to investigate more: http://groups.google.com/group/django-users/browse_frm/thread/dc2e49515ddcbf73?hl=en=1 It seems to be some problem with psycopg2 on my Ubuntu production test machines as I am not

Re: Best practise of using custom sql with Stored Procedure

2009-03-14 Thread timc3
> > So is that the list that you are talking about? > > I'm assuming those values corropond tot he fields on the model, any reason > you can't do: > > self.model(**cursor.fetchone()) Just tried to do that but it seems to be returning things as a tuple so I get the error: ModelBase object

Re: Best practise of using custom sql with Stored Procedure

2009-03-10 Thread timc3
Well I tried that: def get_perm(self, *args, **kwargs): from django.db import connection cursor = connection.cursor() cursor.execute(""" SELECT * FROM permfindernew(2, 132); """) result_list = [] for row in

Best practise of using custom sql with Stored Procedure

2009-03-10 Thread timc3
Hi, I have built my models and so forth, but I have the need to check whether the user requesting an instance or set of instances from the database has permission to do so. For this I have a stored procedure (saved procedure) in the database that when I give it a user id, it then returns the

Re: FileField and moving or updating files

2009-02-04 Thread timc3
Thanks for the information, its much appreciated. Currently we are not doing anything that special. We use Nginx as our webserver, with the configuration set to receive large files, then django is then sent the file and we are just using the standard method of multiple_chunks() . Everything on

Re: Wierd FileField behavior

2009-02-02 Thread timc3
Show us the code for your view. But are you sending through the files in the POST each time? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: FileField and moving or updating files

2009-02-02 Thread timc3
So I take it that there is no way of doing this? --~--~-~--~~~---~--~~ 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

FileField and moving or updating files

2009-01-30 Thread timc3
Hi, I have a fairly standard model: class MediaObject(models.Model): """ An instance of a MediaItem """ name = models.CharField(max_length=256) path = models.FileField(_("File"), max_length=256, upload_to='tempUpload/') And thats all well and good, my uploads work and so on. But

Re: subquery has too many columns

2009-01-08 Thread timc3
> > We'll need a bit more information here, since the devil's always in the > details. At a minimum, what is the output of > >         groupmembers.query.as_sql() > > There may be a problem with exclude and nested querysets. I just > realised I haven't explicitly tested those. > > Also, which

subquery has too many columns

2009-01-07 Thread timc3
I updated my django version to revision 9710 today and now I am getting the following error message on screen: Caught an exception while rendering: subquery has too many columns This is the traceback: Original Traceback (most recent call last): File

Re: Custom feed generator

2008-11-14 Thread timc3
To answer my own question: class MediaRSS(Rss201rev2Feed): def root_attributes(self): attrs = super(MediaRSS, self).root_attibutes() attrs['xmlns:media'] = 'http://search.yahoo.com/mrss/' return attrs --~--~-~--~~~---~--~~ You

Re: Custom feed generator

2008-11-14 Thread timc3
Thanks for that! Has got me to at least display a feed: class MediaRSS(Rss201rev2Feed): def root_attibutes(self): attrs = super(MediaRSS, self).root_attibutes() attrs['xmlns:media'] = 'http://search.yahoo.com/mrss/' return attrs def

Re: Custom feed generator

2008-11-14 Thread timc3
> Or explaining what is going wrong. :-) > > Care to give us a few clues as to the problems you're seeing? On the > surface, your class looks fairly much correct. ha ha!! Yes of course this is the message that I am getting: File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/

Custom feed generator

2008-11-14 Thread timc3
Has anyone got an example of a custom feed generator? I am trying to create one and but I don't seem to be overriding the correct methods: class MediaRSS(Rss201rev2Feed): def root_attibutes(self): attrs = super(MediaRSS, self).root_attibutes() attrs['xmlns:media'] =

Re: Returning Queryset that excludes certain results from another queryset.

2008-10-21 Thread timc3
Sounds like it is, will try it out soon. 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

Returning Queryset that excludes certain results from another queryset.

2008-10-20 Thread timc3
So I have a model that looks like this: class GroupsOfUser(models.Model): name = models.CharField(_("Name"), max_length=50) description = models.TextField(_("Description"), blank=True, help_text=_("Optional")) slug = models.SlugField() group_members = models.ManyToManyField(User,

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread timc3
Thanks for the help. Yeah, my terminology is quite often wrong, to much context switching with other things. Unfortunately I am never sure what will go in to that field, just data that's sourced from various types of media, and populated from another system. I do know that it will almost always

Getting lists/dictionaries out of the database

2008-10-17 Thread timc3
I am having a problem with getting lists/dictionaries out of the database. If I have for instance this in a field of my database: [['Image format', 'JPEG'], ['Image mode', 'RGB'], ['Image size', '1440x900'], ['Compression', '21.0 times']] And I call it from django, I would get the following

Re: New Comments: Bad Magic Number Error

2008-09-10 Thread timc3
Perhaps a note for the future but what about keeping the old comments system, and having the new as a separate contrib app? Then we have the choice whether to stay or migrate. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: i18N with templates in separate directory

2008-09-10 Thread timc3
Never really looked in manage.py but I did after my question, I see it just hooks in to django and doesn't really do much itself - so it doesn't need upgrading. I got fed up of trying to get this to work so I moved my templates directory so I have the following structure. code/ -mysite/

Re: i18N with templates in separate directory

2008-09-09 Thread timc3
> Shouldn't you run it from the mysite/ directory? Even further, now that I think > about it, you should can simplify things by simply manually > creating the mysite/locale directory  and then doing > > mysite $ python manage.py makemesages -l se > > (just tested it and it works) It works for

Re: i18N with templates in separate directory

2008-09-08 Thread timc3
> I'd say that for being able to scan you project's locale/ subdir > (althouth this isn´t obvious from the docs) and the dirs listed in > LOCALE_PATHS you need specify the Python module path of > your settings file with the --settings command line switch > as explained in: > >

Re: Processing multiple forms in same page

2008-08-25 Thread timc3
Well then you just test to see what fields are pulled back, but its fine, its possible. I am doing it for a forum. On Aug 24, 2:51 am, Rodolfo <[EMAIL PROTECTED]> wrote: > Just for curiosity, why would one have two forms in a single page? > I don't think it is possible to submit the two in a

Re: list_filter for my own views

2008-08-24 Thread timc3
the pagination. On Aug 23, 8:44 pm, timc3 <[EMAIL PROTECTED]> wrote: > On quite a few pages I am using the standard generic views, mostly > wrapped, but not always. > > Anyway I would like to use a list_filter on my own views, much like > the admins - filter by date, by boolean o

Re: url problem

2008-08-24 Thread timc3
It looks like you are getting a little confused. For a start you don't match anything for just http://localhost:8000/ (r'^$', 'urus.app.views.main') Don't know whether thats on purpose or not. anyway. > urlpatterns = patterns('', >     # Example: >     # (r'^urus/', include('urus.foo.urls')),

Re: Processing multiple forms in same page

2008-08-23 Thread timc3
In your view you need to send both forms with different names and then in the template access each form. Like so: t = firstForm() p = secondForm() objContext = RequestContext(request, {'firstform': t, 'secondform': p}) return render_to_response('formtemplate.html',

Re: Is it possible to use Django + Postgresql on leopard?

2008-08-23 Thread timc3
Try this: wget http://www.initd.org/pub/software/psycopg/psycopg2-latest.tar.gz tar -xzvf psycopg2-latest.tar.gz cd psycopg2-2.0.7/ python setup.py build sudo python setup.py install This is if the setup.cfg is alright for your Postgres installation, if not you might have to change setup.cfg to

list_filter for my own views

2008-08-23 Thread timc3
On quite a few pages I am using the standard generic views, mostly wrapped, but not always. Anyway I would like to use a list_filter on my own views, much like the admins - filter by date, by boolean or whatever. I can see the long way around of building up a query, though this will probably

URL RegEx problem for oembed

2008-07-25 Thread timc3
I am trying to match the following URL: http://127.0.0.1:8000/services/oembed/?ref=http://127.0.0.1:8000/media/slug/guid/ And the regex that I am using: urlpatterns = patterns('', url(r'^oembed/(?P[-\w]+)//(?[-\w]+)/media/(?P[- \w]+)/(?P[-\w]+)/$', 'brokersite.services.views.mediaoembed'),

Mobile version of a site

2008-06-27 Thread timc3
HI there, I want to produce a version of a site for mobile phones so I will have to serve up different templates, perhaps on a different subdomain. Is there a recommended way to go about this? Do I have to recreate all my views? Thanks in advance.

Re: newforms and views.generic.create_update.create_object

2008-06-26 Thread timc3
Might be a stupid question but how did you apply the patch? On May 12, 5:06 pm, Wes Winham <[EMAIL PROTECTED]> wrote: > I've been using Brian Rosner's patch from that ticket, and it's been > working great for me. I haven't ran in to any bugs so far and it's cut > my view code down by several

ManyToMany Field - is an object in their or not.

2008-06-19 Thread timc3
I have a situation where I want a true or false to whether an object is in a manytomany. For instance, I have my users, and have created (separate to the standard django groups) a groups table called GroupsOfUser with a relationships defined as: group_members = models.ManyToManyField(User,

Re: django-notification management.py not creating notice types.

2008-06-19 Thread timc3
> Renaming models to notification here is not a good idea (see below for > the reason) > > >     def create_notice_types(app, created_models, verbosity, **kwargs): > > > > >     dispatcher.connect(create_notice_types, > > signal=signals.post_syncdb, sender=notification) > > The sender here must

django-notification management.py not creating notice types.

2008-06-18 Thread timc3
I am trying to use django-notification in an application but I am having some problems with it creating notice types. In fact the notification types are for the django-messages application but the management.py file looks correct: from django.dispatch import dispatcher from django.db.models

instance needs to have a primary key value before a many-to-many relationship can be used.

2008-04-02 Thread timc3
I have the following model: class GroupsOfUser(models.Model): name = models.CharField(max_length=50) description = models.TextField(blank=True,help_text="Optional") slug = models.SlugField(prepopulate_from=('name',)) group_members = models.ManyToManyField(User,

Re: Adding additional needed information in to newforms post

2008-04-02 Thread timc3
The final working form: if request.method == 'POST': f = GroupForm(request.POST) if f.is_valid(): newgroup = f.save(commit=False) newgroup.group_owner = request.user newgroup.groupmembers = request.user.id newgroup.groupadmins =

Re: Adding additional needed information in to newforms post

2008-04-01 Thread timc3
On Apr 1, 10:49 pm, "Phil Davis" <[EMAIL PROTECTED]> wrote: > On 01/04/2008, timc3 <[EMAIL PROTECTED]> wrote: Yes I think that you are right, and I actually did that on another form. Trouble is on that I noticed a problem with form.save(commit=False) when

Adding additional needed information in to newforms post

2008-04-01 Thread timc3
Hi, I thought that I could add in some additional information to a form before it gets saved as a new object in the database but the following isn't working: def groupadd(request): if request.method == 'POST': form = GroupForm(request.POST) if form.is_valid():

Multiple attributes fieldtypes

2008-02-18 Thread timc3
I have two model development problems that I was wondering whether they have been solved before. Firstly lets say that I have extended the user model, but I want to be able for a user to store multiple e-mail addresses for themselves.. Is the easiest way to store this in a separate email table,

Re: is not JSON serializable - again

2006-11-06 Thread timc3
Well I got it to work by what you said. Here is my example for those that might come across this thread: if errors or request.POST.has_key('preview'): response_dict = {} datetime_now = datetime.datetime.now() comment = errors and '' or

Re: is not JSON serializable - again

2006-11-06 Thread timc3
I get a pop-up error saying "internal server error" - which my javascript is handling and displaying. The full error in the page returned is: Exception Type: TypeError Exception Value: t: t... is not JSON serializable Exception Location:

is not JSON serializable - again

2006-11-04 Thread timc3
I am trying to send back the free comments form so I can process it with ajax, and I am getting "is not JSON serializable" all the time. I have copied post_free_comment and then I have simply done if errors or request.POST.has_key('preview'): response_dict = {}

Comments not logging in

2006-11-04 Thread timc3
So I thought that I had this fixed, but it appears on testing that the comments system isn't logging me in correctly. I have gone back to using the comments framework not my own view, but still the same problem. When posting a comment, and putting in the username and password I am not logged

comments and freecomments

2006-10-25 Thread timc3
I have successfully managed to integrate the comments system into my Django application and its looking good (with some YUI ajax nonsense to top it off). But one thing that I would like is non-registered, non-logged in users to be able to post a comment. I realise that this is the goal of the

Re: Django comments system and ajax

2006-10-11 Thread timc3
Great, thanks for the help. I was thinking that I would have to take the complete comments system but if I can just define my views then that is excellent. I think I can see how to make it degrade nicely so thats no problem. Thanks again for the help.

Django comments system and ajax

2006-10-10 Thread timc3
So I am building my App and I have got the comments system working as I want for the first round but I would like to utilise ajax to be able to post and update in the page, rather than new pages all the time. I have read though some excellent posts on ajax and django, and understand what is