Re: how to get text of a ChoiceField populated with ajax

2012-05-09 Thread Kurtis Mullins
t; if value == smart_unicode(k2): > > return True > > else: > > if value == smart_unicode(k): > > return True > > return False > > So, if you're creating

Re: Django AJAX forms and views

2012-05-15 Thread Kurtis Mullins
I'll try to help out a bit. The first problem I see is in your Javascript. I believe your JQuery selector is supposed to be the field's ID -- so, for example, $("#csrfmiddlewaretoken"). Next, in your view -- I don't see where you're actually returning any data. You should use Firebug or the Chrome

Re: Can I override get_object() of a generic view?

2012-05-15 Thread Kurtis Mullins
Hey, I'm not really sure what you're trying to do here. You're using a CreateView (which is built for creating new objects) and overriding the get_object(self, queryset=None) method (found in SingleObjectMixin -- https://github.com/django/django/blob/master/django/views/generic/detail.py) to, I'm

Re: Is this a bug in the documentation? ModelForm 'fields' attributes throwing error without trailing comma in the Tuple

2012-05-16 Thread Kurtis Mullins
pty pair of parentheses; a tuple with one item is > constructed by following a value with a comma (it is not sufficient to > enclose a single value in parentheses). Ugly, but effective." > > > On Wednesday, May 16, 2012 9:22:04 PM UTC-4, Kurtis wrote: >> >> Hey guys, &g

Re: Use Django to implement my GUI!

2012-05-18 Thread Kurtis Mullins
If you're dead set on using a non-browser GUI for the administration application, just use the HTTP Protocol for your communications between the Django Server and whatever Desktop Application you build. However, if you can just use a web browser for that (even if it's a Qt browser or something that

Re: Use Django to implement my GUI!

2012-05-18 Thread Kurtis Mullins
> > My questions are: > - Can I override the djando admin methods so that i can not only > customized my views and html page, but also manipulate objects in > database, so that i can do another action when catching an event in > the GUi. Anything that can be done with Django's Admin interface ca

Re: Template: Foreign Key

2012-05-18 Thread Kurtis Mullins
Try something along these lines (Note: I'm switching up your variable names a bit to make it easier to read) {% for house in houses %} {{ house.name }} {% for person in house.people.all %} {{ person.name }} {% endfor %} {% endfor %} I just wrote that code block pretty quickly

Re: Template: Foreign Key

2012-05-18 Thread Kurtis Mullins
Whoops -- that might need to be 'house.people_set.all'. Sorry. On Fri, May 18, 2012 at 10:50 PM, Kurtis Mullins wrote: > Try something along these lines (Note: I'm switching up your variable > names a bit to make it easier to read) > > {% for house in ho

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-22 Thread Kurtis Mullins
Hey, Sorry I'm a bit confused so I'm going to try to make some sense of your situation "out loud" :) 1. User.objects.get(username="some_username") works some-times 2. When it doesn't work, then you get the DoesNotExist exception, right? 3. If not, what error(s) do you see? 4. Are you sure the use

Re: Django site updater

2012-05-22 Thread Kurtis Mullins
We use a versioning system (Subversion to be precise, git or mercurial would probably be better for you). Then I commit everything to the main repository and just checkout (update after the initial checkout) on the development server. It's not too bad of a system although I still have to go onto th

Re: Static files management

2012-05-22 Thread Kurtis Mullins
Can you give us some more detail on what's not working? Thanks. On Tue, May 22, 2012 at 9:34 AM, Xavier Ordoquy wrote: > Hi, > > If you follow what the doc says, there shouldn't be any issue > (https://docs.djangoproject.com/en/1.4/howto/static-files/#basic-usage) > > Regards, > Xavier Ordoquy,

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-23 Thread Kurtis Mullins
Wow, nice find! I would've never thought an index would cause that sort of a problem. I'm glad you figured it out and thanks for sharing that crazy find! On Wed, May 23, 2012 at 4:23 AM, Hanne Moa wrote: > On 23 May 2012 00:30, akaariai wrote: >> On May 22, 11:49 pm, Hanne Moa wrote: >>> I upgr

Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Hey, no problem! My apologies for missing out on this thread for a while. I hope you got it figured out! Anyways, I'm thinking that if you're actually basing this validation (done in your clean method), you may want to use a ForeignKey Field. You can define a custom queryset to filter through the

Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Sorry, somehow I completely overlooked the post where it says you've solved the problem. Happy hacking! On Wed, May 23, 2012 at 10:52 AM, Kurtis Mullins wrote: > Hey, no problem! My apologies for missing out on this thread for a > while. I hope you got it figured out! > > Anyw

Re: Need Help with ForeignKeys

2012-05-23 Thread Kurtis Mullins
The related name, basically, specifies a way to back-reference that particular Team. If you don't specify it, it just uses an automatically generated variable name (for example, just 'team'). You'd have a conflict because there'd be two 'team' variables generated in your game class. The method Simo

Re: JQuery .get new url is not updating the page

2012-05-23 Thread Kurtis Mullins
I'm not sure of the use-case on this but you could possibly take the following approach: 1. Get your dynamic page via AJAX with some given query 2. Modify the URL to match the query 3. When a user accesses the same page with the given query (my/page/?foo=bar) then they'll see the same thing Of co

Re: Question object permission approach

2012-05-23 Thread Kurtis Mullins
Hey, I think it really depends on how much complexity you want. We use a package called userena which depends upon Guardian. All that I know about Guardian is it's no fun when schema migrations get messed up :) In all honestly, though, I should have probably read more about it before using an appl

Re: Taggit fragmentation

2012-05-29 Thread Kurtis Mullins
Open Letters scare me ... They remind me of the pseudo-beginning of mainstream, non-free software :) I'd say just do like Russ mentioned. Try to pull everything together in one repository. Then when it's mature and you still want to take over the project, contact the original author and see if he/

Re: Question object permission approach

2012-05-29 Thread Kurtis Mullins
Hey, I'm glad you got it all running! I just wanted to specify some of my exact code in case anybody references this in the future. It's a bit off from where I was. In my UpdateViews and DetailViews, I do something along the lines of this: # Limit Editing Access to User's Own Objects. def

Re: Inverting URL security diligence - suggestions?

2012-05-29 Thread Kurtis Mullins
If you tend to use the standard Class Based Views, you could always add a mixin for that functionality. Or just start subclassing to make it even easier to read (e.g. AuthenticatedUpdateView, AuthenticateCreateView, etc...) On Tue, May 29, 2012 at 7:50 PM, Mike Dewhirst wrote: > On 30/05/2012 4:2

Re: Django ModelForm user best practices

2012-05-30 Thread Kurtis Mullins
I tend to put as much functionality in my forms as possible. I've asked a similar question before (many months ago) and I believe that was the consensus. One advantage is you can re-use your forms (and its save functionality) for your Create and Update views. On Wed, May 30, 2012 at 3:45 PM, RM w

Re: Foreign Key Chicken/Egg Inline Fu

2012-05-30 Thread Kurtis Mullins
Unless a player can play for multiple teams (which I'm doubting since Team is a ForeignKey for a Player), why not remove that 'captain' attribute from your Team and put it into your Player model as a boolean field? You could create a ModelManager or class-level model method to grab the associated t

Re: Foreign Key Chicken/Egg Inline Fu

2012-05-30 Thread Kurtis Mullins
orm you're using (outside of Admin) On Wed, May 30, 2012 at 4:02 PM, Kurtis Mullins wrote: > Unless a player can play for multiple teams (which I'm doubting since > Team is a ForeignKey for a Player), why not remove that 'captain' > attribute from your Team and put i

Re: Django ModelForm user best practices

2012-05-30 Thread Kurtis Mullins
> On second method some experience users can > override hidden data For the second method, you'd just use -- class Meta: fields = ('board', 'post', 'name') to prohbit anyone from trying to override the 'user', if that's what you're talking about. > And it's a bad idea to > override __init__ and s

Re: Foreign Key Chicken/Egg Inline Fu

2012-05-30 Thread Kurtis Mullins
player in the same team is a captain before allowing it to pass. Different context, but hopefully this approach can help. On Wed, May 30, 2012 at 4:05 PM, Kurtis Mullins wrote: > Sorry, I completely mis-read the last part of your problem. You > already thought about the same solution,

Re: Python IDLE

2012-05-30 Thread Kurtis Mullins
Back to the original question, Did you try running "python manage.py runserver" from the command prompt? As far as changing those icons back to Python, I believe you have to change your 'Default Program'. I'm not sure which version of Widnows you're using (or even how to do it in Windows, I'm runn

Re: App inside another app or nesting in django apps

2012-05-31 Thread Kurtis Mullins
Sure. They're just Python modules. All you need to do is: 1. Include the files: __init__.py and models.py 2. Add the application to your settings.py, for example: myproject.myapp.subapp It *should* work, although I haven't personally tested it yet. On Thu, May 31, 2012 at 7:46 AM, vijay shanker

Re: Adding values to formdata of ModelForm before saving

2012-05-31 Thread Kurtis Mullins
Hey, I tried re-writing your view and form for you -- but I ran into a snag. I don't read German so other than code-wise (and a couple of obvious words, like kalender and participants) I'm not really sure what you're trying to accomplish. I do see one obvious issue, though. Participants is a many

Re: Adding values to formdata of ModelForm before saving

2012-05-31 Thread Kurtis Mullins
One minor edit to that: form.save(request) -> form.save(request, kalender) On Thu, May 31, 2012 at 8:47 PM, Kurtis Mullins wrote: > Hey, > > I tried re-writing your view and form for you -- but I ran into a snag. I > don't read German so other than code-wise (and a cou

Re: Make ManyToMany field editable in a ModelForm

2012-06-01 Thread Kurtis Mullins
The Form just validates that the object you choose is a valid choice for that M2M field. If you wanted to created a new one on the fly, you'd probably want to use another Form and maybe go the Javascript way. You could *possibly* get by, in the same form, with doing something like this: class MyF

Re: A question about Model.full_clean

2012-06-01 Thread Kurtis Mullins
>From the docs: https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.full_clean from django.core.exceptions import ValidationError, NON_FIELD_ERRORStry: article.full_clean()except ValidationError as e: non_field_errors = e.message_dict[NON_FIELD_E

Re: Libraries for generating URL of uploading files in Django

2012-06-01 Thread Kurtis Mullins
Check out django-storages (if you use off-site hosting like S3, Rackspace Files, etc...). Then, just request the ImageField or FileField's .url() method. I think this may be the case for the bulit-in ImageField and FileField as well (actually, I'm pretty sure it is) but I haven't used it in so lon

Re: Scaling django installation

2012-06-01 Thread Kurtis Mullins
Check out django-cache-machine. It uses memcache to cache your ORM qureies and updates (invalidates) that cache when they change. On Fri, Jun 1, 2012 at 10:35 AM, Tim Chase wrote: > On 06/01/12 09:17, Subhranath Chunder wrote: > > On Fri, Jun 1, 2012 at 6:57 PM, Tim Chase < > django.us...@tim.the

Re: Scaling django installation

2012-06-01 Thread Kurtis Mullins
To me, the biggest bottleneck in a "Django Application Installation" (not application) is not going to be Django at all. It's going to be I/O -- typically to the database and/or file system. These are used heavily (from my personal experience) by all sorts of django functions. As for the database -

Re: A question about Model.full_clean

2012-06-01 Thread Kurtis Mullins
What version of Django are you using? On Fri, Jun 1, 2012 at 10:47 AM, David Markey wrote: > That is my exact class for that model. > > > On 1 June 2012 15:27, Kurtis Mullins wrote: > >> From the docs: >> https://docs.djangoproject.com/en/dev/ref/mod

Re: A question about Model.full_clean

2012-06-01 Thread Kurtis Mullins
ields()) methods. I'm going to look into the source of the Model module and see what's going on On Fri, Jun 1, 2012 at 10:55 AM, David Markey wrote: > 1.4 > > On 1 June 2012 15:54, Kurtis Mullins wrote: > >> What version of Django are you using? >> >> >

Re: A question about Model.full_clean

2012-06-01 Thread Kurtis Mullins
, Jun 1, 2012 at 11:08 AM, Kurtis Mullins wrote: > Yeah, I'm getting exactly the same results. It seems that it's not > throwing the IntegrityError until you try to save it. I suppose that's > because it's marked as 'not null' in the database. It appears to be &g

Re: How to perform a simple search ignoring characters with accents (á, é, í, ó, ú)

2012-06-01 Thread Kurtis Mullins
Maybe you could just build a simple index? It'd basically be a set of keywords, each with a set of matching books. So in your example, you'd have two keywords: hola (with accent) -> book1, book2, etc.. hola (without accent) -> (same as previous) And then just write some sort of functionality to r

Re: How to upload Django/Python to FTP

2012-06-01 Thread Kurtis Mullins
Hey, Welcome to Django! While you could, possibly, manage to upload your project and get it running -- it would be well worth the effort to learn the basics of using a Linux command-line. You don't have to edit your files in the command line but it'll make things a lot easier when trying to deplo

Re: How to upload Django/Python to FTP

2012-06-01 Thread Kurtis Mullins
immediate help. You can catch me on Skype from Monday-Friday 10am-5pm EST if you or your web developer have any small/quick questions. I don't mind helping out as long as it doesn't pull me away from my job for too long. My username is kurtis.mullins. On 6/1/12, Kurtis Mullins wr

Re: list indices must be integers, not str

2012-06-01 Thread Kurtis Mullins
If the error is "list indices must be integers, not str" then I imagine you are trying to access a list using a String rather than Integers :) We'd have to see your View and probably the related model you're using the "key_uniquekey" value on to help you out a bit more. On 6/1/12, Nikolas Stevens

Re: Obtaining objects from a many-to-many relationship

2012-06-02 Thread Kurtis Mullins
Have you tried b.haveone.all()? On Sat, Jun 2, 2012 at 12:36 AM, Thomas Lockhart wrote: > I've got two models with one having a many-to-many relationship with the > other: > > class A(models.Model): > name = models.CharField("name") > > class B(models.Model): > haveone = models.ManyToManyField(

Re: Obtaining objects from a many-to-many relationship

2012-06-02 Thread Kurtis Mullins
https://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-relationshipsfor more information. (Unless I read your question wrong :)) On Sat, Jun 2, 2012 at 4:15 AM, Kurtis Mullins wrote: > Have you tried b.haveone.all()? > > > On Sat, Jun 2, 2012 at 12:36 AM, Thomas Lockh

Re: syncdb does not find model, but it does in the shell

2012-06-06 Thread Kurtis Mullins
I'm pretty sure you can't have a folder named models and that your models file needs to be called models.py -- unless you use some sort of a 'hack' to work around it. I remember seeing a bug posted about this issue which was pretty easily google-able. I just don't remember the bug number off hand,

Re: syncdb does not find model, but it does in the shell

2012-06-06 Thread Kurtis Mullins
+1 -- Nice find! On Wed, Jun 6, 2012 at 10:47 AM, jmolmo wrote: > I think that you have to indicate app_label in your separate model > file > According to: > https://docs.djangoproject.com/en/1.4/ref/models/options/ > > -- You received this message because you are subscribed to the Google Grou

Re: Accessing Backend DB for UI

2012-06-06 Thread Kurtis Mullins
On 05/06/2012 18:04, Ali Shaikh wrote: > Hey.. > > I am working for project, in that the back-end code is return in perl > and am working for front-end part i.e UI using Django, > Can any one can tell me how to access back-end database which is > return in perl or any othere languages .??

Re: limit number of related instance for m2m field in django-admin

2012-06-07 Thread Kurtis Mullins
You could customize the Admin Book Creation Form's save() method to check for X number of books an author already has. Note: I have very limited experience customizing the Admin application and have only used this method through a normal Form. On Thu, Jun 7, 2012 at 7:56 AM, vijay shanker wrote:

Re: DRY violation using get_or_create with defaults

2012-06-11 Thread Kurtis Mullins
hmm, have you considered creating a custom Model Manager with a custom method for this purpose? I don't really have any ideas at the moment, sorry! On Mon, Jun 11, 2012 at 9:44 AM, ojno wrote: > Hi all, > > In my app, which involves doing background tasks and possibly rerunning > them a number o

Re: 1.2 ModelForm.is_valid() backward incompatible change

2012-06-12 Thread Kurtis Mullins
I'm not sure if I understand the problem correctly, but I think this might be what you're looking to do. In your ModelForm, simply exclude the fields you don't want or explicitly include only the fields you do want to use. Those are both under the ModelForm's Meta class. e.g. # Include only thes

Re: AnonymousUser as Foreignkey?

2012-06-12 Thread Kurtis Mullins
Well, unfortunately the standard Anonymous User ID is always none. (source: https://docs.djangoproject.com/en/dev/topics/auth/#anonymous-users) So, you can't really use their ID as a foreign key. However, I'm having trouble picturing your use-case here. If you could give some more information on

Re: cookie based sessions or no?

2012-06-13 Thread Kurtis Mullins
I wouldn't authenticate on every request. That seems like a lot of unnecessary work. Just authenticate once and use Cookies/Authentication Tokens to sustain the session. It's already built in so it's pretty easy to do. They even have a code snippet that shows how to use a special HTTP Header to kee

Progromatically creating Images using Django-Cumulus?

2012-06-15 Thread Kurtis Mullins
Hey guys/girls, I've ran into a problem which I'm not quite sure how to tackle. We use Django-cumulus for handling our user's media. I need to programatically create an image and save it as a ImageField. I want to avoid any "hackish" ways of doing it and try to keep it consistent with the way Djan

Re: Any clue why Facebook iframe would be blank?

2012-06-15 Thread Kurtis Mullins
; > On Friday, June 15, 2012 6:56:56 PM UTC+1, Rafał Stożek wrote: >> >> Does this view accept POST requests? Because facebook uses POST to send >> you some data in signed_request param. >> >> On Friday, June 15, 2012 6:40:25 PM UTC+1, Kurtis wrote: >>> >&

Re: How to setup Python 2.7 and Virtualenv on a shared host with no root access?

2012-06-15 Thread Kurtis Mullins
Honestly, if your host doesn't provide those services out of the box -- you might have better luck going with a different hosting provider. I would choose a cheap VPS or Cloud Server if I were you. On Fri, Jun 15, 2012 at 4:18 PM, Dan Santos wrote: > Hi darwin, > > Sorry for the late reply. Tha

Re: Problem with order_by on one record only

2012-06-15 Thread Kurtis Mullins
You could try grabbing the exact SQL statement(s) executed for this query and run them yourself on the Oracle Database. At least that would tell you if the problem lay in Django or not. Then, maybe use a debugger to step through the query (try using ipdb or something similar) and see where it gets

Re: How do I get django working without having to manually run the server?

2012-06-16 Thread Kurtis Mullins
> > But you still need manage.py runserver for development because it is > specially designed to prioritise debugging over security and performance. Really? I could see the use for it when running an actual debugger but otherwise, I'm not so sure there's any benefit to using it. Do you have any s

Re: Django on Mac OS X

2012-06-16 Thread Kurtis Mullins
Try using the Brew (or ports or whatever it's called on Mac) system to install Python, PostgreSQL, and the postgresql development libs. On Sat, Jun 16, 2012 at 11:22 PM, Moshe Voloshin wrote: > Replying to this old post as I am having this problem of: > Symbol not found: _PQbackendPID > On MAC OS

Re: upload image

2012-06-17 Thread Kurtis Mullins
> > On Sun, Jun 17, 2012 at 2:33 AM, Satvir Toor > wrote: > but when i try to submit data it makes the upload file empty and gives > notification this field(file upload) is required. Make sure you set up the Form enctype correctly. () MEDIA_ROOT = > '/usr/local/lib/python2.7/dist-packages/d

Re: How do I get django working without having to manually run the server?

2012-06-17 Thread Kurtis Mullins
ver, not for production web > server. > > so make it what you like ... it's in the documentation.. > > > > On Sun, Jun 17, 2012 at 12:20 PM, Kurtis Mullins > wrote: > >> But you still need manage.py runserver for development because it is >>> specially

Re: Problem using User.get_profile() in DJANGO

2012-06-18 Thread Kurtis Mullins
Give this a shot: user = User.objects.create_user(request.POST['apelido'], request.POST['email'], request.POST['pwd']) user.save() profile = user.get_profile() profile.apelido = request.POST['apelido'] profile.save() Also, I recommend using Forms (and better yet, ModelForms with Class-Based Views

Re: multiple databases [was]Trying to find something in multiple databases... Confused...

2012-06-18 Thread Kurtis Mullins
> > On Mon, Jun 18, 2012 at 9:30 AM, Daniel Roseman > wrote: There are certain "advanced" features of Django - multiple DBs, model > subclassing, that sort of thing I feel there's quite a few problems that would be relatively unsolvable without model subclassing. At least in any efficient way.

Re: multiple databases [was]Trying to find something in multiple databases... Confused...

2012-06-18 Thread Kurtis Mullins
On Mon, Jun 18, 2012 at 1:45 PM, Dennis Lee Bieber wrote: > > > First, is everybody on the same page (terminology)... (Independent > of Django) > >First is: multiple database engines (SQLite3, MySQL, Access/JET, > etc.). Working across multiple engines is never easy -- one typically

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-18 Thread Kurtis Mullins
I've read over this many a time -- never paid much attention because I don't use Oracle: https://docs.djangoproject.com/en/dev/ref/models/fields/#null Anyways, if you don't allow NULL and you don't allow empty strings, what are you going to put in there when there's nothing? On Mon, Jun 18, 2012

Re: Writing or editing files using Django

2012-06-19 Thread Kurtis Mullins
I agree. It's very easy to use the templates to do just that. Once you have them processed and saved as a variable (which would be a string) then you can do anything with them that Python is capable of. For example, you could use them to generate emails, save text files, etc... As far as calling C

Re: Custom model field as foreign key

2012-06-19 Thread Kurtis Mullins
hmm, maybe you need a custom Select Widget for your custom field? Or check out the select widget and see if it's looking for any _meta information on the field that determines how the widget is displayed. On Tue, Jun 19, 2012 at 8:49 AM, Melvyn Sopacua wrote: > On 19-6-2012 14:45, Juan Pablo Mart

Re: 'str' object has no attribute 'resolve'

2012-06-19 Thread Kurtis Mullins
Those URLs are outside of the tuple. Also, you're not using url() types to define the urls so any reverse lookup will fail. On Tue, Jun 19, 2012 at 2:00 PM, Xavier Ordoquy wrote: > Hi, > > If you just return the original urls.py, there's no way we can know what > you did and this will prevents us

Re: Oracle: blank, null, and empty_strings_allowed

2012-06-19 Thread Kurtis Mullins
So you're trying to, basically, enforce "required=True" at the database-level? On Tue, Jun 19, 2012 at 7:23 PM, Ian wrote: > On Monday, June 18, 2012 5:59:27 PM UTC-6, André Pang wrote: >> >> What I'd like to do is (1) disallow NULLs, and (2) disallow empty >> strings. It looks like there's no

Re: New to Django, need help starting

2012-06-20 Thread Kurtis Mullins
Try "easy_install django" or "pip install django". Really, though -- I recommend going with a combination of Mac Brew (or ports or whatever third-party distribution) to install Python and pip then install virtualenv and virtualenvwrapper to create a virtual environment, then inside of the virtual

Re: Our thanks/acknowledgments for Django

2012-06-21 Thread Kurtis Mullins
Very nice Cal! On Wed, Jun 20, 2012 at 9:59 PM, Daniel Sokolowski wrote: > Impressive and it more than does satisfy my curiosity; in this industry I > find the moment you start doing custom code it's hard to estimate - > especially on the larger projects. Super thanks > > > On 20/06/2012 20:11,

Re: Returning JSON error when catching Django exception

2012-06-21 Thread Kurtis Mullins
I'm not sure if returning a response is any different in middleware than it would be in a normal view. In that case: return HttpResponse(json_data, mimetype="application/json") On Thu, Jun 21, 2012 at 6:54 AM, Taras_96 wrote: > Does anyone have opinions on the best way of having middleware cat

Re: Any clue why Facebook iframe would be blank?

2012-06-22 Thread Kurtis Mullins
ize layouts. If you need any help debugging yours, let me know! And thanks for the feedback. - Kurtis Mullins -- 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 unsubs

Re: Import error

2012-06-22 Thread Kurtis Mullins
name, and then the python file that your "random_password" function/class is saved in. Let me know if you need any more help! Good luck! - Kurtis Mullins On Fri, Jun 22, 2012 at 10:19 AM, Emily wrote: > so your point is that I should post my code. > When I did that some time, I

Re: Django learning

2012-06-22 Thread Kurtis Mullins
> > You're supposed to load the shell with `./manage.py shell` rather than > going directly into Python. That is explained in the tutorial. > -- > DR. > > +1 -- However, I recommend installing the package "ipython" when using the Django Shell. For example, run: "pip install ipython". This will giv

Re: Import error

2012-06-22 Thread Kurtis Mullins
+1 on pulling the "random_password()" method out of the Class and setting it up as a module object. I'd still suggest using this sort of an import statement on it, though: from myproject.myapp.helpers import random_password Where in this example you'd substitute your Project name with "myproject"

Re: Duplicate rows with same key in DB?

2012-06-22 Thread Kurtis Mullins
You could also put a unique_together statement in your Model. If you do this, you'll need to update your database as well to enforce the constraint at the database level. On Fri, Jun 22, 2012 at 10:52 AM, Daniel Roseman wrote: > On Friday, 22 June 2012 06:23:32 UTC+1, ydjango wrote: >> >> I have

Re: Taking advantage of multiple cores

2012-06-22 Thread Kurtis Mullins
Basically, you just need to run multiple instances of your Django web-application. I've never used Apache for this (I'm an Nginx + uWSGI fan, myself) but you'd just run multiple worker processes and your WSGI handler should "balance" between them. Like the others mentioned, make sure to use a comm

Re: Where I am wrong in loading static files ?

2012-06-22 Thread Kurtis Mullins
Here's a vaguely similar post: http://stackoverflow.com/questions/6409920/django-static-files-from-app-directories Like one of the respondents recommended, try adding a "print str(STATICFILES_DIRS)" in your settings.py and then run "runserver" so you can see what actual directories are being inclu

Re: Select * from users,country where country.id = users.id in Django using amin.contrib

2012-06-22 Thread Kurtis Mullins
Hey, Here's some sample code just from reading what you've provided. from django.contrib.auth.models import User users_in_country = User.objects.filter(cUser__name="some_country_name") if bool(users_in_country): # Check to make sure there's at least one User in the Country for user in users:

Re: Select * from users,country where country.id = users.id in Django using amin.contrib

2012-06-22 Thread Kurtis Mullins
> > > With that said, I'd recommend changing the naming conventions of your > Model fields. For example: > > User > - name > - country > > Goals > - name > - description > - country > > Country > - name > Sorry, wanted to mention a small fix on what I imagine would be better naming conventions (ju

Re: Where I am wrong in loading static files ?

2012-06-22 Thread Kurtis Mullins
day, June 22, 2012 8:37:55 PM UTC+5:30, Kurtis wrote: >> >> Here's a vaguely similar post: http://stackoverflow.** >> com/questions/6409920/django-**static-files-from-app-**directories<http://stackoverflow.com/questions/6409920/django-static-files-from-app-directories>

Re: Installing Django @ Shared Host

2012-06-22 Thread Kurtis Mullins
I recommend building your application locally (on your own computer). You can follow the tutorial and use Django's built in server for testing. Once your application is ready to go live, then find a Django-Friendly host. They're not too expensive. I wouldn't recommend getting a django-friendly ho

Re: runserver cache my template files

2012-06-22 Thread Kurtis Mullins
Are you using a non-temorary caching mechanism like Memcache or DB Caching? If so, do you have caching directives in your templates? On Fri, Jun 22, 2012 at 3:21 AM, Tomás Garzón Hervás wrote: > Yes, and I reload the browser with empty cache. > thanks > > > On Friday, June 22, 2012 9:02:23 AM UTC

Re: Installing via Tutorial Part 2 / MacOSX / Can't create a superuser due to locale() problem.

2012-06-22 Thread Kurtis Mullins
Did you get an opportunity to type anything after "yes"? Or did it just blow up at that point? Based on the traceback, it looks like it is having trouble getting your system's default username. I've never really noticed that it has that functionality before but I wonder if there's something "weird

Re: Installing via Tutorial Part 2 / MacOSX / Can't create a superuser due to locale() problem.

2012-06-22 Thread Kurtis Mullins
Oh man, it looks like my post got butchered. If you can't figure out where each line ends, let me know! On Fri, Jun 22, 2012 at 4:22 PM, Kurtis Mullins wrote: > Did you get an opportunity to type anything after "yes"? Or did it > just blow up at that point? > > Based

Re: Any clue why Facebook iframe would be blank?

2012-06-23 Thread Kurtis Mullins
> > This is a common problem in all of the proxied setup: > > http://flask.pocoo.org/snippets/47/ > > The real fix is always reading POST datas when they are available (even if > you are not interested in them). Not reading them means your communication > socket with the webserver will be clobbered

Re: 403 error when POSTing to a view with csrf protection

2012-06-24 Thread Kurtis Mullins
Hey Mike, Make sure that you include this within your block: {% csrf_token %} Then, check the source code of that page to make sure the CSRF token tag was included. Finally, using a Javascript debugger (such as Firebug) check to make sure that your request sent, when clicking the "submit" butt

Re: Userena configuration

2012-06-24 Thread Kurtis Mullins
Hey Bastian, For the privacy portion, you'll need to create your own Form based on the Userena's user-editing form and just exclude that field. As for the terms of service -- I'm not sure off of the bat. I could possibly take a look in the next few days if nobody jumps in with an answer. You migh

Re: 403 error when POSTing to a view with csrf protection

2012-06-25 Thread Kurtis Mullins
> > > POST: > [u'']}>, > > Wait a second... > Where's your csrfmiddlewaretoken from the {% csrf_token %} field that > you put in your form? > > This is the process: > - the cookie token is basically a lock > - the POST request resembles trying to open the door with that lock > - the formfield token

Re: ForeignKey problem

2012-06-25 Thread Kurtis Mullins
> > [...] > > Let's say I have two models and in each I have field with ForeignKey > > relating to field in other model (hope it's clear). [...] > Actually, I'm pretty confused about this part :) A ForeignKey is used to relate to another Model -- not just a Model Field -- in Django's ORM. So for

Re: ForeignKey problem

2012-06-25 Thread Kurtis Mullins
> > >> The mechanism must involve deferred resolution of the second model by > passing the model class name in as a string. Without string syntax python > insists on knowing what that class is at the time it sees the reference. > Don't know more than that though ;) > > https://github.com/django/dj

Re: base_url() in django

2012-06-25 Thread Kurtis Mullins
> > Is this an actual issue? You realize that there's no difference between > /doc/ and http://example.com/doc/ if the current server is > http://example.com/? > +1 I'd like to see the use-case where having absolute URLs everywhere is actually necessary. It's not hard to do in certain places wher

Re: ForeignKey problem

2012-06-25 Thread Kurtis Mullins
> > > Let me follow up on this. Say I want to add list of all Teams my Players > played for. What you're saying is that I don't have to add ForeignKey to > Team and just use team_name field from Team model? Will it work? > > This relations stuff is confusing :P. > > Haha, no problem! It'll come nat

Re: Affordable Django hosting solution in India/around?

2012-06-25 Thread Kurtis Mullins
Just go with Amazon Web Services. You get a year for free on their lightest server. The only minor issue is you have to set it up yourself -- but that's really not difficult to do. By the way, $8/month is incredibly little to pay. I guess in India that might be more money than it is here -- but ju

Re: Finding a developer

2012-06-26 Thread Kurtis Mullins
If you are doing the work yourself, use whichever you prefer. If you are paying someone else to do the work, give them the freedom to choose what to use. Just find someone who can complete the task at hand within your budget and the toolset really shouldn't matter -- as long as they're not doing it

Re: Logout- Back Button

2012-06-26 Thread Kurtis Mullins
You can't clear the browser's cache using Javascript. On Tue, Jun 26, 2012 at 9:58 AM, Javier Guerra Giraldez wrote: > On Mon, Jun 25, 2012 at 9:17 PM, Sajja1260 > wrote: > > On Friday, 28 November 2008 14:35:48 UTC+5:30, jai_python wrote: > >> > >> Any possible to clear browser cache alone usin

Re: base_url() in django

2012-06-26 Thread Kurtis Mullins
We understand the issue. You want to display absolute URL including the hostname and protocol in your templates. That's not difficult to do, you just need to write a custom template tag to do this. There's many ways to go about doing this -- however, if you're only running a single web-site on this

Re: base_url() in django

2012-06-26 Thread Kurtis Mullins
> > The case we're trying to make is -- why do that? Just like Raitucarp said, > using an absolute path provides the same end-result as including the > hostname and protocol. There's only a few cases where you'd want to do that > Whoops, sorry Raitucarp. I meant Melvyn :) -- You received this me

Jobs for $35+/hour? Or just go back to strictly-freelance?

2012-06-26 Thread Kurtis Mullins
velopment) positions that allow telecommuting for more than $35/hour? Or on the other hand, should I just go back to strictly freelance and aim for the $50/hour that most would charge to do the same job? There's plenty of jobs out there but I can't move from my area (South-West Ohio).

Re: Django 1.4 - how to display a success message on form save

2012-06-26 Thread Kurtis Mullins
We do it all over our site. I use class-based views but you can checkout my "MessageMixin". I have the code on this stackoverflow page: http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview/10903943#10903943 It will show up wherever you send the user to next, as long

Re: How to Query objects.filter ForeignKey

2012-06-26 Thread Kurtis Mullins
> > I performed infobox = InfoDetail.objects.filter(title=info_title), but it > returns an error cus 'title' doesn't live in InfoDetail. > > How can i grab and filter it by title and pass {'infobox': infobox} in > HttpResponse when HttpRequest is called? > If you want to filter by a certain title

<    1   2   3   4   5   >