Re: I need help doing a linked lookup in admin

2013-04-29 Thread Richard E. Cooke
I'm getting closer! First I found this note in the Content Types docs that explains why what I was doing does NOT work: https://docs.djangoproject.com/en/1.4/ref/contrib/contenttypes/#django.contrib.contenttypes.generic.GenericForeignKey *Due to the way GenericForeignKey

AttributeError: 'AlumniResponseFormFormSet' object has no attribute 'new_objects'

2013-04-29 Thread Brian Dant
I'm using the Django admin and trying to make some changes to a related object that is mapped as anInlineModelAdmin object. I'm trying to do this using the save_related(self, request, form, formset

Re: Blog writen by django?

2013-04-29 Thread gilberto dos santos alves
mezzanine is spetacular. thanks! ;>). and plug and run. Em segunda-feira, 29 de abril de 2013 00h50min42s UTC-3, Russell Keith-Magee escreveu: > > > Here's a site that lists a whole lot of options: > > https://www.djangopackages.com/grids/g/blogs/ > > DjangoPackages is well worth bookmarking -- i

Re: Little help needed writing models for star-ratings app

2013-04-29 Thread Shawn Milochik
I reiterate: Please read the ORM documentation. That will answer all of your questions. Once you understand how to do queries in the ORM (and which queries are easier than others) then you will know how to design your models so that they'll be easy to work with. As you're reading, make notes about

Re: Little help needed writing models for star-ratings app

2013-04-29 Thread surya
On Monday, April 29, 2013 10:31:34 PM UTC+5:30, Shawn Milochik wrote: > > It looks like you're not looking for a "little help." You're looking for > someone to do the work for you. > > You'll get the best help if you try something, get stuck, and explain what > you tried and what the error is.

Re: Newbie: trying to get an existing project running on a different machine

2013-04-29 Thread Shawn Milochik
Do you have piston installed in the virtualenv where you're trying to test this? Check for any "local settings" on the production server that it may be using but which aren't available through the repository. -- You received this message because you are subscribed to the Google Groups "Django u

Re: Little help needed writing models for star-ratings app

2013-04-29 Thread Shawn Milochik
It looks like you're not looking for a "little help." You're looking for someone to do the work for you. You'll get the best help if you try something, get stuck, and explain what you tried and what the error is. Here is the documentation for using the ORM. This is not a snarky response -- I real

Newbie: trying to get an existing project running on a different machine

2013-04-29 Thread Horst Jäger
Hi folks, I'm a complete newbie to Django and I have to edit a few lines of code in an existing project. Of course I can't to so on the production machine. So I'm trying to migrate the existing project onto a new development server. Django is up and running there and I can create sample proje

Little help needed writing models for star-ratings app

2013-04-29 Thread surya
Here is the story so far class Rating(models.Model): positive_rating = models.FloatField(default=0) negative_rating = models.FloatField(default=0) class Book(models.Model): year_pub = models.IntegerField(max_length=4) category = models.ForeignKey(Category) rating = models.ForeignKey(Rating) hash_

Access request object in a custom template tag

2013-04-29 Thread Ponytech
Hello, I am currently writing a custom template tag and I need to access the request object within the tag code. When using tag helpers (*simple_tag*, *inclusion_tag *and *assignment_tag*) you can register them with an additional takes_context=True parameter that makes the request object availa

Re: handling IntegrityError: Duplicate entry in UserCreationForm

2013-04-29 Thread isachin
hey guys, got the solution: for each field to validate, I wrote a validate function: code snippet: def clean_: try: UserProfile.objects.get(phone_num=self.cleaned_data['']) except UserProfile.DoesNotExist: return self.cleaned_data[""] raise forms.ValidationError(("FIE

Re: Store arbitrary key-value pairs in model?

2013-04-29 Thread Branko Majic
On Mon, 29 Apr 2013 05:58:44 -0700 (PDT) Victor Hooi wrote: > Hi, > > I have a Django application that will need to store arbitraty > > Basically, there are a series of "job scripts" that are submitted by > users and then run. > > Each of these jobs scripts may have an arbitrary number of key-

Re: Using Django and R in a production environment?

2013-04-29 Thread Javier Guerra Giraldez
On Mon, Apr 29, 2013 at 2:13 AM, Derek wrote: > hat no one is actually using R in a production environment themselves (which > is a little surprising to me). well R itself is widely used in production... but the intersection with Django is very small. (after all, if you write your own R analysi

Re: quick problem with str and int

2013-04-29 Thread MikeKJ
I did try that against just the string and got the same error hence the cast to int attempt, when cast to int I am using (r'^json/(?P\d+)/$', '/views/json'), > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Re: Upload csv with utf-8

2013-04-29 Thread Felipe Prenholato
Take a look, can help: https://github.com/chronossc/django-data-importer Felipe 'chronos' Prenholato. Linux User nº 405489 Home page: http://devwithpassion.com | http://chronosbox.org/blog GitHub: http://github.com/chronossc/ | Twitter: http://twitter.com/chronossc 2013/4/29 Hélio Miranda > I

Re: quick problem with str and int

2013-04-29 Thread MikeKJ
Good idea so: In the model added def get_json_reference(self): return "/json/%i/" % int(self.reference) called which does produce the correct url for all in the for loop but still get Exception Type: TypeError at /json/810044/ Exception Value: 'str' object is not callable --

Re: quick problem with str and int

2013-04-29 Thread Shawn Milochik
How about adding a get_absolute_url method to your model? Then you can take care of the logic there, instead of the template. https://docs.djangoproject.com/en/1.5/ref/models/instances/#get-absolute-url Worst-case, you can just do the conversion in your view and assign it as a new property to you

Re: quick problem with str and int

2013-04-29 Thread Addy Yeow
You would want to match this, (?P.*), against a string not integer. On Mon, Apr 29, 2013 at 11:40 PM, MikeKJ wrote: > So unfortunately due to historical reason a numerical reference is set as > a CharField in the model now I want to pass that reference through a url to > json serialise somethi

quick problem with str and int

2013-04-29 Thread MikeKJ
So unfortunately due to historical reason a numerical reference is set as a CharField in the model now I want to pass that reference through a url to json serialise something so .*)/$', '/views/json'), I am not entirely sure where it is complaining about str being uncallable but having cast it

Re: Store arbitrary key-value pairs in model?

2013-04-29 Thread Shawn Milochik
A Django app sometimes benefits from a "No-SQL" database on the side. You could do what you want using a text field and storing JSON or a pickled value, but I advise against it. It's hard to query and de-duplicate. -- You received this message because you are subscribed to the Google Groups "Dja

Store arbitrary key-value pairs in model?

2013-04-29 Thread Victor Hooi
Hi, I have a Django application that will need to store arbitraty Basically, there are a series of "job scripts" that are submitted by users and then run. Each of these jobs scripts may have an arbitrary number of key-value pairs attached to them (for example, output directory, or search term,

Re: Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
I managed to solve the problem like this: rep.GenreType line = ["IdGenre."] decode ("iso-8859-1") thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to djan

Re: django-filetransfers and HttpResponseRedirect

2013-04-29 Thread Venkatraman S
On Mon, Apr 29, 2013 at 3:43 PM, Shawn Milochik wrote: > Use HttpResponseRedirect, as you mention in your subject line. > Question is 'why'? -V -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
The content of my csv is not in utf-8 That's why I want, when I upload the csv and introduce the data and insert it in db utf-8, but do not know how to do this in my code that I put at the beginning -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: Upload csv with utf-8

2013-04-29 Thread Tom Evans
On Mon, Apr 29, 2013 at 12:43 PM, Hélio Miranda wrote: > in my code was trying to do this > rep.GenreType line = ["IdGenre."] decode ("utf-8") > > but it gives me the following error: > 'utf8' codec can not decode byte 0xE9 in position 3: invalid continuation > byte > > Unicode error hint >

Re: Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
in my code was trying to do this rep.GenreType line = ["IdGenre."] decode ("utf-8") but it gives me the following error: 'utf8' codec can not decode byte 0xE9 in position 3: invalid continuation byte Unicode error hint The string That Could not be encoded / decoded was: *Com�dia* -- You

Re: Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
The error I get is this. I can not enter words with accents -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to

Unefficient SQL query while excluding results on QuerySet

2013-04-29 Thread Michael Elovskikh
Hello, I'm trying to figure up if I've found a bug and if anyone has already solved a similar problem: I've got two basic models (I've simplified them to make it easier to understand): class A(models.Model): pass class B(models.Model): name = models.CharField(max_length=15) a = mod

Re: Upload csv with utf-8

2013-04-29 Thread Andrew Boltachev
And if you get an error, can you post complete traceback? 2013/4/29 Hélio Miranda > continued without realizing how in my code I can do this ... > > The error I get is this > strings in documents must be valid UTF-8 > > -- > You received this message because you are subscribed to the Google Gro

Re: Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
continued without realizing how in my code I can do this ... The error I get is this strings in documents must be valid UTF-8 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send

Re: django-filetransfers and HttpResponseRedirect

2013-04-29 Thread Shawn Milochik
Use HttpResponseRedirect, as you mention in your subject line. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post

Re: Upload csv with utf-8

2013-04-29 Thread Andrew Boltachev
Hi! Check this out https://gist.github.com/eightysteele/1174811 In short, value.decode('utf-8') must be used to prepare value, that was read from file, encoded with utf-8 for processing. 2013/4/29 Hélio Miranda > I have a problem that is to read the csv file that contain words with > accents.

Deployment best practices - reasons?

2013-04-29 Thread Victor Hooi
Hi, I'm currently looking at tidying up deployment for a Django app we use internally. There's a couple of things that I know are best-practices, or it's just how I normally deploy Django apps, but I need to come up with strong cases for all of them. As in any organisation, if it ain't broke,

Upload csv with utf-8

2013-04-29 Thread Hélio Miranda
I have a problem that is to read the csv file that contain words with accents. I have the following code in my application, but do not know how by working with utf-8. Someone can help me? Código (Python): def csv_upload(request): if request.method == 'POST': gen = Genre.objects.

Re: [django_tables2] Expected table or queryset, not 'str'.

2013-04-29 Thread Binith Babu
You were correct, it was indeed a version problem. I was using latest django-tables2 in my new python virtual env and I had an older version (of django-tables2) installed as default, and the PYTHONPATH environment variable was pointing to the older version. Problem solved, thanks for the time t

Re: Using Django and R in a production environment?

2013-04-29 Thread Derek
Again, thanks! But it still seems that no one is actually using R in a production environment themselves (which is a little surprising to me). On Wednesday, 24 April 2013 19:52:19 UTC+2, Alex wrote: > > There is another large potential gotcha, R is very memory heavy. > I do think the route of u