how to prevent different instances with same state

2010-10-09 Thread harryos
I have a model called Tracker that has a User and a url .I need User- url combination to be unique.So I made classTracker(models.Model): url=models.URLField() owner=models.ForeignKey(User) class Meta: unique_together = (("owner", "url"),) Now,I need to create a TrackingUtili

Re: Are AutoField primary keys re-used after deleting an object from the db?

2010-10-09 Thread Russell Keith-Magee
On Sunday, October 10, 2010, Dirk wrote: > If I use > > id = models.AutoField(primary_key=True) > > can I be sure that if an object is removed from the db by calling > its .delete() method, the respective id will not be used for any > subsequent .save() on a new object? > > My application relies o

Re: Are AutoField primary keys re-used after deleting an object from the db?

2010-10-09 Thread Dirk
> Futhermore there is a simple test that you can do: > > Create a new object, delete it. Create a new object and check it's id. Hm, that's not appropriate to prove that the re-use never happens. I also checked the PostgreSQL documentation of its serial type for which is probably used by Django fo

Re: Are AutoField primary keys re-used after deleting an object from the db?

2010-10-09 Thread George Silva
I'm pretty sure that OID is not reused. It's database behavior to control this and my guess is that Django does not use old object ids. Futhermore there is a simple test that you can do: Create a new object, delete it. Create a new object and check it's id. George On Sat, Oct 9, 2010 at 9:51 PM

Re: How to specify NULL as the default of a model field.

2010-10-09 Thread Masklinn
On 2010-10-10, at 00:49 , Tim Diggins wrote: > I would normally guess None, but that won't help in this instance Why not? -- 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 unsu

Are AutoField primary keys re-used after deleting an object from the db?

2010-10-09 Thread Dirk
If I use id = models.AutoField(primary_key=True) can I be sure that if an object is removed from the db by calling its .delete() method, the respective id will not be used for any subsequent .save() on a new object? My application relies on the fact that an object's id is unique over all objects

Re: admin site not working, problem with urls.py?

2010-10-09 Thread binaryjohn
Hi Lisa, The easiest way (I have found) to get the admin media in to your project is to create a symbolic link inside your static media folder to the admin/media subfolders. I believe there are three of them (css,img, js). I hope this link helps http://docs.djangoproject.com/en/dev/howto/deploymen

Re: How to specify NULL as the default of a model field.

2010-10-09 Thread Shawn Milochik
If the field isn't a required field, I don't think South would complain about no default being set. What type of field is it? What version of Django, and what version of South? Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: "strange" permission requirements

2010-10-09 Thread Michael
It's kind of hard to tell what you are trying to do by the description you have, but you can check out my app: https://bitbucket.org/mhall119/django-extauth/wiki/Home It will let you create user roles like "document owner", and then set your specific permissions to the role. Then, in your code, y

Re: trying to get a cache per request

2010-10-09 Thread Doug
Look around for python docs on threading.local, which lets you set a 'global' variable for just that thread. Since a request is only going to happen in a single thread, that lets you have a per-request global that can be used for cache storage. With middleware to set the threading local instance

Re: How to specify NULL as the default of a model field.

2010-10-09 Thread Tim Diggins
Yes I'm setting blank=True and null=True. But, when I migrate using South (I've added this field to an existing model), South complains that the field has no default value... In this instance, it isn't that important, but just wondering how I specify "NULL" in python in future (I would normally gue

Re: Use legacy DB or migrate DB to Django? How?

2010-10-09 Thread Shawn Milochik
If you do a Google search for "Django legacy database" you'll get all the info you need. It's a fairly common topic and it's all been discussed before. If you have any specific questions once you decide whether to migrate, use Django's inspectdb, or sync multiple databases then please ask for de

Use legacy DB or migrate DB to Django? How?

2010-10-09 Thread flit
Hello All wise fellows :) I do have an DB with 300K rows and something as 6 tables. This db is normalized and it is an mysql. Now we are implementing Django and there is a great question. What is the best way to use the data? 1) Use raw sql on mysql from Django? 2) Import all data on Django? s

Re: trying to get a cache per request

2010-10-09 Thread Miguel Araujo
Thanks Doug, In my Django-app where I want to create a cache, I don't have a request parameter and I can not add it because I need to be compatible with a part of the framework itself. I don't need to access that cache in the templates anywhere. I would like that my objects persists only per requ

Re: Django 1.2.3 flatpage tests fail

2010-10-09 Thread Karen Tracey
On Thu, Oct 7, 2010 at 11:56 AM, jamstooks wrote: > I'm running into a weird error when running the tests for my project. > For some reason the flatpage tests seem to be failing because my login > page is issuing a 404. When I `runserver` this url is available, so I > don't understand the discrep

Re: noob question about URLconf

2010-10-09 Thread lyrical
Thanks, I indeed did not run my manage.py file. On Oct 9, 5:35 am, Andi Trînculescu wrote: > You probably didn't run manage.py runserver. > You also need to install your app in settings.py > > On Oct 9, 12:50 am, lyrical wrote: > > > I'm following the Django book but run into a pathing problem (

"strange" permission requirements

2010-10-09 Thread stargazer
It seems I have to implement quite complex permission system and I want to avoid writing many if- statements... Let me describe: There are two types of users in the application. Let say users of type A and B Users of type A (like a authors of a blog) can create let say a Document (could be simila

Re: trying to get a cache per request

2010-10-09 Thread Doug
Why not just stick it on the request object? def myview(request): request.mycache=MyCacheClass() then it's available everywhere the request object is. If you are wanting something that can be used in a template tag without explicitly passing the request object (or your cache object) in, you

trying to get a cache per request

2010-10-09 Thread maraujop
Hi there, I'm working on a Django-app that will benefit from having a per request cache, which means that the cache should reset every time there is a new request or it finishes a response. I don't want to use a middleware approach for this, I would like to create an object that lived within the r

[SOLVED] Re: Multiple Check Boxes - Single Choice w/ CheckboxSelectMultiple?

2010-10-09 Thread NoviceSortOf
Thanks Russ, works like a charm. -- 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 m

Re: Project-wide tests

2010-10-09 Thread diogobaeder
I think I'll use Christoph's aproach, since it won't pollute any of the other apps. Thank you, guys! :-) Diogo On 9 out, 10:40, Christoph wrote: > Hi Diogo, > > I had the same problem (and so did others as I found out). As far as I > am aware, there isn't a decent solution. Roberto's approach

Re: Multiple Check Boxes - Single Choice w/ CheckboxSelectMultiple?

2010-10-09 Thread Russell Keith-Magee
On Sun, Oct 10, 2010 at 12:00 AM, NoviceSortOf wrote: > I'm using the following in a form to allow the user to input choices > on field named frequency. > > sub_freq   = forms.ChoiceField(choices=SUB_FREQ, > widget=forms.CheckboxSelectMultiple) > > This gives me a list of checkboxes and I check al

Multiple Check Boxes - Single Choice w/ CheckboxSelectMultiple?

2010-10-09 Thread NoviceSortOf
I'm using the following in a form to allow the user to input choices on field named frequency. sub_freq = forms.ChoiceField(choices=SUB_FREQ, widget=forms.CheckboxSelectMultiple) This gives me a list of checkboxes and I check all of the checkboxes Is there anyway to limit the enduser to only c

Django.contrib.gis.gdal Questions

2010-10-09 Thread Greg Corradini
I'm wondering if django.contrib.gis.gdal Python wrappers were only meant to implement read functionality of OGR? It seems that way. I don't see any implementation of CreateDatasource in the driver.py class. Is this correct or is there a way to write to shapefiles with these bindings that I'm missin

Re: I can't select day with calendar widget

2010-10-09 Thread Steve Holden
As others have observed, I see the correct dates for holidays I created, including 2010-10-10. regards Steve On 10/9/2010 7:46 AM, Rene Vielma wrote: > Hello > > I've upload the sandbox project whit develop server to > http://200.63.96.245:8000/admin/ > user and p: test > > For you can check

Re: How to specify NULL as the default of a model field.

2010-10-09 Thread Shawn Milochik
What are you trying to accomplish? If you set blank = True and null = True then they'll be null in the database after the migration and if left blank by the user. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, se

Re: I can't select day with calendar widget

2010-10-09 Thread renevie...@gmail.com
On Sat, Oct 9, 2010 at 10:12 AM, Mario wrote: > Rene, > > When you say "the problem happens when I select 2010-10-10  in the > widget , then > 2010-10-09 is set in the field." What do you exactly mean? It looks > like you need to revisit your app/models.py. > > V/r, > > Mario > Hello Mario my mo

Re: I can't select day with calendar widget

2010-10-09 Thread renevie...@gmail.com
On Sat, Oct 9, 2010 at 9:33 AM, Christoph wrote: > Hi Rene, > > I tried to replicate your problem. I selected the 10th of October > 2010, 2010-10-10 is set in the field and I can also safe it as such. > > So, try again and see if the problem is still there. > > Best regards, > Christoph Thank you

Re: I can't select day with calendar widget

2010-10-09 Thread Mario
Rene, When you say "the problem happens when I select 2010-10-10 in the widget , then 2010-10-09 is set in the field." What do you exactly mean? It looks like you need to revisit your app/models.py. V/r, Mario On Oct 7, 6:25 pm, "renevie...@gmail.com" wrote: > Hello. > > I've a problem with t

Re: Project-wide tests

2010-10-09 Thread Christoph
Hi Diogo, I had the same problem (and so did others as I found out). As far as I am aware, there isn't a decent solution. Roberto's approach would work, alternatively I always ended up creating an app "test" in my project where I then write the tests in. Best regards, Christoph On Oct 9, 12:07 a

Re: I can't select day with calendar widget

2010-10-09 Thread Christoph
Hi Rene, I tried to replicate your problem. I selected the 10th of October 2010, 2010-10-10 is set in the field and I can also safe it as such. So, try again and see if the problem is still there. Best regards, Christoph On Oct 9, 12:46 pm, Rene Vielma wrote: > Hello > > I've upload the sandbo

get_absolute_url error with sitemaps

2010-10-09 Thread het.oosten
I am trying to get automatic sitemap generation working with Django 1.2.1, but i think i missed something simple. I get this error: + File "/usr/lib/python2.4/site-packages/django/contrib/sitemaps/ __init__.py", line 47, in __get return attr(obj) File "/usr/lib/python2.4/site-packages

Re: noob question about URLconf

2010-10-09 Thread Andi Trînculescu
it looks like your dev server isn't running. On Oct 9, 12:50 am, lyrical wrote: > I'm following the Django book but run into a pathing problem (I think) > I did exactly what the book said, even copying and pasting the code as > to make sure I didn't make a typo. > > so in the views.py I have > >

Re: noob question about URLconf

2010-10-09 Thread Andi Trînculescu
You probably didn't run manage.py runserver. You also need to install your app in settings.py On Oct 9, 12:50 am, lyrical wrote: > I'm following the Django book but run into a pathing problem (I think) > I did exactly what the book said, even copying and pasting the code as > to make sure I didn'

Re: I can't select day with calendar widget

2010-10-09 Thread Rene Vielma
Hello I've upload the sandbox project whit develop server to http://200.63.96.245:8000/admin/ user and p: test For you can check this problem I hope any comment thanks.. On 7 oct, 18:25, "renevie...@gmail.com" wrote: > Hello. > > I've a problem with the calendar widget. > > I created a sandb

Re: question about django url

2010-10-09 Thread sami nathan
http://local host/wap/di/sub?word=check&type=00&submit=Submit i want to print word "check" and any word given in url pls give sugesstion pls -- 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...@go

How to specify NULL as the default of a model field.

2010-10-09 Thread Tim Diggins
It may seem odd but I want to explicitly specify NULL as the default for a particular field / column. (This is so that South picks up that the default value is null, rather than there being no default specified, which is what happens if you specify "null=True" any thoughts (or it may just be impos

Re: question about django url

2010-10-09 Thread smallfish
like this: http://127.0.0.1:8000/xxx/123243-1-2-3-0/ urls.py (r"^xxx/(\d+)-([0-4])-([0-4])-([0-4])-([0-4])/$", "polls.views.hello"), polls/views.py def hello(request, s1, s2, s3, s4, s5): return HttpResponse("%s - %s - %s - %s - %s" % (s1, s2, s3, s4, s5)) -- blog: http://chenxiaoyu.o