Re: weird error with MS Excel 2010 exports
hi gabe - response = render_to_response('reports/trackingdump.html',{'trs':trs,}) filename='trackingdump.xls' response['Content-Disposition'] = 'attachment; filename=' + filename response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-8' that's how we're dumping it to excel... it works fine in open office and non ms 2010 versions of excel. On 05/20/2011 08:17 PM, Gabriel Gunderson wrote: On Thu, May 19, 2011 at 1:44 PM, Bobby Robertswrote: hi. Regardless of how we try to export from a view into an excel file, we get a weird msgbox reading: "The file you are trying to open, 'filenamehere.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before openin gthe file. Do you want to open the file now?" YES NO HELP" What are you doing with your mime types? Gabe -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: /admin weirdness
admin models are registered in models.py for each app. Some people say to use an admin.py file but I've never had to do that before. currently using: Django 1.2.3 (mod_wsgi 3.2/Python 2.6) and hosting at webfaction There's nothing special about the model view. Here's one of them: from datetime import datetime from Client.models import Record as CRecord class Record (models.Model): id = models.AutoField (primary_key=True) title = models.CharField (max_length=128, blank=False) date = models.BigIntegerField (blank=False) client_id = models.ForeignKey(CRecord,db_index=True, blank=False) specialEventDate = models.IntegerField (blank=False) comments = models.TextField (blank=False) al_number = models.CharField (max_length=128, blank=False) lastOpened = models.BigIntegerField (blank=False) whenSubmitted = models.BigIntegerField (blank=False) source = models.CharField (max_length=255, blank=False) class RecordAdmin(admin.ModelAdmin): def Client_Firstname(self, obj): return obj.client_id.firstName def Client_Lastname(self, obj): return obj.client_id.lastName def OrderDate(self, obj): return datetime.fromtimestamp(obj.date) def DateSubmitted(self, obj): return datetime.fromtimestamp(obj.whenSubmitted) list_display = ('id','Client_Firstname','Client_Lastname','client_id','OrderDate','DateSubmitted') search_fields = ['client_id__firstName','client_id__lastName','client_id__id','title','status','comments','source'] admin.site.register(Record,RecordAdmin) any ideas? On 03/17/2011 03:50 PM, Casey Greene wrote: Where are you registering your models for the admin site and what does that code look like? Casey On 03/17/2011 03:14 PM, chris hendrix wrote: yeah the urls file looks fine... it only happens randomly but seems tied to DEBUG=False for some reason... not sure why that would make a difference. On 03/17/2011 03:09 PM, werefr0g wrote: Hi Bobby, Maybe some mistake on your url.py, for example if you have an app named "app" and a model named "model", you'll try to get this url to add a new "model" /admin/app/model/add/ Usually, you'll write your urls.py like this: (r'^app/', include('app.urls')), (r'^admin/', include(admin.site.urls)), If you forget the "^" before app/, the url for adding a new model will match the regex 'app/', and the admin will be shorcut, Just a guess against the material you brought ;) Regards, -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: /admin weirdness
yeah the urls file looks fine... it only happens randomly but seems tied to DEBUG=False for some reason... not sure why that would make a difference. On 03/17/2011 03:09 PM, werefr0g wrote: Hi Bobby, Maybe some mistake on your url.py, for example if you have an app named "app" and a model named "model", you'll try to get this url to add a new "model" /admin/app/model/add/ Usually, you'll write your urls.py like this: (r'^app/', include('app.urls')), (r'^admin/', include(admin.site.urls)), If you forget the "^" before app/, the url for adding a new model will match the regex 'app/', and the admin will be shorcut, Just a guess against the material you brought ;) Regards, -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'
yeah we've followed all the instructions On 03/10/2011 08:00 AM, pols wrote: try re-installing thumbnail easy_install sorl-thumbnail==3.2.5 -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Satchmo Error - Invalid block tag: 'thumbnail', expected 'else' or 'endif'
both of these are done and we're still getting the error. On 03/10/2011 04:32 AM, pols wrote: Check in settings.py installed apps for the entry 'satchmo_utils.thumbnail', If not istalled add this.If you are using new version you may need to add {% endthumbnail %} in the templates before closing endif -- 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 group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: sql query: how to
yeah i was looking at something like that... actually let me correct what i'm needing to do: select year(fieldname) as pubyear from table order by year(fieldname) asc On 09/27/2010 01:15 AM, akaariai wrote: The most efficient? Exactly that using raw SQL. I think something along the following will also work: Foo.objects.only('fieldname').value_list().distinct().order_by('fieldname'). - Anssi On Sep 27, 5:49 am, Bobby Robertswrote: what is the most efficient way to do the following sql command in django? select distinct fieldname from table order by fieldname -- 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 options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: project management app
yeah i couldn't get it installed either. I'm wondering if the project was abandoned or something. I don't have time to contribute anything in regard to programming at the moment due to starting up a web design firm. However, i'd love to help you flesh out ideas or be a beta tester for you... keep me posted! chris On 08/17/2010 04:35 PM, tiemonster wrote: I was unable to get the code working. I'm developing a project management application for Django if you're interested in contributing. On Aug 16, 2:27 pm, Bobby Robertswrote: hi all. I've foundhttp://code.google.com/p/django-project-management/out there as a project management app but have yet to install it and see what all it can do. Has anyone installed this and do you have an opinion on it? Is there anything else out there for project management? -- 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 options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Hostmonster shared hosting and django tinymce
ok thanks for pointing me in the right direction. doesn't sound too hard. On Wed, Mar 17, 2010 at 8:59 AM, Omer Barlaswrote: > tchendrix @ 17-03-2010 14:31: > > do you by chance have instructions on how to get that installed with >> django so it works properly? They don't say anything in their install >> docs about what javascript to call. >> > > you don't install it over django. put the javascript files in your /media > folder, and load the javascript in your template, that's it. If you can't > solve it, I can give you a step-by-step in an available time. > > regards. > > > -- > Omer Barlas > omer.bar...@gmail.com > > -- > 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 options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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 options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: sending data back to template out of a function
Hi Em - I'm not really specifying anything about type @ the moment.. .i'm just trying to figure out how to pass stuff back to the template (ie stuff that's NOT form validation related) BR On Fri, Jun 6, 2008 at 10:40 AM, Emily Rodgers <[EMAIL PROTECTED]> wrote: > > I can't see anything work in your code (but there could be something I > haven't spotted!!). > > My instinct would be to ensure that zipcode is a string. What did you do to > check that the zipcode is being passed in? > > Em > > > -Original Message- > > From: django-users@googlegroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts > > Sent: 06 June 2008 15:31 > > To: Django users > > Subject: sending data back to template out of a function > > > > > > Hi all - > > > > Thanks for your continued support as I find my Django legs. > > > > on my form submission, i send to a view that checks for > > validation and for now all i want to do is send the data that > > was entered right back and show it to the user, but not in > > the form field. I'm breaking my code out into two functions, > > one that does the form validation and one that does the > > return. The reason is that I will be querying UPS > > information and just want a separate function to do that... > > the function passing back to the template is as such: > > > > > > def return_ziplookup(zipcode): > > zipquery = zipcode > > return render_to_response("upsratelookup.html", > > {'zipquery':zipquery}) > > > > I have confirmed in fact that zipcode is getting passed in fine. > > > > > > In my template I have this: > > > > {% if zipquery %} > > Now Showing UPS Rates for zipcode {{ zipquery|escape }} > > {% else %} > > NO ZIPCODE RESULTS FOUND > > {% endif %} > > > > > > the template, on form submission always shows NO ZIPCODE > > RESULTS FOUND. Do you see anything i'm doing wrong? > > > > Thanks for helping me learn. > > > > BR > > > > > > > > > > > > > > > > > --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: {{ media_url }}
hi Aaron - my template includes this link to the css my view is: from django import http from forms import ziplookup from django.shortcuts import get_object_or_404, render_to_response from django.template import RequestContext from django.template import Context, Template def process_ziplookup(request): if request.method=='POST': form = ziplookup(request.POST) if form.is_valid(): zipcode=request.POST.get('zipcode','') return_ziplookup(zipcode) else: form = ziplookup() return render_to_response ("upsratelookup.html",{'form':form}) def return_ziplookup(zipcode): zip=zipcode #assert False, zip return render_to_response("upsratelookup.html",{'zipcode':zip}) thanks in advance for any help BR On Thu, Jun 5, 2008 at 5:20 PM, Aaron Fay <[EMAIL PROTECTED]> wrote: > > Hi Bobby, > > If you are referring to the media url that should be available via the > context processor, then the variable in your template should be: > {{ MEDIA_URL }} > > Unless you specifically are defining 'media_url' in your view. > > Hth, > Aaron > > Bobby Roberts wrote: > > i've got two templates in the same directory. My css works fine on > > one template but not the other. My link to the css is > > > > > > > > Can you think of any reason it would work fine for one template and > > not the other when the templates are in the same dir? > > > > > > > > BR > > > > > > > > > > > --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: {{ media_url }}
Hi andrew. I've got the from django.template import Context, Template line at the top of the view. How do i pass the media template contact processor to the template? BR On Thu, Jun 5, 2008 at 4:20 PM, Andrew Ingram <[EMAIL PROTECTED]> wrote: > > Chances are that one of the views isn't passing the media template > context processor to the template. > > = Andrew > > Bobby Roberts wrote: > > i've got two templates in the same directory. My css works fine on > > one template but not the other. My link to the css is > > > > > > > > Can you think of any reason it would work fine for one template and > > not the other when the templates are in the same dir? > > > > > > > > BR > > > > --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: forms - WTF
Hi Em - Thanks for that... i think it's helping me understand. I've got the form to where it submits now and it makes sense. Now i just have to figure out how to do something with the form. until later Thanks again! BR On Thu, Jun 5, 2008 at 12:12 PM, Emily Rodgers <[EMAIL PROTECTED]> wrote: > ah. Right we need to see the view func then ;) as_table is a method of a > form class. You need to call it on an instance of the form object. > > def myFormFunc(request): > title = 'This is My Form' > if request.method == 'POST': > foo = MyForm(request.POST) # foo is now an instance of MyForm > populated by the post data > if foo.is_valid(): > foo.save() > return HttpResponseRedirect('/yourpath/') > else: > foo = MyForm() # foo is now an instance of MyForm > return render_to_response('template.html', {'foo': foo, 'title': > title}) > > > then in your template you can put > > {{ foo.as_table }} > > does this make it clearer where foo/form comes from? It is just the > variable name you define in the context (the dict that is the second > parameter for the render_to_response function) > > > What I did (when it was only displaying my submit button and no form) was > forget to put () on MyForm(). > > Hope this helps. > > Em > > PS if you need to add some (but not all) fields of a model to a form, and > then do some data munging to fill in some of the other required fields, do > shout if you get stuck - this took me a while to figure out!! > > ------ > *From:* django-users@googlegroups.com [mailto: > [EMAIL PROTECTED] *On Behalf Of *chris hendrix > *Sent:* 05 June 2008 16:59 > *To:* django-users@googlegroups.com > *Subject:* Re: forms - WTF > > Hi Em - > > I'm taking baby steps at the moment and simply don't understand how the > form.as_table works... ie when i put that in the template (see my template > below), how does it know which form to show? > > > > BR > > On Thu, Jun 5, 2008 at 11:50 AM, Emily Rodgers <[EMAIL PROTECTED]> > wrote: > >> >> Hi, >> >> It seems familiar to an issue I had last week. >> >> Can we see the function in your views file? I am guessing that you need >> to instantiate your ziplookup object or something (I think this is what >> I did wrong). Try changing {{ form.as_table }} to {{ form }}, just to >> see what it prints... >> >> I could be worng (I taught myself to code so have plenty of bad >> habits!!), but I think the convention when defining classes is to use >> CamelCase: http://en.wikipedia.org/wiki/CamelCase for the class name - >> it helps to differentiate between function calls and object >> instantiations when reading your code. >> >> Em :) >> >> PS python rocks. >> >> > -Original Message- >> > From: django-users@googlegroups.com >> > [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts >> > Sent: 05 June 2008 16:36 >> > To: Django users >> > Subject: forms - WTF >> > >> > >> > hey - >> > >> > I'm new to Django so bear with me and thank you in advance >> > for any help you can lend. I can't seem to get my hands >> > around the model/form/ view/template thing. I LOVE the idea >> > but you have to understand i'm a MS ASP programmer who is >> > switching over to python. >> > >> > Now with that being said here is my understanding in a nutshell: >> > >> > 1. models - show the db table structure which is used by the views. >> > >> > 2. templates - allow you to separate html and code - at >> > least for the most part >> > >> > 3. views - contain the functions which interact with the >> > models and templates to perform some sort of interaction. >> > >> > 4. forms - allow data to be input into the website etc >> > >> > I understand the basics but can't for the life of me figure >> > out how to make it all work together in a land of joy and >> > joyness (ie Charlie the Unicorn vid) >> > >> > I'm building a UPS rate lookup service. I am including my >> > template and form below. >> > >> > when i visit the page below, only the input button shows... >> > no other form elements >> > >> > >> > [template.html] >> > >> > {% extends "ups_rates/ups_lookup_base.html" %} {% load i18n %} >> > >> > {% block content %} >> > >> > >> >{% trans &
Re: forms - WTF
Hi Em - I'm taking baby steps at the moment and simply don't understand how the form.as_table works... ie when i put that in the template (see my template below), how does it know which form to show? BR On Thu, Jun 5, 2008 at 11:50 AM, Emily Rodgers <[EMAIL PROTECTED]> wrote: > > Hi, > > It seems familiar to an issue I had last week. > > Can we see the function in your views file? I am guessing that you need > to instantiate your ziplookup object or something (I think this is what > I did wrong). Try changing {{ form.as_table }} to {{ form }}, just to > see what it prints... > > I could be worng (I taught myself to code so have plenty of bad > habits!!), but I think the convention when defining classes is to use > CamelCase: http://en.wikipedia.org/wiki/CamelCase for the class name - > it helps to differentiate between function calls and object > instantiations when reading your code. > > Em :) > > PS python rocks. > > > -Original Message- > > From: django-users@googlegroups.com > > [mailto:[EMAIL PROTECTED] On Behalf Of Bobby Roberts > > Sent: 05 June 2008 16:36 > > To: Django users > > Subject: forms - WTF > > > > > > hey - > > > > I'm new to Django so bear with me and thank you in advance > > for any help you can lend. I can't seem to get my hands > > around the model/form/ view/template thing. I LOVE the idea > > but you have to understand i'm a MS ASP programmer who is > > switching over to python. > > > > Now with that being said here is my understanding in a nutshell: > > > > 1. models - show the db table structure which is used by the views. > > > > 2. templates - allow you to separate html and code - at > > least for the most part > > > > 3. views - contain the functions which interact with the > > models and templates to perform some sort of interaction. > > > > 4. forms - allow data to be input into the website etc > > > > I understand the basics but can't for the life of me figure > > out how to make it all work together in a land of joy and > > joyness (ie Charlie the Unicorn vid) > > > > I'm building a UPS rate lookup service. I am including my > > template and form below. > > > > when i visit the page below, only the input button shows... > > no other form elements > > > > > > [template.html] > > > > {% extends "ups_rates/ups_lookup_base.html" %} {% load i18n %} > > > > {% block content %} > > > > > >{% trans "Estimate UPS Shipping > > Rates" %} > span> > > > > > > > > {{ form.as_table }} > > > > > > > > > > > > > > > >this is a place holder for my rates table > > > > > > > > > > > > {% trans "* UPS rates presented on this page are > > estimates only based solely on the provided zip-code and not > > your full shipping address. Your final shipping rates will > > be displayed on the payment page when you submit your credit > > card information." %} > > > > > value="Close Window" onClick="myPopup()"> {% endblock %} > > > > > > > > [forms.py] > > > > from django import newforms as forms > > class ziplookup(forms.Form): > > zipcode=forms.CharField(max_length=15, required=True, > > help_text='Please enter your zipcode') > > > > > > > > > > Is there anyone out there who can take me to Candy Mountain > > (another Charlie the Unicorn reference) > > > > > > > > > > > > > > > -- > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > > > > > > --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: forms - WTF
yeah i'm looking at chapter 7 now to try to understand forms On Thu, Jun 5, 2008 at 11:47 AM, Daniel Mahoney <[EMAIL PROTECTED]> wrote: > > Bobby, did you work through the tutorials on the djangoproject web site, > or some of the other Django tutorials available on the web? They can > seem like slow going sometimes, but if you take your time going through > them they can help a LOT! > > Bobby Roberts wrote: > > hey - > > > > I'm new to Django so bear with me and thank you in advance for any > > help you can lend. I can't seem to get my hands around the model/form/ > > view/template thing. I LOVE the idea but you have to understand i'm a > > MS ASP programmer who is switching over to python. > > > Oh, ghod, I am SO sorry :) About the ASP part, not the switching to > Python part. You'll find Python to be a whole new wonderful world. > > > > --~--~-~--~~~---~--~~ 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 group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---