Re: is it possible to make the |safe template filter conditional on content

2013-10-03 Thread Mike Dewhirst
On 4/10/2013 12:21am, Bill Freeman wrote: You can certainly write a custom filter. And if you do that, you can divvy up your value into footnote links and other, and escape the other parts yourself, returning the result as a safe string. So you mean I detect any non-footnote html in the

Re: Django Simple Captcha - Manually displaying the Captcha field in a template

2013-10-03 Thread mmuk2
Hi Alexander, Although I no longer use captcha on the form in question anymore, I recall that I did eventually get it working by adding something like the following in my html to generate the captcha component: {{ signup_form.captcha.label }} {{ signup_form.captcha }}{{

Re: Have browsers broken post-redirect-get? best practice now?

2013-10-03 Thread David Durham
I think when they hit the browsers back button, the form will have the data they entered previously. When they submit it, since it was already submitted previously, you could just make it an edit action, or do whatever is appropriate given that they are submitting the same form again. I think

Override model field attributes from a ModelForm?

2013-10-03 Thread Storn White
Hi, My custom user model requires unique email addresses, which are the users' identifiers. My user registration modelform works great. If a user tries to register with an email that is already in the system, the form fails to validate and the 'unique' invalid message is displayed back to

Django on Windows server 2008

2013-10-03 Thread Robert Jonathan Šimon
Have someone figure it how can someone deploy Django 1.5 with Python 3.3 on Windows Server 2008 R2? Because i search internet i think 4 months ago, and i didnt found anything working. So How can it be done? -- You received this message because you are subscribed to the Google Groups "Django

Re: Custom Filter: Filter output based on a Python list

2013-10-03 Thread +Emmanuel
Thanks for the update and the code. Been trying to make sense of the code and trying to get it to work. This is my first project so I still have some challenges: - My model contains a field examperiod = models.CharField(max_length = 100) which I need to use to filter. How exactly do I

Re: Django App - Accessing Remote MySQL Database

2013-10-03 Thread Liam Griffin
I have a MySQL server with hundreds of dbs... is there a way to be able to connect to all these without breaking DRY principles? On Friday, 2 August 2013 14:26:23 UTC+1, Christian Schmitt wrote: > > You could use django's inbuild ORM: > https://docs.djangoproject.com/en/dev/topics/db/multi-db/ >

Re: uptodate Account_balance

2013-10-03 Thread C. Kirby
Use signals: https://docs.djangoproject.com/en/dev/topics/signals/ post_save check the amount deposited or withdrawn and update the balance On Thursday, October 3, 2013 9:42:48 AM UTC-5, MAurice wrote: > > Am creating this project in that a client has an account in a > micro-finance and can

Re: how start work in django after installation in ubuntu

2013-10-03 Thread Vibhu Rishi
First of all, i suggest you start working in django in a virtualenv. This helps as you can have your own virtual env for installing additional django modules. if you want to host and check it on the web, i suggest you checkout this page :

Re: Django-cart. How to run method add_to_cart?

2013-10-03 Thread Ricardo Kamada
Hi Leonardo. managed to make the implementation of the cart. not used the card but django django carton. There are the same but they are similar. veleu for help. I'm passing the objects by post. Thanks for the help. Em 02/10/2013 04:10, "Leonardo Giordani" escreveu:

Re: how start work in django after installation in ubuntu

2013-10-03 Thread Nigel Legg
work through the tutorial. Cheers, Nigel 07914 740972 On 3 October 2013 13:28, jasvir sandhu wrote: > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving

Re: archival patterns/mixins?

2013-10-03 Thread Bill Freeman
Use one model with a field to indicate whether or not this is the archival (backup?) version. This could be your original_id field, which might be better represented as a null-able foreign key field on self. Update step: delete any instances whose "original" is this field (the reverse

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Thanks for the help guys, I managed to solve, so I did: * queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* * * *try: * * page = int(request.POST.get('page','1')) * *except ValueError: * * page = 1 * *try:

Re: uptodate Account_balance

2013-10-03 Thread MAurice
Am creating this project in that a client has an account in a micro-finance and can also Take Loans which loan is credited onto this very account. The problem is am trying to find a way of having an Account_balance which will be changing when deposits and withdrawals are made to the account and

Group_by Django list

2013-10-03 Thread Daniel Gómez Rico
I have a django model: class Person(models.Model): Modelo criado com referencia ao modelo remoto """ name = models.CharField(max_length=300) age = models.PositiveIntegerField() born = models.DateField() I want to group all the people by birthday (group by born date). I'm

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
thus still giving the same error -- 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 this group, send email to

Re: Django Pagination

2013-10-03 Thread Roberto López López
On 10/03/2013 04:13 PM, Roberto López López wrote: > *return HttpResponse(json.dumps([players]) , > content_type='application/json')* better without the square brackets *return HttpResponse(json.dumps(players) , content_type='application/json')* -- Roberto López López System Developer

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
doing so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* * * *page = request.GET.get('page')* *try:* *players = paginator.page(page)* *except PageNotAnInteger:* *players = paginator.page(1)* *

Re: is it possible to make the |safe template filter conditional on content

2013-10-03 Thread Bill Freeman
You can certainly write a custom filter. And if you do that, you can divvy up your value into footnote links and other, and escape the other parts yourself, returning the result as a safe string. On Thu, Oct 3, 2013 at 2:55 AM, Mike Dewhirst wrote: > I made a custom

Re: Django Pagination

2013-10-03 Thread Roberto López López
Try this (I have not tried the code myself, but I think that it should work): *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2) page = request.GET.get('page') try: players = paginator.page(page) except

Re: Django Pagination

2013-10-03 Thread Roberto López López
Better to say: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2) page = request.GET.get('page') try: players = paginator.page(page) except PageNotAnInteger: players = paginator.page(1)

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Already got it, I did so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 2)* *return HttpResponse(json.dumps([item.get_json() for item in paginator.object_list]) , content_type='application/json')* But I return all the records ... I should not

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
Already got it, I did so: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 1)* *return HttpResponse(json.dumps([item.get_json() for item in paginator.object_list]) , content_type='application/json')* But I return all the records ... I should not

Re: Django Pagination

2013-10-03 Thread Hélio Miranda
I'm doing this: *queryset = Player.objects.filter(name=namepost)* *paginator = Paginator(queryset, 20)* *return json.dumps([item.get_json() for item in paginator.object_list])* And my Document is thus: http://plnkr.co/edit/FHH2hZh26OiLMKTk2ToO But it gives me the following error:

Re: Django Pagination

2013-10-03 Thread Tom Christie
Hi Hélio, It looks like you're applying pagination to the rendered JSON string itself. You want to be paginating the queryset itself. queryset = Player.objects.filter(name=namepost) paginator = Paginator(queryset, 20) return json.dumps([item.to_dict() for item in

Django Pagination

2013-10-03 Thread Hélio Miranda
Hi guys. I'm here with a problem that does not quite know how to solve. I have this query: result = json.dumps([a.get_json() for a in Player.objects.filter(name=namepost)]) But now I want to return the result with paging, and do not really know how to do ... I've been seeing in the

Re: Have browsers broken post-redirect-get? best practice now?

2013-10-03 Thread graeme
I disagree that breaking the back button is always bad. For example suppose you have a series of forms (i.e. a "wizard"): Page 1) fill in form. On POST creates a new Model() and saves it to the database 2) do stuff to the object (e.g. add inlines, whatever). 3) whatever comes next At stop

how start work in django after installation in ubuntu

2013-10-03 Thread jasvir sandhu
-- 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 this group, send email to django-users@googlegroups.com.

archival patterns/mixins?

2013-10-03 Thread Tim Chase
I've been trying to reduce some code in a new project, and I have a number of objects where I have the main class, and an archival version of the same class, something like def Thing(Model): last_updated = DateTimeField(...) who_updated = ForeignKey(User) field1 = ... field2 =

Re: Beginner to Django

2013-10-03 Thread Mario Gudelj
Hey champ! Watch this video on installation on windaz www.youtube.com/watch?v=rIVwVOpwpsA Then tackle this tutorial https://docs.djangoproject.com/en/dev/intro/tutorial01/ On 3 October 2013 20:20, Manimaran R wrote: > hai everyone!! > > im a beginner to

Re: Django Simple Captcha - Manually displaying the Captcha field in a template

2013-10-03 Thread Alexander Tyapkov
> > Hi Mark, > Interesting if you finally have found some solution or not? -- 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

Re: Best practice for server-generated downloads?

2013-10-03 Thread John McNamara
Hi, Here is an example of using XlsxWriter from SimpleHTTPServer or Django. It probably doesn't do 100% of what you are looking for but it may help anyway. https://xlsxwriter.readthedocs.org/en/latest/example_http_server.html John -- You received this message because you are subscribed

Beginner to Django

2013-10-03 Thread Manimaran R
hai everyone!! im a beginner to django,dont have prior knownledge about django!! Help me step by step,rit frm installation! for ur ref im using windows 7! dont have any open source,so help me with windows process -- You received this message because you are subscribed to the Google Groups

Re: Best practice for server-generated downloads?

2013-10-03 Thread DJ-Tom
I have now created a test view that basically does what I want: def reporting_new(request): output = StringIO.StringIO() book = Workbook(output) sheet = book.add_worksheet('test') sheet.write(0, 0, 'Hello, world!') book.close() # construct response output.seek(0)

Re: Best practice for server-generated downloads?

2013-10-03 Thread DJ-Tom
The report can't be reporduced later on - as the data is constantly changing, so I need to store the result. Storing the data on which the report is based is very complex and would be too expensive regarding storage space just for this purpose. But I also have now found how to use StringIO

gyguptodate Account_balance

2013-10-03 Thread MAurice
Hello everyone was requesting for help on this micro-finance software am developing, needed to make the account balance reflect updated amount/value on the database when deposits/withdraws are made on either the account or loan repayment *class Branch(models.Model):* time_stamp

Re: uptodate Account_balance

2013-10-03 Thread Leonardo Giordani
Maurice, please remember not everyone on this ML knows finance and noone knows your application but you. Moreover, people on ML cannot spend hours trying to figure out what is your problem: sometimes just solving the problem needs a lot of work, so make things easy. You posted your models, but I

uptodate Account_balance

2013-10-03 Thread MAurice
Hello everyone was requesting for help on this micro-finance software am developing, needed to make the account balance reflect updated amount/value on the database when deposits/withdraws are made on either the account or loan repayment *class Branch(models.Model):* time_stamp

Re: Tests not loading initial_data fixtures

2013-10-03 Thread Sam Lai
Ah, turns out all you have to do is specify - fixtures = [ 'initial_data' ] ... in the TestCase and it'll load all the initial_data fixtures from all apps. Still a bit odd that loading initial_data fixtures isn't the default in tests though. On 3 October 2013 16:49, Sam Lai

is it possible to make the |safe template filter conditional on content

2013-10-03 Thread Mike Dewhirst
I made a custom template filter (ref_href) which converts numbered references (like [1], [2] etc) into footnote hyperlinks. It works but requires the |safe filter which is dangerous. To be actually safe I want to *only* use the |safe filter when the data contains a numbered reference. Which I

Tests not loading initial_data fixtures

2013-10-03 Thread Sam Lai
I'm trying to test a Django management command in app X that parses data files and inserts data into models that are located in apps Y and Z. Apps Y and Z have initial_data.json files in them. On running my test however, it seems that my initial_data fixtures are not being loaded. I could specify