Django tutorial - change history 24h time format?

2013-05-23 Thread Pepsodent Cola
Hi, I'm reading Part 2 and this chapter *"Explore the free admin functionality"*of the Django tutorial. https://docs.djangoproject.com/en/1.5/intro/tutorial02/#explore-the-free-admin-functionality I have a question regarding the *"Change history"* part where you can see a screenshot at the end

Re: Django tutorial - change history 24h time format?

2013-05-24 Thread Pepsodent Cola
sday, May 23, 2013 4:14:22 PM UTC+2, vicherot wrote: > > https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-USE_L10N > > > > 2013/5/23 Pepsodent Cola > > >> Hi, >> >> I'm reading Part 2 and this chapter *"Explore the free admin >&

Don't understand how to make 404 custom page work?

2013-06-03 Thread Pepsodent Cola
Hi, I have read and followed to this part of the tutorial, regarding writing my own 404 error page. https://docs.djangoproject.com/en/1.5/intro/tutorial03/#write-a-404-page-not-found-view But I can't make my 404 page work it only shows my custom (500 server error) page when I try it. 1.) I hav

settings.py "DEBUG = False" doesn't work why?

2013-06-12 Thread Pepsodent Cola
Hi I have basically followed each step in Django's tutorial from part 1 to part 6. What confuses me is when I disable DEBUG in settings.py file then no web url works at all anymore. But the admin and public view pages works when DEBUG is enabled. https://docs.djangoproject.com/en/1.5/intro/ C

Re: settings.py "DEBUG = False" doesn't work why?

2013-06-12 Thread Pepsodent Cola
Thanks ayeowch, :D That solved the problem! * * On Wednesday, June 12, 2013 12:03:20 PM UTC+2, Pepsodent Cola wrote: > > Hi I have basically followed each step in Django's tutorial from part 1 to > part 6. What confuses me is when I disable DEBUG in settings.py file then > no

Re: settings.py "DEBUG = False" doesn't work why?

2013-06-13 Thread Pepsodent Cola
howto/error-reporting/ Do you know of any simpler step-by-step Howto tutorials that might teach me how to accomplish this task? On Wednesday, June 12, 2013 12:03:20 PM UTC+2, Pepsodent Cola wrote: > > Hi I have basically followed each step in Django's tutorial from part 1 to > par

Re: settings.py "DEBUG = False" doesn't work why?

2013-06-13 Thread Pepsodent Cola
Maybe it wasn't that difficult after all :) http://www.djangobook.com/en/2.0/chapter12.html - ( Setting Up Error Alerts ) http://www.mangoorange.com/2008/09/15/sending-email-via-gmail-in-django/ On Wednesday, June 12, 2013 12:03:20 PM UTC+2, Pepsodent Cola wrote: > > Hi I hav

Exception Value: Reverse for 'vote' with arguments '('',)' and keyword arguments '{}' not found.

2013-07-02 Thread Pepsodent Cola
Hi, 1.) When following the Django 1.5 poll tutorial everything works ok. Until I try to implement the *"Generic views"* to use less code in the poll, then the poll app breaks. https://docs.djangoproject.com/en/1.5/intro/tutorial04/#use-generic-views-less-code-is-better 2.) When go to this lin

Re: Exception Value: Reverse for 'vote' with arguments '('',)' and keyword arguments '{}' not found.

2013-07-03 Thread Pepsodent Cola
class Poll(models.Model): Will my underscore table naming convention cause problems with *"Generic views"* usage? On Wednesday, July 3, 2013 12:37:50 AM UTC+2, Pepsodent Cola wrote: > > Hi, > > 1.) > When following the Django 1.5 poll tutorial everything works o

Re: Exception Value: Reverse for 'vote' with arguments '('',)' and keyword arguments '{}' not found.

2013-07-03 Thread Pepsodent Cola
I changed everything related to Model "class Citizen_voice" back to "class Poll" and now everything works with "Generic views" usage. Don't understand why my detail.html template will only accept the variable "poll.id"? On Wednesday, July 3,

Re: Exception Value: Reverse for 'vote' with arguments '('',)' and keyword arguments '{}' not found.

2013-07-03 Thread Pepsodent Cola
for 'vote' with arguments '('',)' and keyword arguments '{}' not found. Error during template rendering /mysite/polls/templates/polls/*detail.html*, error at line *5* ... ... 5 ... ... On Wednesday, July 3, 2013 3:51:50 PM UTC+2, ke1g wrot

Re: Exception Value: Reverse for 'vote' with arguments '('',)' and keyword arguments '{}' not found.

2013-07-03 Thread Pepsodent Cola
uot;Generic views". [ Problem solved... ] On Thursday, July 4, 2013 12:25:31 AM UTC+2, Pepsodent Cola wrote: > > 1.) > Well I took the working *"class Poll"* version and changed much into *"class > Polly_bird"* instead to see if the underscore busines

Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Pepsodent Cola
Hi, Can I only have one "get_queryset" for each Viewpage? If I wanted to add another database list on the same Viewpage how would that code look like for my Django *views.py* file? Example: https://docs.djangoproject.com/en/1.5/intro/tutorial04/#amend-views from polls.models import Choice, Poll

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-22 Thread Pepsodent Cola
: > > Hi, you can separate your querysets in get_context_data method. > See: > https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-simple/#django.views.generic.base.ContextMixin.get_context_data > > > 2013/7/22 Pepsodent Cola > > >> Hi, >> >>

Problem with chaining filters

2013-07-23 Thread Pepsodent Cola
*1.* I wrote this to make python shell only list Words that have no translation. >>> Word.objects.filter(translation='') [, , ] *2.* How can I use the above filter result and chain it, so that I can make a new list that displays the field *"articulate"*, from the other table "Pronunciation"?

Re: Problem with chaining filters

2013-07-26 Thread Pepsodent Cola
Thanks Andrew, I will practice more on doing Many-to-one relationships. https://docs.djangoproject.com/en/1.5/topics/db/examples/many_to_one/ On Monday, July 22, 2013 1:45:49 PM UTC+2, Andrew Simpson wrote: > > Perhaps something like this would give you what you need: > Pronunciation.objects.fi

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-26 Thread Pepsodent Cola
s latest_poll_list in the context > filter2 = Word.blah() > filter3 = Word.blah_blah() > context.update({ > "filter2": filter2, > "filter3": filter3 > }) > return context > > Sent from my Windows Phone > -

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-26 Thread Pepsodent Cola
re available. {% endif %} On Friday, July 26, 2013 11:29:54 AM UTC+2, Tom Evans wrote: > > On Fri, Jul 26, 2013 at 9:57 AM, Pepsodent Cola > > > wrote: > > > > I am having trouble understanding what the Debug wants me to fix and how > > to fix

Re: Can I only have one "get_queryset" per Viewpage?

2013-07-27 Thread Pepsodent Cola
Thank you IT-India now I understand what all the programmers are talking about. :) http://agiliq.com/blog/2012/06/understanding-args-and-kwargs/ *[Problem SOLVED]* On Monday, July 22, 2013 11:51:48 AM UTC+2, Pepsodent Cola wrote: > > Hi, > > Can I only have one "get_queryset&q

Exception Value: Could not parse the remainder: '().order_by('-votes')' from 'poll.altword_set.all().order_by('-votes')'

2013-08-07 Thread Pepsodent Cola
Hi, I have some database query ordering problems. 1.) On my webpage I see this output: * Option-1 = 18 votes * Option-2 = 50 votes 2.) *altword_list.html* {% for choice2 in poll.altword_set.all %} {{ choice2.rosword }} - {{ choice2.alt_ros_word }} - {{ choice2.alt_transl_word }} - {{ ch

Re: Exception Value: Could not parse the remainder: '().order_by('-votes')' from 'poll.altword_set.all().order_by('-votes')'

2013-08-07 Thread Pepsodent Cola
I wrote one line wrong at: 4.) >>> *p.altword_set.all().order_by('-votes')* [, ] How do I write the correct syntax for ordering my list? On Wednesday, August 7, 2013 11:59:38 PM UTC+2, Pepsodent Cola wrote: > > Hi, > I have some database query ordering problem

Re: Exception Value: Could not parse the remainder: '().order_by('-votes')' from 'poll.altword_set.all().order_by('-votes')'

2013-08-08 Thread Pepsodent Cola
) votes = models.IntegerField(default=0) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.alt_ros_word #___ On Wednesday, August 7, 2013 11:59:38 P

How can I order my list based on a field in a different table?

2013-08-09 Thread Pepsodent Cola
1.) How can I order my list based on a field in a different table? return Word.objects.filter(direct_transl_word='') The above I want to do something like this where the field ('-votes') is located at table Altword. Nothing happens when I use this though, don't understand why? #

Re: How can I order my list based on a field in a different table?

2013-08-12 Thread Pepsodent Cola
tionships from Django Doc > https://docs.djangoproject.com/en/dev/topics/db/models/#relationships > > On Friday, August 9, 2013 10:04:47 PM UTC+8, Pepsodent Cola wrote: >> >> 1.) >> How can I order my list based on a field in a different table? >> >> return

How do you use dbshell ALTER TABLE correctly?

2013-08-15 Thread Pepsodent Cola
I found this example on a Stack Overflow webpage. But I'm not sure if I did things correctly? $ python manage.py dbshell> ALTER TABLE ADD COLUMN DEFAULT ''; $ python manage.py sqlall navi_polls CREATE TABLE "navi_polls_altword" ( "rosword_id" integer NOT NULL REFERENCES "navi_polls

Re: How do you use dbshell ALTER TABLE correctly?

2013-08-15 Thread Pepsodent Cola
KEY column On Thursday, August 15, 2013 10:30:01 PM UTC+2, Pepsodent Cola wrote: > > I found this example on a Stack Overflow webpage. But I'm not sure if I did > things correctly? > > > $ python manage.py dbshell> ALTER TABLE ADD COLUMN > DEFAULT '';

My poll doesn't work when I start using related_name, help please.

2013-08-16 Thread Pepsodent Cola
### PART A My altword_list template file receives a primary key ID from my Index template file. #___ *altword_list.html* {{ poll.rosword }} {% if error_message %}{{ error_message }}{% endif %} Filter 5 *{% for choice i

Re: My poll doesn't work when I start using related_name, help please.

2013-08-17 Thread Pepsodent Cola
Yay, it worked! Thank you Dr. Roseman. :) *[SOLVED]* * * On Friday, August 16, 2013 4:51:36 PM UTC+2, Daniel Roseman wrote: > > On Friday, 16 August 2013 14:06:38 UTC+1, Pepsodent Cola wrote: > >> ### PART A >> >> My altword_list template file receives a p

Is it possible to have 1-to-Many and 1-to-1 relationships for one specific table?

2013-08-19 Thread Pepsodent Cola
Is it possible to have 1-to-Many and 1-to-1 relationships for one specific table? Because the database doesn't do what I wish for. #___ class Altword(models.Model): #rosword = models.ForeignKey(Word) rosword = m

Re: Is it possible to have 1-to-Many and 1-to-1 relationships for one specific table?

2013-08-20 Thread Pepsodent Cola
direct_transl_word='') #return Altword.objects.filter(word__direct_transl_word='') #___ On Tuesday, August 20, 2013 3:53:09 AM UTC+2, Huu Da Tran wrote: > > On Monday, August 19, 2013 3:03:25 PM UTC-4, Pepsodent Cola wrote: > >> Is it possi

Re: Is it possible to have 1-to-Many and 1-to-1 relationships for one specific table?

2013-08-20 Thread Pepsodent Cola
instances" % type.__name__) AttributeError: Manager isn't accessible via Word instances >>> >>> >>> >>> p.filter(direct_transl_word='') Traceback (most recent call last): File "", line 1, in AttributeError: 'Word' object has no attrib

Implementing Raw SQL in Models problem

2013-08-31 Thread Pepsodent Cola
### PART A Hello, in Python shell I run a Raw SQL and get a One-to-Many list output. $ python manage.py shell Python 2.7.3 (default, Apr 10 2013, 05:13:16) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> >>> >>> from navi_po

Re: dictfetchall(cursor) - What kind of sorcery is this?

2013-09-04 Thread Pepsodent Cola
my "print desc" LOC? models.py , views.py or my html template file? On Wednesday, September 4, 2013 9:55:13 PM UTC+2, Pepsodent Cola wrote: > > I borrowed the dictfetchall(cursor) code directly from Djangoproject.com > and it works with my code. > But what kind of sorcery

dictfetchall(cursor) - What kind of sorcery is this?

2013-09-04 Thread Pepsodent Cola
I borrowed the dictfetchall(cursor) code directly from Djangoproject.com and it works with my code. But what kind of sorcery is this? How can I output the contents of *desc*? I want to see what that data looks like. *desc* = cursor.description Because I can't follow what's going on here.

Exception Value: global name 'dictfetchall2' is not defined

2013-09-08 Thread Pepsodent Cola
I don't understand how to fix this error message? Here is the code that made things break. Exception Value: global name 'dictfetchall2' is not defined #___ def dictfetchall(cursor): "Returns all rows from a curso

Re: Exception Value: global name 'dictfetchall2' is not defined

2013-09-08 Thread Pepsodent Cola
apper instance instead) On Sunday, September 8, 2013 9:54:36 PM UTC+2, Cal Leeming [Simplicity Media Ltd] wrote: > > Try and replace > row = dictfetchall2(cursor) > > With this > row = AltwordManager.dictfetchall2(cursor) > > Cal > > > On Sun, Sep 8, 2013 at

Re: Exception Value: global name 'dictfetchall2' is not defined

2013-09-08 Thread Pepsodent Cola
Hi James, Ok will do! On Sunday, September 8, 2013 9:23:48 PM UTC+2, Pepsodent Cola wrote: > > I don't understand how to fix this error message? Here is the code that > made things break. > > Exception Value: global name 'dict

Re: Exception Value: global name 'dictfetchall2' is not defined

2013-09-08 Thread Pepsodent Cola
r.fetchall() #row = dictfetchall(cursor) row = AltwordManager.dictfetchall2(self, cursor) return row #___ On Sunday, September 8, 2013 11:22:34 PM UTC+2, Pepsodent Cola wrote: > > Hi J

Re: Exception Value: global name 'dictfetchall2' is not defined

2013-09-09 Thread Pepsodent Cola
method. > > To be honest though, that method should be a standalone function, not a > method (as James said, you need to re-think your approach!) > > Cal > > > On Sun, Sep 8, 2013 at 9:25 PM, Pepsodent Cola > > > wrote: > >> Hi

How do I output a variable from Models.py to Detail.html?

2013-09-09 Thread Pepsodent Cola
This is my Models code and I want to output the contents of variable * blackbox* to my screen. 1.) Do I need to write some code in Views.py to transfer my variable "blackbox" from Models to Views to Detail.html? 2.) Or can I access my variable "blackbox" directly from Detail.html? #___

Re: How do I output a variable from Models.py to Detail.html?

2013-09-10 Thread Pepsodent Cola
Affirmative! On Monday, September 9, 2013 11:42:53 AM UTC+2, Daniel Roseman wrote: > > On Monday, 9 September 2013 10:24:54 UTC+1, Pepsodent Cola wrote: > >> This is my Models code and I want to output the contents of variable * >> blackbox* to my screen. >> >>

def altword_list(self, request, word_id):

2013-10-14 Thread Pepsodent Cola
Hi, I got some help by somebody on #django IRC. They gave me this code snippet to fix my problem. But I'm having problems incorporating that code into my Class file because Template file says "No list is available" when I try to access the list variable. What am I doing wrong? # Filter 8

Re: def altword_list(self, request, word_id):

2013-10-15 Thread Pepsodent Cola
ransl_word }} - {{ choice.articulate }} = {{ choice.votes }} votes{% endfor %} On Tue, Oct 15, 2013 at 8:30 AM, Leonardo Giordani < giordani.leona...@gmail.com> wrote: > Can you check the code you posted? The get_query() function is empty so > this code, as posted, can not run

Re: def altword_list(self, request, word_id):

2013-10-16 Thread Pepsodent Cola
o > with the get_queryset() method. > > Try and let me know if something starts to work. Feel free to ask further > if the matter is not clear. > > Cheers, > > Leo > > > Leonardo Giordani > Author of The Digital Cat <http://lgiordani.github.com> > My p

Re: HOWTO: Create a ManyToMany Relationship?

2013-10-22 Thread Pepsodent Cola
I'm a beginner so I can only answer your first question. The below link has helped me with 1:M and N:M relationship experiments. Can someone point me to where this is explained in the docs (1.6)? https://docs.djangoproject.com/en/1.6/topics/db/examples/ On Tuesday, October 22, 2013 11:59:

Re: def altword_list(self, request, word_id):

2013-10-23 Thread Pepsodent Cola
Hi Leo, I changed everything that you suggested and things are working perfect. Thank you!!! :) *[Solved]* On Tuesday, October 15, 2013 3:45:36 AM UTC+2, Pepsodent Cola wrote: > > Hi, > > I got some help by somebody on #django IRC. They gave me this code > snippet to fix m

Re: Django Tutorials

2013-10-26 Thread Pepsodent Cola
I just glanced at the page. My first experience was that the typography was very unpleasant for my eyes. So I wouldn't spend much time there reading compared to this page. https://docs.djangoproject.com/en/1.6/intro/tutorial01/ Maybe make the text typography easier to see and read? On Satu

AssertionError: Lists differ: [] != ['']

2013-10-26 Thread Pepsodent Cola
== FAIL: test_index_view_with_a_past_poll (navi_polls.tests.PollViewTests) -- Traceback (most recent call last): File "/home/linux/Django/navi/navi_polls/tests.p

What's the difference between assertIn and assertContains?

2013-10-28 Thread Pepsodent Cola
# List word def test_VIEW_Index_WORD_List_word(self): w = self.create_word() url = reverse('navi_polls:index') resp = self.client.get(url) self.assertEqual(resp.status_code, 200) *self.assertIn*(w.rosword, resp.content) # What's the difference betwee

Re: Digging up Django class-based views - 1

2013-10-28 Thread Pepsodent Cola
Thanks Leo! I started out learning Django from the 1.5 tutorial which introduced CBVs but it made parts of the code inconsistent which further confused me as a newbie. Having to keep track of all the new MVC concepts at the same time was confusing for me. On Monday, October 28, 2013 9:01:4

Re: Django Tutorials

2013-11-04 Thread Pepsodent Cola
Hi Jasvir, Now your website looks more 2010 than 1990. It looks fresh and is more pleasant for the eyes for lengthy reading compared to your first website. I might actually learn a few tricks or two when you have completed the tutorials in the future. The only thing I'm missing now is some sort

How can I use {% for ROW in LIST %} within

2013-11-12 Thread Pepsodent Cola
How can I use *{% for ROW in LIST %}* within ** tag? The code I refer to are lines 21 to 25. http://dpaste.com/1458997/ 1 2 3 4 5 6 7 8 910 11 12 13 1415 16 17 18 1920*21* 22 23 2425 26 27 28 2930 31 32 33 3435 36 37 38 3940 41 42

Re: How can I use {% for ROW in LIST %} within

2013-11-13 Thread Pepsodent Cola
%} [Solved] On Wed, Nov 13, 2013 at 2:42 PM, Daniel Roseman wrote: > On Wednesday, 13 November 2013 00:46:55 UTC, Pepsodent Cola wrote: > >> How can I use *{% for ROW in LIST %}* within *

Unit testing - return HttpResponseRedirect('/accounts/loggedin')

2014-07-04 Thread Pepsodent Cola
Hi coverage has highlighted that I have no unit test for the line, regarding *HttpResponseRedirect('/accounts/loggedin')*. How can I write a test that makes Coverage happy regarding this? views.py def auth_view(request): username = request.POST.get('username', '') password = request.P

Unit testing - self.assertEqual("Break it!", resp.content)

2014-07-06 Thread Pepsodent Cola
When I run this unit test to make it break so it can output a bunch of html data. self.assertEqual("Break it!", *resp.content*) test.py # Reset password no login def test_Reset_no_login(self): self.assertTrue(isinstance(self.user, User)) login = self.client.login(username='captain'

Re: Unit testing - self.assertEqual("Break it!", resp.content)

2014-07-06 Thread Pepsodent Cola
ndblock %} On Monday, July 7, 2014 6:08:20 AM UTC+2, mitesh_django wrote: > > Hi, > > You are trying to compare break it! with the complete HTML > returned. Instead of assertEqual, use assertIn. > > self.assertIn("Break it!", resp.co

Did Ubuntu 14.04 or Linux Mint 17 break your Django project files?

2014-07-16 Thread Pepsodent Cola
Hi, I have been learning and developing my first Django project in Linux Mint 14 for about 2 years. This month I moved my Django project files to Linux Mint 17. When I run my unit tests then I get this error, which I don't remember having when I was testing code in Linux Mint 14. *IntegrityErr

Re: Did Ubuntu 14.04 or Linux Mint 17 break your Django project files?

2014-07-16 Thread Pepsodent Cola
Thanks, it was a Django 1.6 issue. Problem solved now. On Wednesday, July 16, 2014 10:53:42 PM UTC+2, Pepsodent Cola wrote: > > Hi, > I have been learning and developing my first Django project in Linux Mint > 14 for about 2 years. This month I moved my Django project files to L

NoReverseMatch at /user/password_change/

2014-07-18 Thread Pepsodent Cola
Hi, I transferred my project files from Django 1.5 to 1.6. Which means I have to fix things that worked before. When I use the default url to change passwords then things looks ok. http://127.0.0.1:8000/admin/password_change/ But when I use my customized change passwords page - which is a copy

Re: NoReverseMatch at /user/password_change/

2014-07-18 Thread Pepsodent Cola
I think it got fixed simply by naming the url. No more complaints from Django 1.6. :) url(r'^user/password_change/done/$', 'django.contrib.auth.views.password_change_done', name="password_change_done"), # v.2 On Friday, July 18, 2014 1:22:59

Image upload problem with UserProfile and my form

2014-08-01 Thread Pepsodent Cola
Hi, I have problems displaying my avatar image which I have uploaded from my forms page. The browser source code seem to say that it cannot find the correct path to my uploaded image file. Which file or files do I need to fix? Profilehttp://127.0.0.1:8000/accounts/profile/>" method="p

Re: Image upload problem with UserProfile and my form

2014-08-03 Thread Pepsodent Cola
Hi, No luck the image still points to the wrong location. There was a link however when clicked it says this. Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000*/accounts/profile/* 1406912993_56_tumblr_m5xo9h5X3E1qgfdhto1_500.gif I'm suspecting it's how my url confs ar

Re: How to test django app

2013-11-20 Thread Pepsodent Cola
I'm interested in this topic too. On Wednesday, November 20, 2013 6:22:04 AM UTC+1, Harjot Mann wrote: > > To test my django app I got unittest module in Django but what I am > notiing that it needs to create tests for the functions in views.py > file. So I need to do lot of coding. Is there a

Re: How can I forloop this count() in my template code?

2013-11-20 Thread Pepsodent Cola
Thanks Tom it worked! :) On Wednesday, November 20, 2013 12:18:23 PM UTC+1, Pepsodent Cola wrote: > > How can I forloop this count() in my template code? > > * I have attached my project files that you might run and see for > yourselves. > * I have attached a screenshot of the

Re: How do I use mathematical calculations on my forloop Article/Publication list?

2013-11-21 Thread Pepsodent Cola
@James Now I understand what you mean. :) I will work on this some more tonight. On Wednesday, November 20, 2013 10:29:24 PM UTC+1, Pepsodent Cola wrote: > > 1.) > How do I use mathematical calculations on my forloop Article/Publication > list? > > * I have attached a s

Re: How do I use mathematical calculations on my forloop Article/Publication list?

2013-11-23 Thread Pepsodent Cola
%} {{ row.id }} {{ row.headline }} {{ row.num_publications }} ({{ row.num_publications }} / {{ total_publicists }}) = {{ publicists_coverage }}x % {% endfor %} {% else %} No Articles or Ziplist are available. {% endif %} On Wednesday, Novem

Re: How do I use mathematical calculations on my forloop Article/Publication list?

2013-11-24 Thread Pepsodent Cola
On Wednesday, November 20, 2013 10:29:24 PM UTC+1, Pepsodent Cola wrote: > > 1.) > How do I use mathematical calculations on my forloop Article/Publication > list? > > * I have attached a screenshot with the table field that I'm working on > *"Publicists > co

UnboundLocalError - How do I convert my pandas DataFrame into a list that Django can work with?

2014-05-31 Thread Pepsodent Cola
Exception Type: UnboundLocalError Exception Value: local variable 'list' referenced before assignment Hi, I'm trying to convert my pandas DataFrame into a simple list in Views.py and send it to template. But Django complains and I don't know how to make it happy. Because when I do *"globa

Re: UnboundLocalError - How do I convert my pandas DataFrame into a list that Django can work with?

2014-06-01 Thread Pepsodent Cola
Never mind it seems using a tuple instead of a list solved my problem. subset = df[[0, 1, 2, 'FRACTION']] tuples = [tuple(x) for x in subset.values] On Saturday, May 31, 2014 8:15:16 PM UTC+2, Pepsodent Cola wrote: > > Exception Type: UnboundLocalError Exception V

Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Pepsodent Cola
Hi, I want to transform my *articles_list5* list comprehension back to a traditional looping construct to make things easier to read. The articles_list5 returns a list of tuples. But when I try to do the same using traditional looping in *articles_list6* then I just get one long list from everyt

Re: Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Pepsodent Cola
only know of append but not sure how to work with it in this situation. On Sunday, June 1, 2014 2:52:33 PM UTC+2, Masklinn wrote: > > > On 2014-06-01, at 14:29 , Pepsodent Cola > wrote: > > > Hi, I want to transform my articles_list5 list comprehension back to a > tradi

Unit testing - self.assertEqual(login, True)

2014-07-03 Thread Pepsodent Cola
I want to run a unit test for a user logging in but I get error. What am I doing wrong? from django.test import TestCase from userprofile.models import UserProfile from django.contrib.auth.models import User class UserProfileTest(TestCase): # User factory method def create_user(self, u

Re: Unit testing - self.assertEqual(login, True)

2014-07-03 Thread Pepsodent Cola
login = self.client.login(username='joe', password='joe') self.assertEqual(login, True) On Thursday, July 3, 2014 2:57:24 PM UTC+2, Amim Knabben wrote: > > duplicated question > > https://groups.google.com/forum/#!topic/django-users/I4wmYKNMNn8 > > &g