Re: Learning Python and Django and should I?? (I have a year of 10 or so hours a week)

2015-08-14 Thread Jonathan Baker
Have you written any Python or Ruby? If so, do you have a preference? Both are high-level languages, and the dominant web framework for each (Django and Rails) are mature and stable. I'd at least read and write some code for each and see if the syntax of the language and the semantics of the

Re: eCommerce Search

2014-12-17 Thread Jonathan Baker
Also, check out: https://github.com/alex/django-filter On Wed, Dec 17, 2014 at 2:11 PM, John Rodkey wrote: > Yes, that is what I'm looking for. I'm new to the Django world and was > curious if there is already a good existing package. I will search for > django faceted

Re: How to connect Django to Cassandra Data base?

2014-05-09 Thread Jonathan Baker
To build upon Babatunde's answer, you can find more information here: https://code.djangoproject.com/wiki/NoSqlSupport On Fri, May 9, 2014 at 12:57 PM, Babatunde Akinyanmi wrote: > You have to search google for a third party cassandra backend app as > Django does not

Re: Registration in 1.8

2014-05-09 Thread Jonathan Baker
With the official Django release at 1.6.4, I wouldn't assume that third party packages are 1.7.x compliant, much less 1.8.x. (actually, I haven't even heard of 1.8 yet, and it's not on https://github.com/django/django/releases). Getting the hang of the ins and outs of 1.7.x is a great idea, but

Re: do I need to run syncdb when I change the default value in a field of a model?

2014-03-14 Thread Jonathan Baker
Does that mean that the default="" functionality is implemented by the ORM, instead of in the database layer? On Fri, Mar 14, 2014 at 5:16 PM, Shawn Milochik wrote: > No, no syncdb required. The default applies to newly-created instances, > not existing ones. > > -- > You

Re: URL Namespaces

2014-03-05 Thread Jonathan Baker
Much like module namespacing, they allow you to group subitems in more logical and descriptive ways while preventing naming collisions. So, if a Django project has a blog, with a list of Posts at /blog/posts/, a sensible url name for that pattern might be "post_list" (and using url names in your

Re: Trouble with Django in production server.

2014-03-01 Thread Jonathan Baker
ar 1, 2014 at 8:11 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote: > >> When you ran the 'syncdb' management command, was 'auth_user' listed in >> the output as a table that was created? >> >> >> On Sat, Mar 1, 2014 at 3:52 PM, Omar Aceve

Re: Trouble with Django in production server.

2014-03-01 Thread Jonathan Baker
When you ran the 'syncdb' management command, was 'auth_user' listed in the output as a table that was created? On Sat, Mar 1, 2014 at 3:52 PM, Omar Acevedo wrote: > Hello people, I'm having an issue in/with Django, which is on a shared > hosting, and I'm using virtualenv and

Re: Django with rabbit (but without async celery) - can be done?

2014-02-25 Thread Jonathan Baker
Could you write a RESTful API in your Django project, and then issue POST requests to that from a middleman script that the mq could communicate with? JDB On Tue, Feb 25, 2014 at 8:28 AM, Alon Nisser wrote: > I need to implement a quite simple Django server that server

Re: Accessing a python function from a blog post stored in the db?

2014-02-25 Thread Jonathan Baker
This sounds like a good fit for an inclusion tag. Since you need a bit of markup around the images for the slider functionality, it'd be nice to keep that markup in a separate template so you could use the image slider in multiple places like, say, a post detail page as well as a dashboard. Then,

Re: API rest for https://docs.djangoproject.com/en/dev/intro/tutorial01/ help

2014-02-20 Thread Jonathan Baker
It appears that you're using the Django Rest Framework, and if that's the case then you need to reference the section on serializer relations: http://www.django-rest-framework.org/api-guide/relations On Thu, Feb 20, 2014 at 3:53 PM, Antonio Villavicencio wrote: > I am trying

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Glad you worked it out. Enjoy the rest of the tutorial! JDB On Thu, Feb 13, 2014 at 1:54 PM, Paul Sermon wrote: > OK thanks for your help. > > I've reviewed through the code, and I had a minor indentation typo that > wasn't helping! > > Anyway, I worked it down to

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Cool, so we're making progress and you're using the test database now. Since you have two tests failing, I'd comment out the 2nd of the two for now and focus on getting the first to pass, and then moving on to the second. Don't try to do too much at once, and do try and understand what each

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
"setup_test_environment() installs a template renderer which will allow us to examine some additional attributes on responses such as response.context that otherwise wouldn't be available. Note

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Are you running your tests on the command line using: $ python manage.py test polls ...or are you trying to run them from a Python shell? It'd be helpful if you could provide the internal link to the area of the page you linked to that you're experiencing the failure at, as well as the output of

Re: Django Tutorial 5 - First Tests

2014-02-12 Thread Jonathan Baker
You're correct in thinking that tests use a test database that is independent of your formally defined project database. Without knowing exactly which Django tutorials you are referring to, I can only assume that perhaps you: 1) Have defined initial_data.json fixtures 2) Have defined other

Re: Could not parse the remainder: '{{variabile}}' from '{{variabile}}'

2014-01-08 Thread Jonathan Baker
When referencing a context variable within an if statement in a template, you don't need to use {{ var }}. Simply use: {% if variabile == "one" %}...{% elif variable == "two" %}...{% else %}...{% endif %}. JDB On Wed, Jan 8, 2014 at 9:33 AM, luca72 wrote: > hello the

Re: How to display different contents when refresh every time.

2013-12-19 Thread Jonathan Baker
I agree with Avraham, and you can easily accomplish this by using .order_by("?") when using the Django ORM (@see https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.order_by ) On Thu, Dec 19, 2013 at 2:08 PM, Avraham Serour wrote: >

Re: Do I need to migrate pre-existing code into Django?

2013-12-17 Thread Jonathan Baker
No, you don't need to migrate your site (although, after using Python and Django you might just want to...). An API should return responses that are generic in format, so any type of client (PHP, C++, Obj-C, etc.) can consume them (without knowing or needing to know what the API is written in).

Re: How to visualize result poll by a Histogram?

2013-12-17 Thread Jonathan Baker
If the histogram is something you'd like to be viewable in a browser, check out D3: http://d3js.org/ If you don't need a browser, then matplotlib could serve your needs: http://matplotlib.org/ JDB On Tue, Dec 17, 2013 at 4:48 AM, Nduwimana Audace wrote: > Hi everyone, >

Re: Get memory-use serverside when rendering a view?

2013-12-12 Thread Jonathan Baker
Django is just Python, after all, so you can use the same approach that you would in "regular python scripts". "when a view is rendered" is a pretty vague description of what you're aiming to profile. If your start point is the request coming in to Django, and your stop point is the rendered

Re: UpdateView and ImageField style

2013-12-12 Thread Jonathan Baker
Welcome to the mailing list. I've never done this myself, but a bit of Googling leads me to believe that you need to define your own UserProfileEdit form class, instead of letting UpdateView automatically create the form for you. This will allow you to use the FileInput widget and avoid the

Re: Writing your first Django app, part 1

2013-11-20 Thread Jonathan Baker
Is "polls" listed in within INSTALLED_APPS of settings.py? If so, does your polls app have an __init__.py file? On Wed, Nov 20, 2013 at 11:39 AM, Larry Barnett wrote: > In the tutorial after I enter: > > python manage.py sql polls > > I get the following error: > >

Re: Django/Web Programming Pattern

2013-11-14 Thread Jonathan Baker
... On Thu, Nov 14, 2013 at 8:04 AM, Timothy W. Cook <t...@mlhim.org> wrote: > Thanks Jonathan. Looks interesting from the FAQ. > I'll give it a shot and see what happens. > > On Thu, Nov 14, 2013 at 12:39 PM, Jonathan Baker > <jonathandavidba...@gmail.com> wrote:

Re: Django/Web Programming Pattern

2013-11-14 Thread Jonathan Baker
This sounds like a good candidate for an async Celery task: http://docs.celeryproject.org/en/latest/index.html On Thu, Nov 14, 2013 at 7:37 AM, Timothy W. Cook wrote: > Well, this isn't likely a Django specific question but since this > project is built in Django, I'd like to

Re: Empty context within template tag render() method after using django.test.client.Client.login() method

2013-09-23 Thread Jonathan Baker
Below are some snippets involved in generating the error. The 'test_get_unauthenticated' works as expected, but 'test_get_ok' fails while rendering the template response and calling the menu tag of django-menu (full module:

Re: custom signup form

2013-09-08 Thread Jonathan Baker
bout not having > password1 and 2 not in my form. > > On Sep 8, 2013, at 10:52 AM, Jonathan Baker <jonathandavidba...@gmail.com> > wrote: > > Are you using a custom User model? Your code is very similar to the > UserCreationForm django.contrib.auth.forms, and you might want

Re: custom signup form

2013-09-08 Thread Jonathan Baker
quot;) > return password > > def save(self, commit=True): > user = super(SignupForm, self).save(commit=False) > print user, type(user) > user.set_password(self.cleaned_data["password"]) > if commit: > user.save() >

Re: custom signup form

2013-09-08 Thread Jonathan Baker
gt; user.save() > return user > > That throws this exception: > AttributeError: 'User' object has no attribute 'set_password' > > > On Sep 8, 2013, at 10:06 AM, Jonathan Baker <jonathandavidba...@gmail.com> > wrote: > > You need to run the password th

Re: custom signup form

2013-09-08 Thread Jonathan Baker
You need to run the password through the 'set_password' method of the User class to hash it. See: https://docs.djangoproject.com/en/1.0/topics/auth/#django.contrib.auth.models.User.set_password Hope this helps, JDB On Sun, Sep 8, 2013 at 11:02 AM, Anil Jangity wrote: > New to

Re: AJAX - Class Based View or Function Based View?

2013-08-29 Thread Jonathan Baker
I feel like FBV vs CBV is partially a matter of taste. If your app is AJAX-heavy though, why not use one of the proper API frameworks like http://django-rest-framework.org/ or http://django-tastypie.readthedocs.org/en/latest/ ? On Thu, Aug 29, 2013 at 12:51 AM, Sarthak Dev

Re: Want solution for CSRF problem in django please........

2013-08-15 Thread Jonathan Baker
The bullet points in the error message provide some possible solutions. I'd start by adding {% csrf_token %} after your opening tag in the template. Also of note though is that you've imported 'csrf' and 'RequestContext' in your view but you don't appear to be using them anywhere (at least not in

Re: django jquery

2013-08-01 Thread Jonathan Baker
> start? > Thank you. > > > On Wed, Jul 31, 2013 at 9:54 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote: > >> You've posed a pretty open-ended question. Are you looking to provide an >> API using Django that then a client communicates with via A

Re: django jquery

2013-07-31 Thread Jonathan Baker
You've posed a pretty open-ended question. Are you looking to provide an API using Django that then a client communicates with via Ajax using jQuery? Or are you interested in, say, using jQuery to manipulate the UI generated by Django templates? If you can be more specific in your goals, more

Re: django.contrib.auth and username's field size

2013-07-25 Thread Jonathan Baker
Ideally your Django project would contain many different applications, which in turn have their own models.py module. I've yet to work on a project large enough to warrant that i try this, so what I'm about to say is completely untested... but I would think that creating a 'models' directory

Re: django.contrib.auth and username's field size

2013-07-25 Thread Jonathan Baker
Hi Ivan, and welcome. Django >= 1.5 features custom User models, which I believe would solve your problem: https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model On Thu, Jul 25, 2013 at 3:25 PM, Ivan Voras wrote: > Hello, > > I'm new to

Re: client side tests

2013-07-15 Thread Jonathan Baker
Also, here is a detailed (and recent) intro on integrating LiveServerTestCase into your Django project: http://lincolnloop.com/blog/2012/nov/2/introduction-django-selenium-testing/ On Mon, Jul 15, 2013 at 8:43 AM, Larry Martell wrote: > On Mon, Jul 15, 2013 at 6:10 AM,

Re: Error with Passing a class name as a parameter in a ManyToManyField

2013-07-14 Thread Jonathan Baker
You error is in the following line: prereq = models.ManyToManyField(*Course*, blank=True, null=True, through='PreReqToCourse') To phrase this as a sentence, you're saying that "Many courses can belong to many courses." which doesn't follow. I'm guessing that you're aiming to achieve something

Re: Chapter 5 problems

2013-07-12 Thread Jonathan Baker
Does the file have the correct permissions? On Fri, Jul 12, 2013 at 2:03 PM, Randy Baxley wrote: > that has been my first and my last variations but it is still throwing the > same error. > > > On Fri, Jul 12, 2013 at 1:55 PM, John wrote: >

Re: django admin

2013-07-02 Thread Jonathan Baker
Sure you can change it. Here is the relevant documentation as to how you included it in the first place: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf Simply change 'admin' to something else. Jonathan On Tue, Jul 2, 2013 at 9:35 AM,

Re: forloop breaking

2013-06-26 Thread Jonathan Baker
Here is a link to the Python control flow tools section on 'break': http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops On Wed, Jun 26, 2013 at 9:28 AM, Goran wrote: > You can always use IF > for foo in bar: >

Re: User Registration Tutorial

2013-06-05 Thread Jonathan Baker
You're welcome. Also of use are projects such as the following that include the templates you'll need for django-registration: https://github.com/macdhuibh/django-registration-templates On Wed, Jun 5, 2013 at 9:28 AM, Nafiul Islam wrote: > Thanks Jon, I appreciate it. >

Re: User Registration Tutorial

2013-06-05 Thread Jonathan Baker
This isn't a formal tutorial of the django-registration app, but the documentation is great and integrating app is as simple as any other third-party Django app: Code: https://bitbucket.org/ubernostrum/django-registration Docs: https://django-registration.readthedocs.org/en/latest/ On Wed, Jun

Re: CommandError: Unable to serialize database: get_db_prep_value() takes at least 3 arguments (2 given)

2013-04-16 Thread Jonathan Baker
Hello, For starters, it'd help if you would provide us with the command you ran (so we're not guessing). Jonathan On Tue, Apr 16, 2013 at 4:04 PM, frocco wrote: > Hello, > > I am using django 1.5.1 and trying to dumpdata. > > How can I fix this? > > Thanks > > -- > You

Re: static file rendering help

2013-04-05 Thread Jonathan Baker
>From a quick glance it appears that the file source you've included in the html is not specifying a file extension. Try: ...instead of... On Fri, Apr 5, 2013 at 1:43 PM, Fatih Tiryakioglu wrote: > Thank you. > > The shortcut of the picture: >

Re: Hey! I'm recieving an index error when trying to import models, and I can't figure out why.

2013-03-31 Thread Jonathan Baker
When importing Python modules, you don't need to include the '.py' file extension. So, from models.py import UUID ...needs to be: from models import UUID Hope this helps, Jonathan On Sun, Mar 31, 2013 at 10:27 PM, C Alaric Moore wrote: > Hello, > > I am incredibly new

Re: Novice 101 here

2013-03-14 Thread Jonathan Baker
After you've successfully followed Shawn's directions, you can make your virtualenv experience even better by installing virtualenvrwapper: http://virtualenvwrapper.readthedocs.org/en/latest/ On Thu, Mar 14, 2013 at 7:59 AM, Shawn Milochik wrote: > Download virtualenv and

Re: how to include html in your text area

2012-12-06 Thread Jonathan Baker
The html is saved to the database, but is stripped out when the variable is rendered to the template to help prevent XSS attack. You can read more about it (including how to selectively disable the feature) here: https://docs.djangoproject.com/en/dev/topics/templates/#automatic-html-escaping On

Re: I want to learn programming and codes !

2012-11-21 Thread Jonathan Baker
I would start with Django 1.3 and the following tutorial: http://www.djangobook.com/en/2.0/index.html Cheers, Jonathan On Wed, Nov 21, 2012 at 8:57 AM, garlicdud wrote: > Can anyone give me direction for on-line TUTORIAL with python django > under Linux precise pangolin ?

Re: Display only model fields that are non-empty

2012-10-11 Thread Jonathan Baker
I just used the following code on a project to solve the problem you're describing: models.py class SomeModel(models.Model): ... def get_fields(self): return [(field.name, field.value_to_string(self)) for field in SomeModel._meta.fields if field.value_to_string(self) is not None]

Re: accessing django

2012-10-09 Thread Jonathan Baker
As a former PHP dev who avoided the command line at all cost, the frustrations during the transition period to Python/Django/CLI were well worth it. It can seem daunting, but command line syntax quickly becomes second nature, and I can't imagine going back to the days when I developed using a

Re: accessing django

2012-10-09 Thread Jonathan Baker
When you say "access django", exactly what do you mean? On Tue, Oct 9, 2012 at 9:25 AM, Lewis wrote: > Hello, > Is it the right way to access django without going through the command > shell, but instead using ftp -> making new file and edit just like using > php? > > >

Re: Create table and load data

2012-10-04 Thread Jonathan Baker
table, and then copying the printed JSON into initial_data.json so that next time you build your data is all there. On Thu, Oct 4, 2012 at 10:31 AM, Larry Martell <larry.mart...@gmail.com>wrote: > Thanks! I knew there had to be a way! > > On Thu, Oct 4, 2012 at 10:28 AM, Jonathan Bak

Re: Create table and load data

2012-10-04 Thread Jonathan Baker
initial_data sounds like what you're looking for: https://docs.djangoproject.com/en/dev/howto/initial-data/ On Thu, Oct 4, 2012 at 10:26 AM, Larry Martell wrote: > Is there some way to use manage.py to create a table and load data > into it (where the data is contained

Re: Django Tutorial Equivalent to Ruby on Rails Tutorial by Michael Hartl

2012-09-26 Thread Jonathan Baker
I haven't worked through the RoR tutorial you referenced, but completing http://www.djangobook.com/en/2.0/index.html gave me all of the tools necessary to get projects up and running. hth, Jonathan D. Baker On Wed, Sep 26, 2012 at 1:53 PM, Tommy DANGerous wrote: >

Re: Development server won't work from a shared web host

2012-09-03 Thread Jonathan Baker
In the 'Running the Development Server' section of this pagein the tutorial it states that: "Although this server is convenient for development, resist the temptation to use it in anything resembling a production environment. The development server can

Re: Github Development Repo

2012-08-04 Thread Jonathan Baker
A quick solution would be to keep sensitive information in a local_settings.py file that you don't track with Git. On Sat, Aug 4, 2012 at 4:57 PM, Schmidtchen Schleicher < spiolli...@googlemail.com> wrote: > I want to use GIT as versioning system for my Django project and as a > matter of

Re: TinyMCE config

2012-08-03 Thread Jonathan Baker
Success! Thanks for all the help. After integrating your app with the FlatPage app I was able to integrate it with FlatBlock as well. If you're up for it, I'd love to help update the documentation to save future users (and yourself) some time with the issues I ran in to. JDB On Fri, Aug 3, 2012

Re: TinyMCE config

2012-08-02 Thread Jonathan Baker
wrote: > On 2-8-2012 23:53, Jonathan Baker wrote: > > Thanks for the responses, but I'm still stuck. For now, I'm just trying > to > > add TinyMCE to FlatPages within the Django admin app. > > Yet another victim of formfield_overrides? > Remember that the Django admi

Re: Return SQL calculation within queryset

2012-08-02 Thread Jonathan Baker
No, nott particularly. I'm working on my second Django project, so I suppose I'm still taking the hard road in a few places until I feel more comfortable. I'll keep Geo on my shortlist of apps/frameworks/etc. to check out soon. On Thu, Aug 2, 2012 at 6:01 PM, Melvyn Sopacua

Re: TinyMCE config

2012-08-02 Thread Jonathan Baker
Thanks for the responses, but I'm still stuck. For now, I'm just trying to add TinyMCE to FlatPages within the Django admin app. When I visit http://127.0.0.1:8000/admin/flatpages/flatpage/add/ the 'content' textarea is rendered without the WYSiWYG, and I don't see any 404s in the terminal looking

Re: TinyMCE config

2012-08-01 Thread Jonathan Baker
Thanks Mike. 'tinymce' is included in INSTALLED_APPS because I'm using the app located here: https://github.com/aljosa/django-tinymce/ . I saw a few comments around the web that suggested that this was the route to go to easily integrate TinyMCE. I've made a few adjustments to no avail. The app

Re: Return SQL calculation within queryset

2012-07-27 Thread Jonathan Baker
Thanks for the direction, AT. Below is my final code in case anyone else encounters a similar problem: class LocationManager(models.Manager): ''' ''' def nearby_locations(self, latitude, longitude, proximity, category): ''' ''' cursor = connection.cursor()

Re: Tutorial question

2012-07-17 Thread Jonathan Baker
Yes, the methods are part of your model class. You almost have it right, and just need to fix your indentations: class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def

Re: Authentication

2012-06-18 Thread Jonathan Baker
I just implemented Django Registration on an app and found it very easy to work with: https://bitbucket.org/ubernostrum/django-registration/ On Mon, Jun 18, 2012 at 9:14 AM, Harjot Mann wrote: > I want to give a username and password to my project in django...can >

Re: Adding values to formdata of ModelForm before saving

2012-05-30 Thread Jonathan Baker
Yes, it is possible: obj = form.save(commit=False) obj.in_calender-id = kalender obj.save() On Wed, May 30, 2012 at 2:56 PM, Schmidtchen Schleicher < spiolli...@googlemail.com> wrote: > Is it possible to put missing data into the data of a form before calling > form.save() ? > I want to add

Re: Trying to Edit Existing Post; Can't Get Form to Display

2012-05-18 Thread Jonathan Baker
The lines: #else: #story_form = StoryForm(instance=story_form) ...appear to be handling the GET request, and they're commented out. On Fri, May 18, 2012 at 3:22 PM, DF wrote: > Newbie question. I have an application where registered users can submit >

Re: @login_required do nothing

2012-04-28 Thread Jonathan Baker
Apologies, as I shouldn't have assumed that the import had not taken place. Would you mind posting the views.py to pastebin or codepad? On Sat, Apr 28, 2012 at 2:24 PM, marcelo nicolet wrote: > Thanks, but of course the views module does the import. > I'm a python

Re: outdated django book

2012-04-28 Thread Jonathan Baker
Ah yes, I should have clarified that in my response. @knowledge_seeker, if you'll check your python code with a tool like pyflakesit will tell you when you're referencing modules that have not been imported (as well as many other common errors). I use the

Re: Tutorial question regarding def _unicode_

2012-04-11 Thread Jonathan Baker
The method should begin and end with two underscores: __unicode__(self): On Wed, Apr 11, 2012 at 11:30 AM, Brandy wrote: > I am working through the tutorial and have already added the def > _unicode_ statements to my code. However, when running > Poll.objects.all(), I

Re: Upgrading django on a mac

2012-04-07 Thread Jonathan Baker
Ah, good to know. Apologies, but I glanced over your original code to quickly and thought you renamed the directory. Glad it worked out. On Sat, Apr 7, 2012 at 3:54 PM, Larry Martell <larry.mart...@gmail.com>wrote: > On Sat, Apr 7, 2012 at 3:46 PM, Jonathan Baker > <jonathandavid

Re: Upgrading django on a mac

2012-04-07 Thread Jonathan Baker
I'm guessing that your $PATH is configured to look for django in it's old location, and not the new one. On Sat, Apr 7, 2012 at 3:33 PM, Larry Martell wrote: > I'm on a mac, running Mac OS X Version 10.5.8 (Leopard). I was running > django -r 13034 that I got from SVN. I

Re: Tutorial

2012-04-06 Thread Jonathan Baker
Glad to help! On Fri, Apr 6, 2012 at 5:58 PM, Gerald Klein <j...@zognet.com> wrote: > OK makes a complete sense and worked the first time thanks very much. > > --jerry > > > On Fri, Apr 6, 2012 at 4:42 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote

Re: Tutorial

2012-04-06 Thread Jonathan Baker
gt; datetime.timedelta(days=1) > 21 > 22 class Choice(models.Model): > 23 def __unicode__(self): > 24 return self.choice > > On Fri, Apr 6, 2012 at 1:54 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote: > >> Jerry, >> >> You'll wa

Re: Tutorial

2012-04-06 Thread Jonathan Baker
Jerry, You'll want to be sure your method is defined as: def __unicode__(self): return self.name # I'm using 'name' as an example field with double underscores on both sides of 'unicode' instead of just in front of it. Hope this helps, Jonathan On Fri, Apr 6, 2012 at 12:13 PM, jk121960

Re: __unicode__ and return.self

2012-03-25 Thread Jonathan Baker
You're only returning two fields from the __unicode__ method, not the model as a whole. All of the fields are available when importing the model. The __unicode__ method simply affects how a record from a model is displayed within particular areas such as the admin (but not regular template

Re: all(), get(), create(), count(). More info?

2012-03-24 Thread Jonathan Baker
.all(), .filter(), .get() are methods invoked through Django model managers ('objects' in this case). The methods are made available when you create a model class that inherits from models.Model. To use any of them from a shell, you'll need to invoke the python interpreter using the following

Re: __unicode__ and return.self

2012-03-24 Thread Jonathan Baker
the reply. > > If my model has 5 fields, why am I only returning one or two? > Shouldn't I return all 5? > > On Mar 24, 9:19 pm, Jonathan Baker <jonathandavidba...@gmail.com> > wrote: > > The __unicode__ method allows models to return a more usable > representation &

Re: __unicode__ and return.self

2012-03-24 Thread Jonathan Baker
The __unicode__ method allows models to return a more usable representation of a record instead of a unicode object. This is useful in a variety of places, from the Django admin to using the manage.py shell on the command line. The return statement effectively ends the execution of a particular

Re: Help with django-paypal anyone?

2012-03-21 Thread Jonathan Baker
You'll need to enable the CSRF middleware, adjust your view and make use of the {% csrf_token %} template tag in your template. Details can be found here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/ On Wed, Mar 21, 2012 at 11:35 PM, Stanwin Siow wrote: >

Re: where did I install Django

2012-03-20 Thread Jonathan Baker
If you're on Linux, running: $ sudo find / -type d -name django -print ...should do the trick. On my system, it's in '/usr/local/lib/python2.7/dist-packages/django Cheers. On Tue, Mar 20, 2012 at 4:30 PM, jdw wrote: > Newbie alert... > > I installed Django and

Re: Permission denied when saving a record with an ImageField in the model

2012-03-17 Thread Jonathan Baker
n Sat, Mar 17, 2012 at 6:58 PM, Jonathan Baker < > jonathandavidba...@gmail.com> wrote: > >> Sithembewena, >> >> I wasn't exactly right in my response, but close. You need to make sure >> that the same process running your python interpreter has write permissions >

Re: Permission denied when saving a record with an ImageField in the model

2012-03-17 Thread Jonathan Baker
Sithembewena, I wasn't exactly right in my response, but close. You need to make sure that the same process running your python interpreter has write permissions to your media directory. >From StackOverflow: "The process that is running your Python interpreter doesn't have permission to write