Authenticate problem

2016-06-17 Thread Briel
Hi I'm trying to use authenticate like the documentation shown at djangoproject, and when I try this authenticate returns None, although the user is registered, and the password is right: from django.contrib.auth import authenticate

Re: Does anyone know how to prepopulate a form with model data

2009-04-09 Thread Briel
Hi. It seems like your error and your problem is not the same. The error is complaining about the get_object_or_404, not the profile thing. So changing that code won't actually do anything as it doesn't get that far. ~Jakob On Apr 9, 3:55 am, codecowboy wrote: > I want to

Re: Details

2009-04-08 Thread Briel
Hi. When you have a problem it's great to be explicit about it so we don't have to both guess your problem and find a solution. Does your 2nd urlconf throw an error, are the urls not as expected or something else. Post tracebacks aswell if errors are thrown, makes it a lot easier to detect the

Re: Default items in a template

2009-04-06 Thread Briel
If the links are static, you could just hardcode them into the base template. That would probably be a bit faster to do, but not as flexible as a tag would be. ~Jakob On Apr 6, 7:38 pm, Alex Gaynor wrote: > On Mon, Apr 6, 2009 at 11:54 AM, koranthala

Re: Easy way to create pretty pages with nav?

2009-04-06 Thread Briel
I mostly agree with andy, getting a base template done as a static page would be a great place to start, and how you get it done is up to you and how you work best. Step 2 imo would be to add block tags the correct places. Basically you want to place your tags in such a way that you only need to

Re: Django Template Question

2009-04-06 Thread Briel
If you are trying to construct a "base" template for several views you could also use the {% if %} tags, and only show the relevant parts of the page. For example, if you wanted to display a table, but the number om columns would vary, this would enable you to only display the needed columns. On

Re: Using variable attribute as attribute to another variable

2009-04-04 Thread Briel
Hi I don't believe you can use variables within variables. What you can do is use/make a template tag that will look up in the list. Or you could make if forloop.counter == statements. Or you can make a dictionary and fx make the day_list keys And the table_list values and iterate over the key,

Re: Django model problem

2009-04-03 Thread Briel
Hi. A quick solution would be to add a datefield to the album the release date. You could then use that to find the latest and it would be updated automatically when adding new albums. You could use ot for other things as well, but I don't know your needs. Will also make the lookup a bit slower

Re: How do i use dojo in my Django application

2009-04-02 Thread Briel
Hi. The docs explain in great detail how you can serve static files like the dojo library. Take a look at it here: http://docs.djangoproject.com/en/dev/howto/static-files/ ~Jakob On 2 Apr., 14:50, Gath wrote: > All, > > I have downloaded Dojo 1.3, i want to start sampling

Re: JQuery magic in admin?

2009-04-02 Thread Briel
Hi, If you don't need the form elements themselves, as you do everything in the save method, you don't need to do anything with the form. All you need to do, is to create the visual effect, which can be done with jQuery quite easily. You could just hide the fields if you prefer them empty and

Re: Can I use Components and Classes in Django for views/controllers?

2009-04-01 Thread Briel
Hi. For the second part, it looks like you could use your own template_context_preprocessor. With it you can do stuff like creating variables for your template. Maybe this would be able to solve your problem having to send the same template vars over and over again. If you dont need view specific

Re: How to handle the Browser Close ?

2009-04-01 Thread Briel
Hi. You don't really have to log the user out, unless you are making something with very sensitive material. A lot of sites wont log you out unless you haven't been at their site for some time. One thing you could do, would be to log users out that haven't been active for x minutes/hours, but

Re: weird name error

2009-03-30 Thread Briel
Hi. You really dont give much information, when this happens traceback ect, but a wild guess would be to check your imports. ~Jakob On Mar 30, 7:04 pm, Adonis wrote: > Hello, > You will love this one, > > models.py > * > class LayersOfUsers(models.Model): >     name =

Re: pagination

2009-03-30 Thread Briel
Hi I haven't actually used django's own pagination, so I guess I can't really compare. Though working with django-pagination is really easy and it's well written. Made by the people that made pinax... ~Jakob On 30 Mar., 12:36, Konstantin S wrote: > Hello! > > I noticed

Re: Confused by attribute error

2009-03-27 Thread Briel
Hi. It would be really helpful to be able to look at your function as well. My Guess is that the problem lies there, since this is happening when you call the function. Even if the problem is within django it would be a lot easier to find when looking through your function to see what it does.

Re: How do I define choices in ChoiceField

2009-03-27 Thread Briel
Hi. Choices is a tuple/list of tuples/lists, so in your case it would look like this: (('one', 'one'), ('two', 'two')) You can't use dictionaries. ~Jakob On 27 Mar., 14:43, Joshua Partogi wrote: > Hi all, > > Let me just get straight to the point > I tried these: > label

Re: request.user in forms.py

2009-03-26 Thread Briel
Hi. You are on the wrong track trying to do it with request.user. The problem is that when you create the form, there is no request object with associated user. You need to do your stuff in the __init__.py instead, where you can create a custom, using the user object as an extra variable. I got

Re: Unit tests with live data from database.

2009-03-26 Thread Briel
Hi. Fixtures doesn't need to be 'fixed'. You can create some fresh fixtures with a db dump. However, your code shouldn't break by changing an entry, changing tables ect, might give problems, but that shouldn't be something you do everyday on a production site anyways. That said, some problems

Re: Django Admin Question

2009-03-26 Thread Briel
You can use 'list_filter' in admin.py to add which filters you want to set. so if you have a status reviewed/await review you can use that. You can also use 'search_fields' if you want to do some searching. Lastly you can use 'ordering' as well if you prefer. I would sugest you try to play around

Re: Template - Deleting last character in loop

2009-03-26 Thread Briel
You can add an if statement and check if {{ foo|lenght }} and {{ forloop.counter }} matches to find out when you have reached the end of the loop. ~Jakob On 26 Mar., 14:46, Kless wrote: > I'm building a dinamic list of links, and I want that been separated > by '|'

Re: how to show the links to tell website visitor which location he is at in django?

2009-03-26 Thread Briel
What you are asking for is called breadcrumbs. You can search google for django + breadcrumbs to find stuff about it and what others have done. One way of doing it, is explained in this blog post, it's both simple and well explained. If this is the best way, i do not know, but at least it'll get

Re: Why save on attributes is no good?

2009-03-24 Thread Briel
Hi I'm not sure exactly how this work, but. Your problem is how the data is saved and retrieved.If you do self.sm_id after the save(), you will get the id by reference, but when the model itself needs to be saved, it need the data itself, which it hasn't, or something like that Anyways, to get

Re: html greater than less than encoding problem

2009-03-23 Thread Briel
Hi. It sounds like you have run into the auto escape filter. It basically converts html tags into something viewable but not html. This is a protective matter, to protect your site from cross site scripting attacks, that can take down your site and worse. If you want to display some html from

Re: clean data

2009-03-23 Thread Briel
I'm not sure how django has built it sql injection protection, but I would guess that when you fx do model.save() or form.save() that the functions actually making the sql to the db makes sure that there are no injections by making place holders for data ect. XSS is something I do know how work,

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Briel
Hi. I haven't played much around with this kind of thing, but I would suggest that you take a look at the form widgets. One of them is called, SelectMultiple, which I bet is the one you are after, but I'm not sure if it will work with choices. You can find something about it at

Re: clean data

2009-03-23 Thread Briel
Hi I'll try to help answer your 3 Qs > 1.  what does cleaning actually do... prevent sql query injections? > Anything else? Cleaning data is not in place as a security measure, but rather to help you validate the data. That means that you can check the data and find out if it fill your

Re: Showing forms based on on selected fields

2009-03-20 Thread Briel
Hi. If you want to do anything clientside, meaning you want to react on input fields being selected or certain values being input ect you need javascript. Django can only react on data being sent or urls being asked for, not what the user is typing. Now it's not clear exactly you what it is you

Re: django choises field

2009-03-18 Thread Briel
Hi. I dont think you can get user input pn a field with choices, but then you dont really need choices if you want users to be able to input anything. Choices are used when you only want to accept certain values like a list of countries, states, or whatever. It doesn't seem like you have thought

Re: yet another unicode question...

2009-03-18 Thread Briel
Hi. I'm not sure what exactly you are doing and how/where you are displaying this stuff. But it sounds like you are escaping the html, django does this by default to protect sites from XSS attacks ect. You can either stop the auto escaping in the template or use the |safe tag. You can read about

Re: Prepopulate form from URL?

2009-03-18 Thread Briel
Hi. When you setup urls, they can have dynamic parts in them, so you dont need to use ?=, but could have an url foo/bar where your url would grab the bar and turn it into a variable. Fx if you had an url like this in your urls.py: (r'^foo/(?P\w+)/$', 'my_view_name') bar would become my_var, that

Re: How to get the root path ?

2009-03-18 Thread Briel
Hi. Instead of generating all of your urls as a base url + something, you can insteadl use the url template tag, that way you can get your url in the template more or less like this (if you use named urls): {% url user_change %} using reverse matching, django can figure out what the url needs to

Re: How to say Hello "Somebody" in a Django form. Displaying data context values as non-input.

2009-03-16 Thread Briel
First of all what you have written will most likely give syntax error, in your dict you have reversed the key and value. You probably want it to look like this: {"username": thisusername}. But you can't just throw random data at forms and hope for it to work. There are some different solutions,

Re: a little help on creating a 'global' file

2009-03-09 Thread Briel
mplate tags. That would also solve any import problems. You can read about both things in the django docs, can't give you the links right now as I'm on mobile but search for template tags or auto escape and you should hit some relevant stuff. ~Briel On 9 Mar., 19:12, Julián C. Pérez <jcp...@gmail.co

Re: Get Current User

2009-03-09 Thread Briel
You can get the current user through the request object: request.user. If that fails, you need to have if you have AuthenticationMiddleware installed probably. ~Briel On 9 Mar., 17:48, Adam Schmitz <awschm...@gmail.com> wrote: > Hey All, > > I just setup my webapp to use

Re: Overlapping date range test

2009-03-09 Thread Briel
You have a problem with your calculation, if you dont want any overlap at all. The above code will only be true when the intire range of start/end 2 is within start/end 1. what you need to check if you dont want any overlap is these two statements: (start1 <= start2 and end1 >= start2) (start1 <=

Re: a little help on creating a 'global' file

2009-03-09 Thread Briel
be to do, from myproject import globalValues as global this would give you all the functions in the globalValues file on "global", so you could do, global.ocultarEstado(...). You could change the name after "as" into anything you like. ~Briel On 9 Mar., 17:11, Julián C. Pérez <

Re: I can't decide on a migration framework

2009-03-07 Thread Briel
A fixed migration is the code run to get from one step to another. Migrations uses the, maybe at some point you needed to add an extra table to the db. Then you could write a migration that would add the table if you wanted to progress or delete the table if you wanted to get back. You would have

Re: Inserting Into Cleaned_Data Inside a ModelForm

2009-03-07 Thread Briel
When using a modelform there are some ways to get you where you want. You can get your form using request.POST. If it validates you can save it like this creating a model. record = form.save(commit=false) record.key = 123 record.save() Now, I cant remember but I believe that if you add missing

Re: Location of files that are part of my application

2009-03-03 Thread Briel
Django makes python aware of your app folder when you install the app so you can just do: from appname.resources.filename import function That should work whenever your app is propperly installed. On 3 Mar., 21:41, Jack Orenstein wrote: > I have a small number of files that

Re: AttributeError: 'str' object has no attribute '_default_manager' from related.py django 1.0.2

2009-03-02 Thread Briel
re calling on it. Why this happens and how to fix it I can't say. ~ Briel On 2 Mar., 17:11, Dan <danb...@gmail.com> wrote: > AttributeError: 'str' object has no attribute '_default_manager' from > related.py django 1.0.2 > ---get this error when >

Re: {% trans %} and {% blocktrans %} breaking auto escape

2009-02-26 Thread Briel
I have created a new ticket for this issue for those interested. The ticket number is #10369 On 27 Feb., 03:36, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Thu, 2009-02-26 at 01:11 -0800, Briel wrote: > > I stumbled upon this by accident, and after doin

{% trans %} and {% blocktrans %} breaking auto escape

2009-02-26 Thread Briel
I stumbled upon this by accident, and after doing some research on the docs, it seems that there is a flaw with the translation template tags and the auto escaping. I might have missed something or maybe it's created to do this, so I'm posting here to figure out what's going on. Anyways, the

Re: Fwd: python sql query in django

2009-02-25 Thread Briel
You have two choices. Either you can add .exclude() using the __in to avoid get the duplicates in the first place. Or you could iterate over the 3 pubs and append them to a list with an if statement. Something like this: list = [] for pub in publications123: If pub not in list:

Re: Managing over 100 static booleanfield fields Model, Form Class and so on. Profiles process

2009-02-25 Thread Briel
It's really not a good practice to ask 190 yes/no questions upon registration. A lot of the answers will most likely be random as very few would want to spend time answering 190 questions to complete a registration. My advice would be to not have that many fields. On 25 Feb., 13:02, NoviceSortOf

Re: Beginner URL question.

2009-02-20 Thread Briel
I would sugest that you look at named urls and the {% url %} template tag. That way you can generate urls with the use of args for year, month, date. On 20 Feb., 21:30, JoeG wrote: > I've tried to find this on Google but I don't know the terminology so > I don't know

Re: file validation in admin form

2009-02-20 Thread Briel
Validation is a big subject, and the validation of files can be very complex aswell. Anyways to validate you need to define a clean method in your form. Here you put the code that can test things like file types, and whatever you can think of using python. I can't get you the link as I'm not at

Re: NoReverseMatch for a named URL

2009-02-20 Thread Briel
I've seen errors like this when an url is missing a view to link to. All urls defined must have a view aswell. Start checking there else look the problem could be that you are missing args for a url tag in your template. Some reverse matching need args to fill in the dynamic part of the url, like

Re: testing validation of form in unit testing

2009-02-20 Thread Briel
You don't give a lot information about what is happening, so I'm stabbing a bit in the dark here... I would guess your problem is that you have created a form which has a filefield that is required. Even though you probably upload a file and maybe even pass it to the form, you are not doing it

Re: need help validating imagefield in modelform..

2009-02-14 Thread Briel
screen let you look at your variables. So you could see what you fx are getting when you do your photo = ... and see why it raised that error. Hope it helps Briel On 14 Feb., 10:52, PeteDK <petermoel...@gmail.com> wrote: > Hi :) > > I'm trying to validate an uploaded image's si

Re: raise ValidationError has no effect

2009-02-14 Thread Briel
I dont really get your problem, but it seems that your problem is going on in your views. When you raise a validation error the clean method should stop right there like you say it does. It's up to you to act on validation errors with stuff like is_valid() and do what you want when the form

Re: Javascript problem

2009-02-13 Thread Briel
Firefox is known to cashe things a lot, this might be the reason why it doesn't load all the stuff. Also you should look at the page source to see if the missing js file is listet. On 13 Feb., 21:14, arbi wrote: > Ok I tryed it, and they say : "test.js is not loaded" in

Re: Get old value of Field in ModelForm clean_* method?

2009-02-12 Thread Briel
Your problem is a bit unclear, but i think what you are looking for is in self.data in your clean_ method On 12 Feb., 23:56, Chris Czub wrote: > Is there any way to get the old value of a field in a clean_* method > on the ModelForm? > > That is - the validation depends on

Re: Invalid block tag: "get_comment_count"

2009-01-19 Thread Briel
Lindner <mailingli...@xgm.de> wrote: > Am 19.01.2009 um 22:04 schrieb Briel: > > > It's hard to say what's going wrong with the code you provided, but I > > can say a few things. Since you don't get an error from {% load > > comments %}, there should be no problems with

Re: POST sub dictionaries

2009-01-19 Thread Briel
validate first. If you want to know about forms in django read about it in the docs http://docs.djangoproject.com/en/dev/topics/forms/ -Briel On 19 Jan., 20:35, "Vinicius Mendes" <vbmen...@gmail.com> wrote: > Is there in django something like the PHP POST subarrays? >

Re: Invalid block tag: "get_comment_count"

2009-01-19 Thread Briel
are writing it over with an extend tag. The error hints that get_comment_count is an invalid tag, so you should test if comments is loaded probably in your template. Try loading comments directly above your tag and see what happens and take it from there. -Briel On 19 Jan., 21:01, Florian Lindner

Re: Adding a view inside a view?

2009-01-14 Thread Briel
. You could also go with the boolean field and just add the code in a view to make sure only one is True at a time. Hope this helps. -Briel On 14 Jan., 19:42, Bradley <bproct...@gmail.com> wrote: > I'm new to Django and I'm trying to modify an existing django website > for a loc

Re: the last line is plone\Python\lib\site-packages\django\db\backends\sqlite3\base.py

2009-01-14 Thread Briel
Yes, that should work. All you need is to create the db-file, and then give the name/path to it in settings.py -Briel On 14 Jan., 21:18, bconnors <bob.conn...@wdc.usda.gov> wrote: > my bad. i read that sqlite3 was supplied by python 2.5. i have python > 2.4. the base.py says sqlite

Re: Change the url

2009-01-09 Thread Briel
a read on reverse() that kip wrote about. It can get the urls for you in most cases. Good Luck with the project. -Briel On 9 Jan., 10:20, Praveen <praveen.python.pl...@gmail.com> wrote: > Hi Briel again my senior gave me other idea and they gave me a nice > reason why they wa

Re: Change the url

2009-01-08 Thread Briel
time. -Briel Praveen wrote: > Hi Briel i am totally confused now. > My senior told me to write get_absolute_url > > so i wrote get_absolute_url like this > class Listing_channels(models.Model): > list_channel = models.CharField(max_length = 20) > visibility = models.Boole

Re: Change the url

2009-01-08 Thread Briel
this: {{n.list_channel}} In the docs you can read about it at url(): http://docs.djangoproject.com/en/dev/topics/http/urls/#url naming: http://docs.djangoproject.com/en/dev/topics/http/urls/#id2 Good luck. -Briel On 8 Jan., 12:41, Praveen <praveen.python.pl...@gmail.com> wrote: > Hi Malcolm i am ver

Re: Change the url

2009-01-08 Thread Briel
in the Django Doc http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url -Briel Praveen skrev: > MODELS.py > > class Listing_channels(models.Model): > list_channel = models.CharField(max_length = 20) > visibility = models.BooleanField() > >

Re: Please help me anyone

2009-01-04 Thread Briel
way Django works. Then as you are working on actual projects, you can browse the documentation when you need to do things you do not know how to do. The Django documentation is very well written, and explains a lot things is great detail. -Briel priyankeshu skrev: > ok... i am good at html and C

Re: select childless parents, i.e. base with no derived classes in model inheritance

2008-12-30 Thread Briel
. -Briel On Dec 30, 5:23 am, pk <pks...@gmail.com> wrote: > Alex, > > First I made a mistake in the original post. The first query returns > *nothing*, not "all places". This is the correct "question: > > 1) print Place.objects.filter(restaurant__isnull=True)

Re: working with a returned object inside another class

2008-12-30 Thread Briel
Just a tip if you're not familiar with SQL, you can get django- evolution. It works with syncdb, in that syncdb will detect when an "evolution" of the db is needed like in the example above. It can't do everything, but it can do a lot if things for you, with some simple commands. A second thing.

Re: need urls help

2008-12-29 Thread Briel
A solution, not sure if it's the best, would be to make a function in basicly any file, that generates a quote. Then you can import the function to every view you want and call it to get the random quote. All you need then is to pass it to your html-file (and display it). You could just write a

Re: Writing your first Django app

2008-12-29 Thread Briel
." % poll_id. The poll_id varible is gotten from the url. -Briel johan skrev: > yes of course my bad! > > http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03 > > > > 2008/12/29 Abdel Bolanos Martinez <abdel.bola...@etecsa.cu> > > > send me