Re: Doubt the split()

2013-06-21 Thread Tomas Neme
a regex? something like re.match("\[http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

Re: Django DEBUG=False made all css loss

2013-06-11 Thread Tomas Neme
https://docs.djangoproject.com/en/1.5/howto/static-files/ On Tue, Jun 11, 2013 at 8:32 AM, wrote: > I am build my application using Python 2.7 and Django 1.3.7.All it is > working perfectly and most of the part are over so we planed to move it to > live.While checking with DEBUG = False in setti

Re: Looking for a Django mentor

2013-06-10 Thread Tomas Neme
> Trying to learn the platform and work on the project at the same time. > > Thanks, Feyzi first of all, do the tutorial, don't try to go further until you're somewhat comfortable with the concepts there. You'll get the feel of the most basic and powerful django tools are: models, forms, and the a

Re: Admin for proxy model for custom User

2013-06-02 Thread Tomas Neme
The docs say this has changed to get_queryset in dev version, 1.5 uses get_query_set isn't this a rather.. radical change? Is backwards compatibility maintained somehow? On Sun, Jun 2, 2013 at 12:40 PM, Tomas Neme wrote: > django.db.models.manager, L118 > > it seems to be "

Re: Admin for proxy model for custom User

2013-06-02 Thread Tomas Neme
django.db.models.manager, L118 it seems to be "get_query_set" not "get_queryset" -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@google

Re: Admin for proxy model for custom User

2013-05-28 Thread Tomas Neme
Silly, but aren't you missing class Patient() save(self): self.kind = 'p' super(Patient, self).save() or some such thing and something similar for Doctor? I guess it might be in the forms, but since it's nowhere in the code you showed... -- You received this message beca

Re: password encryption

2013-03-01 Thread Tomas Neme
> We haven't used SHA-based or MD5-based hashing for some time. oh, I was convinced sha2 was being used. I probably just read the code a while ago and didn't notice it in the changelogs -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde

Re: Wording in Djang Docs: "per instance" vs "every instance"

2013-02-28 Thread Tomas Neme
as, > > now I got it! Still the original usage of "per" and "every" sounds strange to > me.. it should be more like "per instance within a URL pattern", but I am not > a native in English, so nevermind. > > Thanks! > > On Feb 28, 2013, at 8:54 P

Re: Wording in Djang Docs: "per instance" vs "every instance"

2013-02-28 Thread Tomas Neme
> This approach applies the decorator on a per-instance basis. If you want > every instance of a view to be decorated, you need to take a different > approach. This means that with "this approach" you have to apply the decorator in every instance you want modified, that is, every time you have thi

Re: password encryption

2013-02-27 Thread Tomas Neme
and here it presses an even stronger case about NOT using bcrypt but something even slower http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html On Wed, Feb 27, 2013 at 12:33 PM, Tomas Neme wrote: > I just ran into this. It presses a pretty strong case... > > http://codahale.c

password encryption

2013-02-27 Thread Tomas Neme
I just ran into this. It presses a pretty strong case... http://codahale.com/how-to-safely-store-a-password/ -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_

Re: Object composition in django

2013-02-17 Thread Tomas Neme
There's a way to do what you want to do, but I don't remember out of the top of my head. I can check it out on the week, but you'll need to customize some things on the Producer's ModelAdmin, not just set the list of inlines, because, as it was said, inlines are for "children" objects (i.e. other o

Re: 2 projects, 2 apps, bad templates ...

2013-01-24 Thread Tomas Neme
just to clarify: somewhere else, not a subdir of any of your projects/ | ---FOOAPP/ | ---templates/ | ---fooapp/ | --mytemplate.html projectA/ | --settings.py | --urls.py | --templates/ |

Re: 2 projects, 2 apps, bad templates ...

2013-01-24 Thread Tomas Neme
> > Use virtualenvs. That's basic for any serious python development > > you'll want to do. > > Totally agree. Setting up virtualenv's are our long term goal. really, it should be your SHORT term goal. As for your problem, you can't expect to install FOOAPP in two different directories on the sam

Re: 2 projects, 2 apps, bad templates ...

2013-01-24 Thread Tomas Neme
Use virtualenvs. That's basic for any serious python development you'll want to do. Besides that, you might add DjangoProjectA to sys.path on ProjectA (and add DjangoProjectB to sys.path on ProjectB) in their respective manage.py files. On the other hand, why does pip install -e install it under

Re: Can I set a "global" variable after user login, to use in my view?

2013-01-23 Thread Tomas Neme
> I don`t understand that.. in my form, I don't have the request, or I have? > > I know I have request in my view, but I need to pass UserProfile to my form, > but inlineformset_factory doesn't accept to pass vUserProfile as parameter, > even I modified __init__ to get this parameter. OK, so you

Re: Can I set a "global" variable after user login, to use in my view?

2013-01-22 Thread Tomas Neme
ger, more complex, and more > violent. It takes a touch of genius -- and a lot of courage -- to move in > the opposite direction."* > Albert Einstein (March 14th 1879 – April 18th 1955) > > > 2013/1/22 Tomas Neme > >> >> >> what mengu says is good for templa

Re: Can I set a "global" variable after user login, to use in my view?

2013-01-22 Thread Tomas Neme
what mengu says is good for templates, but not so for views. But lo! your request should have a .user property that points to the currently logged user, so try request.user in your view On Tue, Jan 22, 2013 at 4:49 PM, Mengu wrote: > hi fellipe, > > if you enable auth context processors and

Re: l10n not loaded from base.html template

2012-12-31 Thread Tomas Neme
each template needs to {% load %} every templatetag library it uses, this is normal behavior On Mon, Dec 31, 2012 at 8:31 AM, bikeridercz wrote: > Dears, > > strange thing happens to me, {% load l10n %} is not loaded in my base.html > template, all other things like css works well. > > Thus I'm

Re: How to make django-registration use Chinese as username?

2012-12-10 Thread Tomas Neme
I *think* it should work OK, data-wise. Try changing the login/registration forms so chinese characters pass the verification process. You can start by trying with a simple CharField with no verification and see if it works. On Sun, Dec 9, 2012 at 7:49 AM, Scarl wrote: > I am a chinese user. I wa

Re: Reason for not allowing spaces in usernames?

2012-11-17 Thread Tomas Neme
> I'm puzzled with this too. Did anyone manage to find a solution to resolving > spaces in usernames. > > Generally a user, these days logs in with their email - that's predominately > how I've setup all my django projects. People don't remember usernames. It Well, I can't really agree, but whatev

Re: 1.5: syntax of AUTH_USER_MODEL

2012-10-29 Thread Tomas Neme
> Thanks, yup! I just figured it out too. I didn't realize all the "apps" are > in the path as well. the apps aren't NECESSARILY in the path. Django has a concept of app label, which is the name of the directory where the models module exists. For example, django-cms has plugins, which in order t

Re: Modernizing the Tutorial

2012-10-25 Thread Tomas Neme
> However, there is also scope for a focussed tutorial about class-based views > in general. IMHO one of the biggest uptake problems around class-based This is what I meant. Something that brings in, easy and clearly, the concept of mixins, the different mixins,something that, for example, take tw

Modernizing the Tutorial

2012-10-25 Thread Tomas Neme
Now that function-based views are being deprecated, or at least that class-based views are being favored, there should be a tutorial with them in the docs, shouldn't it? I don't mean replacing the current one, because that'd raise the entry point a lot, but cloning the original tutorial, but imple

Re: implement of view

2012-10-25 Thread Tomas Neme
>>> How can i create 2 views on one page? >>> def sql(request): and def portal(request): You can't. A View *is* a page. Do the tutorial. You could use class-based views and have a view that inherits from both, and combines the contexts (this is _not_ in the tuto) -- "The whole of Japan is pure i

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
be ANYTHING On Wed, Oct 24, 2012 at 3:03 PM, Tomas Neme wrote: > maybe restate the problem, give some more code, show your models, and > your admin files, and someone may be able to help a little > > -- > "The whole of Japan is pure invention. There is no such country, t

Re: Displaying a custom field (PickledObjectField) in the admin

2012-10-24 Thread Tomas Neme
maybe restate the problem, give some more code, show your models, and your admin files, and someone may be able to help a little -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy

Re: implement of view

2012-10-24 Thread Tomas Neme
>> Thank you for your answer. i have chapter 1-4 of >> http://www.djangobook.com/en/2.0/index.html done, but not much time to go >> throught the hole book atm. i will try it with your code. :) the django book is somewhat outdated, and long. https://docs.djangoproject.com/en/dev/intro/tutorial01/

Re: implement of view

2012-10-24 Thread Tomas Neme
> > how can i implements now these "def sql(request):" into my html code? pls > help me... > you're saying next to nothing, but I *guess* you could do something like return render_to_response("sql.html", { 'row': row }) at the bottom of your sql view, and write an sql.html template that shows it

Re: Facebook like button in django

2012-10-12 Thread Tomas Neme
> I want to create a website facebook like, but real simple and I want to have > a button that I can give to blogger to add them on their blog entries. It > have nothing to do with facebook. Ah! so you want your own "facebook button"! It'll be mostly a javascript task, rather than django-specifi

Re: Facebook like button in django

2012-10-11 Thread Tomas Neme
You should probably start by reading this: http://developers.facebook.com/docs/reference/plugins/like/ -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_(") t

Re: Making form label a href

2012-09-30 Thread Tomas Neme
> Is there some way to have the form label be a href? you'll have to change the forms templates to something like {% for field in form %} {{ field.label }} {{ field }} {% endfor %} -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde

Re: Django: language in field description in forms won't change

2012-09-22 Thread Tomas Neme
you probably are using ugettext and should be using ugettext_lazy On Sat, Sep 22, 2012 at 8:44 PM, Patrick wrote: > When I change language on my Django-powered site, everything works fine > except the translation of the field descriptions in the forms. The > description is still displayed in the

Re: OR together multiple extra clauses

2012-09-14 Thread Tomas Neme
I haven't done this, so I might be wrong, but... > queryset.extra( > where=['unaccent("table_name"."column_name"::text) LIKE > unaccent(%s)'], > params=['%%%s%%' % value] > ) first, wouldn't just setting params=[value] work? furthermore, isn't that the whole point of the p

Re: Django-admin (was: tastypie - some feedback / comments)

2012-09-12 Thread Tomas Neme
The admin templates and views themselves are convoluted enough (the price of having them work with anything), and full of enough magic that it's not really feasible to build on top of them to add the required capabilities. Maybe adding new admin views would be a posibility, but what happens when yo

Django-admin (was: tastypie - some feedback / comments)

2012-09-12 Thread Tomas Neme
Since this came up, are there any more-or-less packaged alternatives to django-admin? More than twice I've had to give up in something as simple as rendering two-level FK indirections, lest I wanted to override most of the ModelAdmin classes. The thing is that I don't trust myself to be throughout

Re: To Use or Not to Use the admin backend

2012-09-04 Thread Tomas Neme
> Anyway, to the question. Once the models, the intermediate models and > the interactions between all of them start getting sufficiently > complex, you will need to put new forms on front. Theoretically, you I've a question about this. I tried to do something like this, but using the main capabil

Re: Hard time debugging an strange problem

2012-08-31 Thread Tomas Neme
I'd like to see some of your management commands' code. It smells somewhat like you're running a shell subprocess and not waiting for it to be done before going on to the next thing -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|

Re: Full auth solution

2012-08-17 Thread Tomas Neme
> http://www.django-userena.org/ ++ I've successfully combined it with django-social-auth to have facebook/twitter/google/openId login -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny

Re: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread Tomas Neme
> But I am confused. > For example, > the following code needs to add single quote. > > {% block content %} > Add Todo items https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi also, that won't work with double quotes either, unless you import future, and a bunch of other t

Re: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread Tomas Neme
either remove the quotes from {% url 'blog.views.add_comment' %} (so it's {% url blog.views.add_comment %}) or {% load url from future %} Loading from future is the better option, I think. and for future reference: Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword argume

Re: django makemessages doesn't recognize trans in templates

2012-08-17 Thread Tomas Neme
> For example for this link > > {% trans "contacts" %} > > I have the msgstr="Contactos". I expect to see "Contactos" in the browser, > but I still see "contacts". Any suggestion? 1) case-sensitive. Are you sure you haven't translated "Contacts" instead of "contacts"? 2) fuzzy-mark. I've noticed t

Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Tomas Neme
DropDownMultiple widget http://djangosnippets.org/snippets/747/ -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_(") to help him gain world domination. --

Re: How well does South work in a team?

2012-08-16 Thread Tomas Neme
>>> Well, if you push without pulling, this might happen, >> >> *Implicit git usage* :D > > Implicit VCS usage, whichever you choose. > > If you don't, you shouldn't be doing team work ah, I see now. CVS wouldn't complain in that scenario... neither would git/hg when you pull, for that case.. yes

Re: How well does South work in a team?

2012-08-16 Thread Tomas Neme
>> Well, if you push without pulling, this might happen, > > *Implicit git usage* :D Implicit VCS usage, whichever you choose. If you don't, you shouldn't be doing team work -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_

Re: How well does South work in a team?

2012-08-16 Thread Tomas Neme
Well, if you push without pulling, this might happen, if you always pull before pushing, then you'd have to manually merge both migrations (which would probably mean letting the other migration as 001, and changing yours so it adds your wanted changes on top of THAT And as an answer: using south i

Re: New to dj: relational limitations

2012-08-15 Thread Tomas Neme
> On Tue, Aug 14, 2012 at 8:49 PM, Russell Keith-Magee > wrote: I'm just glad I didn't come back with a half-assed response -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy an

Re: Hot to use widgets with generic views

2012-08-14 Thread Tomas Neme
well, for starters, you won't magically get "on keyup" behavior by adding something on your backend, you'll need to use ajax for this, and, depending on your expected number of elements, it might be better to send everything and do any filtering on the client side (if you're handling, say, up to a

Re: multiple profile

2012-08-14 Thread Tomas Neme
Well, it depends on what you want to do exactly, you could create something like this: class UserProfile(models.Model): common_data class ClientProfile(UserProfile): specific_data class StudentProfile(UserProfile): specific_data class TeacherProfile(UserProfile): spe

Re: How to override an attribute?

2012-08-05 Thread Tomas Neme
I don't mean to say you shouldn't need to ask questions, I just say that using or not "proxy" is not a "let's see what happens" choice, and having the docs read and halfway understood will help you ask *the right* questions -- "The whole of Japan is pure invention. There is no such country, there

Re: How to override an attribute?

2012-08-05 Thread Tomas Neme
> There is a class (let's call it Foo) which is a subclass of User. > Foo has the following line in its Meta: > proxy = True if you don't provide full minimal data, it's hard for us to help. If I had known you were using a proxy model, I'd have proposed something different. In general, unless you

Re: DRYing up my forms.py

2012-08-04 Thread Tomas Neme
But if you subclass the widget, then you'll need to override every form's widget with { forms.DateField: MyDateWidget } so overriding and using your own MyDateField would be less verbose and repetitive On Sat, Aug 4, 2012 at 6:17 PM, Melvyn Sopacua wrote: > On 3-8-2012 18:23, Lee Hinde wrote:

showing a second level of indirection in an admin change_form page

2012-08-03 Thread Tomas Neme
Anyone knows of any trick that will let me show a second-level indirection inline via a one2one, so ModelA <-FK- ModelB <-one2one- ModelC, and show A, B-C-B-C-B-C kind of thing? Maybe I can override the get_formsets in the admin? -- "The whole of Japan is pure invention. There is no such countr

Re: Noob question

2012-08-02 Thread Tomas Neme
as Kurtis says, drop the explicit Primary Keys, and drop the hungarian notation as well (don't declare the variable type on it's name): I don't need to be reminded that the name of a project will be a string, it's pretty obvious. Also, python standards talk against using underscore in class names,

Re: returning a zip file for download

2012-08-01 Thread Tomas Neme
OK, I got it working, I'm not sure what the problem was, but calling the loop variable 'file' was overriding the python default file object class now I'm doing this: response = HttpResponse(File(file(tmp[1])), mimetype="application/zip") response['Content-disposition'] = ('attachm

returning a zip file for download

2012-07-31 Thread Tomas Neme
Down here's the code in which I'm creating a zip file with a bunch of pdf labels, and returning it on the HttpResponse for the user to DL it. The weird thing is that I'm getting just a pdf file (ok, I'm testing with a single file, so I don't know if that's the problem) and I can't set the download

Re: Dynamic forms

2012-07-30 Thread Tomas Neme
Just to be clear, sandeep, jQuery is not java, javascript is not java. Get yourself clear on that, because it can become a big confusion. Besides that, yes, without javascript, the only way you've got to do that, is having the user submit a form where he selects the options, and then return anothe

Re: access the state of a Model object prior to it's modification ?

2012-07-30 Thread Tomas Neme
uhm, if you register a listener to the pre_save signal, then you can do this: if instance.published: # the instance about to be saved has the published flag on dbojb = MyModel.objects.get(id=instance.id) # did it have it on the database? if not dbobj.published: do_stuff() you probab

Re: Variable # of fields in a form

2012-07-30 Thread Tomas Neme
maybe this will help? https://docs.djangoproject.com/en/dev/ref/templates/builtins/#regroup On Mon, Jul 30, 2012 at 5:06 AM, Alex Strickland wrote: > On 2012/07/25 12:41 PM, Daniel Roseman wrote: > >> You could probably subclass the CheckboxSelectMultiple widget and >> override the `render` metho

Re: Is there a way to use 'request.user' in a custom template tag without an inclusion tag?

2012-07-29 Thread Tomas Neme
> > class EditableNode(template.Node): > def __init__(self, location_name): > self.location_name = location_name.encode('utf-8').strip("'") > def render(self, context): > obj = Placeholder.objects.filter(location=self.location_name) > if request.user.is_authenticated(): > for x in obj: > return

Re: REMOVE ME

2012-07-29 Thread Tomas Neme
I'm very sorry. I got completely out of line. It's just something that irritates me a lot, and I'm not a native english speaker, and it may be I don't know the actual "value" of the word, I felt it was more funny than insulting. And I hadn't read your first reply. It won't happen again. -- "The

Re: Can i use django book

2012-07-28 Thread Tomas Neme
While the things on the djangobook are probably still compatible, they're far of being best practices nowadays, and will lead you down old and abandoned roads, more times than not. As it's been said, I'd rather stay by the official docs, they're very clear and pretty helpful, not purely technical

Re: ignore field during form validation

2012-07-26 Thread Tomas Neme
> class Form(forms.Form): > > check = forms.BooleanField( > required=False, > ) > # take into account only when 'check' is True > len = forms.IntegerField( > min_value=3, > max_value=5, > required=True, > ) > > > What I want is to validate the 'le

Re: 'QuerySet' object has no attribute '_meta' ... but I'm not using a QuerySet!

2012-07-26 Thread Tomas Neme
The ArtworkForm AND the full view code would be helpful, yes also, maybe you'll want to install django-extensions, werkzeug, and run your devserver with runserver_plus, that'll give you full debugging capabilities on your browser, and will be able to see what's each object (that instace object, sp

Re: ManyToMany relationship with intermediate model and admin list display with each realtion with value as diferent column

2012-07-24 Thread Tomas Neme
> as shown in the picture, this i could do by add a method in the model > getTienda1 and return the stock and do it for each store, but i want it to > be created dinamically because the user could create a new store and it will > not be there. > > so this is my cuestion: can i do that? Interesting

Re: How To Display Non-Modal Popup From Resulting Asynchronous Javascript Request

2012-07-24 Thread Tomas Neme
> The current URL, mediahelp/comphelp/mediaHelpPopup.html, didn't match any of > these. > > The code from the comphelp url view is very basic and looks like this: > def component_help(request): > view = "component_help" > dctnry = {} > reqGET = request.GET.copy() > if reqGET.has_key

Re: How To Display Non-Modal Popup From Resulting Asynchronous Javascript Request

2012-07-23 Thread Tomas Neme
your error's got nothing to do with AJAX. As the very helpful error message you're getting, there's no URL that matches your requested path: > Request URL: > > http://127.0.0.1:8000/mediahelp/mediaHelpPopup.html > > Using the URLconf defined in streamingmedia.urls, Django tried these URL > patter

Re: How is the label_tag's attrs parameter supposed to specified?

2012-07-20 Thread Tomas Neme
{% for field in form %} {{ field.label }}{{ field }} {% endfor %} although I think the custom form class is not such a bad solution -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny.

Re: Boolean always returns False?

2012-07-20 Thread Tomas Neme
why do you have your own User model? Are you sure you're logging in the right user and loading the right user instance? On Fri, Jul 20, 2012 at 12:37 PM, Sithembewena Lloyd Dube wrote: > Hi everyone, > > I have a user model in which i have a newsletter boolean field. When the > user subscribes to

Re: Can a method call inside save() display its return on template?

2012-07-20 Thread Tomas Neme
You can still do self.something = foobar even if "something" is not a database Field. What I mean is, doing self.vdr_code = get_vdr_code() will save it for THIS INSTANCE and then you can use it in your template. If you really need this to be only at .save() (instead of, say, at __init__, because

Re: Query with 3 models

2012-07-19 Thread Tomas Neme
> Thanks, the first example is exactly that i want. I try it in the Django > Shell and it works, but; How I show the results in the template? > > Maybe I'm wrong, but I try to pass like { 'empresas': > Empresa.objects.all().select_related() } ,and only can show the 'Empresa' > attributes on the lo

Re: Can a method call inside save() display its return on template?

2012-07-19 Thread Tomas Neme
> In my models.py I override the save method like this: > > def save(self, *args, **kwargs): > self.directiondb = get_direction_db(self.nod_id1.id, > self.nod_id2.id) > get_direction_descr(self.nod_id1.id, self.nod_id2.id) > get_vrd_code(self.nod_id1.id, self.nod_id2.id) >

Re: Query with 3 models

2012-07-19 Thread Tomas Neme
> {Empresa1, Sucursal1, Platillo1, Horario1}, > {Empresa1, Sucursal1, Platillo2, Horario1}, > {Empresa2, Sucursal1, Platillo1, Horario1}... I'm guessing the Sucursal1 in the first and third lines are not the same? I mean, each Sucursal points to only one Empresa, so I'm guessing you want only the

Re: one field of modelForm doesn't being displayed

2012-07-18 Thread Tomas Neme
> You could override your ModelForm's save() method to save some data to that > field. And then modify the same ModelForm to exclude that field. For example, or maybe, just maybe, he might show us his model, form, and rendered html so we can actually help him identify and possibly fix his problem

Re: Prepopulating a contact form

2012-07-18 Thread Tomas Neme
user = request.user initial = {} if user.is_authenticated: initial.update({ 'name': user.name, 'email_address': user.email_address }) form = MyContactForm(initial=initial) On Wed, Jul 18, 2012 at 11:23 AM, Sithembewena Lloyd Dube wrote: > Hi everyone, > > I have a contact form in my app and w

Re: Tutorial question

2012-07-17 Thread Tomas Neme
> Do these just get stuck onto the end of my class Poll(models.Model):? like > this... Yes, that's right perhaps you should start here: http://docs.python.org/tutorial/classes.html you should probably at least be comfortable enough with python to know how to define classes before diving into dj

Re: Directory indexes are not allowed here. for Grappilli

2012-07-17 Thread Tomas Neme
On Mon, Jul 16, 2012 at 2:56 PM, Dott. Tegagni Alessandro wrote: > > write the urls.py code and var. static in settings.py, please. do as he says. Also you could try asking the grapelli user group, if there is one, this seems to be specific -- "The whole of Japan is pure invention. There is no

Re: satchmo and django-admin-tools

2012-07-16 Thread Tomas Neme
> thanks for sharing, I'll try to understand it. > > where should I put this file? inside localsite? > > what admin template are you talking about? the admin tools or the plain > admin? dashboard's (it's part of admin_tools) admin/index template. > I thought of using the admin tools templates and

Re: satchmo and django-admin-tools

2012-07-16 Thread Tomas Neme
> I thought they extended the templates instead of trying to replace > everything they don't replace everything. But the admin site's index template is called 'admin/index.html', so it's not easy to extend them. They DO extend admin/base.html. This is my dashboard.py file, where I create a modul

Re: Is Tutorial / Part 4 wrong? (or is it me?)

2012-07-16 Thread Tomas Neme
It's the second time this issue appears in the list in two weeks, maybe it's time to recheck the tutorial? There's no "polls" in your results' url, doesn't the tutorial say you should have two urls file? one in project/urls.py and another one in polls/urls.py ? the polls-specific urls shouldn't s

Re: satchmo and django-admin-tools

2012-07-16 Thread Tomas Neme
Yes, you'll need to get your hands dirty, and merge the two admin templates, since both apps redefine templates/admin/index.html and some other templates. The best approach, I think, is just use django-admin-tools' templates and create custom dashboard/modules to duplicate satchmo's templates' beh

Re: ajax loading html

2012-07-14 Thread Tomas Neme
On Sat, Jul 14, 2012 at 2:11 PM, ledzgio wrote: > If I use the TemplateViews method, should I have to set anything on the > views.py? and how can I point that file from template? the TemplateView is a view, it's already been written for you, so you can use it without adding anything new. If you w

Re: ajax loading html

2012-07-14 Thread Tomas Neme
an "html page" can't be located within the templates directory, an HTML file might, but what is it you want to do, exactly? you want to render a static file? does it make sense going through django for this? URLs point to views, not templates, the views are which decide what templates to use (the

Re: Tasking? A fluid user experience with Uploading Media.

2012-07-14 Thread Tomas Neme
Well, first of all, you're gonna have to set up quite a big amount of parallel connections for this to work, > A new user could be uploading media/music files or something at the same > time as uploading a video of themselves. I want it to be efficient and fast > to the point where it all gets upd

Re: django-admin.py makemessages issue

2012-07-12 Thread Tomas Neme
"django-admin.py makemessages -l de" "django-admin.py makemessages -l es" On Thu, Jul 12, 2012 at 2:59 PM, Phil wrote: > Hi, > > (django version 1.3.1, Python2.7) > > (at the end of my settings file) > > # translation support > ugettext = lambda s: s > > LANGUAGES = ( >

Re: Error in blog

2012-07-12 Thread Tomas Neme
Have you done the django tutorial, first? it covers named urls On Thu, Jul 12, 2012 at 11:06 AM, luthur wrote: > why not post your example? It's too abstract. > > -- > luthur > > On Thursday, July 12, 2012 at 9:56 PM, jun wrote: > > > > On Thursday, July 12, 2012 7:40:46 PM UTC+8, lawgon wrote: >

Re: getting variable from __init__ into clean_xxx function

2012-07-11 Thread Tomas Neme
also this: http://docs.python.org/tutorial/classes.html On Wed, Jul 11, 2012 at 12:58 PM, Nikolas Stevenson-Molnar wrote: > Change nbi_patch to self.nbi_patch, and you should be set. I.e: > > > class PatchForm1(forms.Form): > def __init__(self, *args, **kwargs): > self.nbi_patch = kwa

Re: rendering modelForms

2012-07-10 Thread Tomas Neme
There's a way, but you'll need to touch the form on the python side quite a lot, changing the default widgets adding them the css classes you want. You can take a look at https://github.com/earle/django-bootstrap and https://github.com/dyve/django-bootstrap-toolkit/ they provide some shortcuts for

Re: masking only a small part of a template

2012-07-09 Thread Tomas Neme
http://djangosnippets.org/snippets/1376/ this is what you want, I'm using it and it works like a charm you override in templates/path/to/template.html and do {% extends "app:path/to/template.html" %}, and this loader searches in `app`'s template dir by default On Mon, Jul 9, 2012 at 3:06 AM, tW

Re: Adding a custom validation to Django's auth_user in admin

2012-07-08 Thread Tomas Neme
> Ah. I think the method is overriding the edit page. In other words, you have > click on the editpage to see the effect of my fail code. So it doesn't > trigger if you are on the list view page. Does anyone know what to do with > the editable submission? > It should use the same clean_ method, sho

Re: Model for ListView needed?

2012-07-08 Thread Tomas Neme
Oh, and setting up a queryset in a DetailView means that it won't work for instances that are not inside the queryset, if we did url(r'/books/shakespeare/(P\d+)/$', queryset=Book.objects.filter(author='shakespeare')), then /books/shakespeare/1/ would work if the book with pk=1 was Romeo and Juliet

Re: Model for ListView needed?

2012-07-08 Thread Tomas Neme
> A queryset returns a /list/ of model instances. Thus you should queryset > when you want more then one instance of the model displayed. well, slightly wrong, let's clarify. While it's true a queryset represents a list of model instances (it's not EXACTLY that, it's, more like, a partially set up

Re: urlpatterns

2012-07-08 Thread Tomas Neme
Django isn't able to guess you want your polls urls under a /poll/ path. To achieve this, you do url inclusion you define something like polls/urls.py like you did and then do url(r'^polls/', include('polls.urls')) then your defined urls will work when prepended with a polls/ path. You can chan

Re: Problem with DetailView

2012-07-08 Thread Tomas Neme
Man... > (r'^sets/(?P\d+)/$', SetDetailView.as_view( > model=Set, > context_object_name="set_details", > template_name='data/set_details.html', > )), > > But the site is empty. Here's my extremely simple template: > > {% block title %}{{ set.text_name }}{% endblock %} > > {% block

Re:

2012-07-08 Thread Tomas Neme
> No, I'm not. I didn't think I need to... the only things that are automatically included are your settings file, your site urls file, and your apps' models file, everything else depends on you (or them) to include them. For example, if you don't call admin.autodiscover() sometime soon (your site

Re:

2012-07-08 Thread Tomas Neme
Are you importing your listeners.py from anywhere? -- "The whole of Japan is pure invention. There is no such country, there are no such people" --Oscar Wilde |_|0|_| |_|_|0| |0|0|0| (\__/) (='.'=)This is Bunny. Copy and paste bunny (")_(") to help him gain world domination. -- You received t

Re: Problem with DetailView

2012-07-08 Thread Tomas Neme
> Turns out that's the problem. I wanted to use a field from my Car model: > car_id, so the link on the website would look like: > www.blablabla.com/cars/3421, where 3421 is the car_id. Unfortunately, the > car_id is not the same as . Can I achieve something like that with class what's car_id and

Re: migration via south for inheritance change -> please help

2012-07-07 Thread Tomas Neme
> and I do > for fruit in Fruits.objects.all(): fruit.rott() > > will anything happen at all? I know in C++ this would work... ;-) > > on database-level I know how to do it, I just don't know if the django > abstraction handles this automalically. I.. don't know. I'd think yes, at least I wonder o

Re: migration via south for inheritance change -> please help

2012-07-07 Thread Tomas Neme
> The big difference is, -as I see it- I will not get real polymorphism, > as the base class would need to do the join on all it's child classes. > Is that true? with abstract models you won't get polymorphism at all, in the database level (this is, you WON'T be able to do Fruit.objects). You'

Re: Returning nothing from a view

2012-07-06 Thread Tomas Neme
Just return an empty response, with a 200 OK code: return HttpResponse("") I'm not sure whether you can omit the "" On Fri, Jul 6, 2012 at 5:44 PM, Larry Martell wrote: > I have a situation where I'm sending an ajax request to a function > that updates a row in database. I then want to return c

  1   2   >