Sorting by a GenericRelation Causes Result Oddities

2010-02-08 Thread Bryan Veloso
Alright, let's see if I can explain this: I have an Artist model and artists get positionally ranked. It has a GenericRelation to another model that stores scores from that ranking. I wanted to be able to sort Artists by their score using that GenericRelation. Here's an example (ran this in the

Re: New Project : Django Sites Integration

2008-04-27 Thread Bryan Veloso
Hey Mike, I can add this to the Django Plugables directory if you'd like. Let me know. :) Cheers, Bryan On Apr 27, 10:36 am, Mike H <[EMAIL PROTECTED]> wrote: > Oh, and it automatically filters the model's querysets by the current   > site. Kinda important that it does that, and I forgot to

Re: get_or_create and DoesNotExist

2008-03-31 Thread Bryan Veloso
Sure thing Bruno, Model: http://dpaste.com/hold/42454/ Flickr Importer: http://dpaste.com/hold/42455/ I think that's all that's involved. Cheers, Bryan On Mar 31, 1:22 pm, "Bruno Tikami" <[EMAIL PROTECTED]> wrote: > Hi Bryan, > > would you post your model and view code too? As you didn't

get_or_create and DoesNotExist

2008-03-31 Thread Bryan Veloso
Hi all, I mostly just need a tap in the right direction for this one. I'm sure I'm missing something that's obvious. Anyway, I'm trying to run django- syncr, and it's telling me that "Photo matching query does not exist." But if it doesn't exist, shouldn't it create it? I'm thinking that

Re: Django hosting website

2008-03-24 Thread Bryan Veloso
>Lots more flexibility, but when things break its your fault. Well at least you're able to rebuild instead of begging customer service to do it for you. I'll definitely submit my +1 for Slicehost. -Bryan --~--~-~--~~~---~--~~ You received this message because you

Re: Slug (w/o using SlugField) Problems

2007-07-06 Thread Bryan Veloso
> You might need to adopt a different approach to URL construction that is > reversible (writing your own version of slugify, possibly?). Thanks for the help Malcolm. Using Jeff Croft's "I'm not a programmer" excuse, would it be too much trouble to request a small example of a reversible

Slug (w/o using SlugField) Problems

2007-07-06 Thread Bryan Veloso
Alright, well let me get the information out of the way first: models.py -- char_id = models.IntegerField('Character ID', primary_key=True) name= models.CharField('Name', maxlength=90) def get_absolute_url(self):

Re: Cross Importing Model Problem

2007-07-05 Thread Bryan Veloso
Oh also, I thought OneToOneFields were discouraged in favor of ForeignKeys with unique=True as per http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Cross Importing Model Problem

2007-07-05 Thread Bryan Veloso
Thanks for the help guys. Splitting the models up was mostly a cosmetic thing for the admin, but these problems quickly kicked me out of that state. Anyway, yes, the database design is really bad, mostly because that's not what the game developers are experts at unfortunately.

Cross Importing Model Problem

2007-07-04 Thread Bryan Veloso
I don't know if this is even possible, since I've had so many errors thrown at me, but I wanted to ask here so I can get a clear picture. I have 2 models for an MMORPG control panel I'm building. Each set of data is within it's own app with related models, etc. So here's my example. It's run off

Re: Random string template tag

2007-07-03 Thread Bryan Veloso
> If you want to hardcode the availability of the 'classes' variable in > every context (so you don't have to remember to define it every time), > you could write a context processor. See > django.core.context_processors for examples. That's probably what I'll need since it'll always have to be

Random string template tag

2007-07-03 Thread Bryan Veloso
I don't know if this exists or not, but I'd like to insert a tag (much like cycle) that allows the random selection of a string. I'm trying to randomly assign a class to a to simulate "random image rotator" type functionality. Something like... Any ideas?

Re: Password Logistics Help Needed

2007-06-28 Thread Bryan Veloso
> The original poster suggested adding a field called password_md5 to a > model that is an extension of User. It was never indicated that such a > field already existed. Ah, my bad. I misinterpreted. --~--~-~--~~~---~--~~ You received this message because you

Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso
Alright. I tried looking in the actual source for any mention of password_md5... and it no longer exists. So I'm sure I just can't call the field. I'd have to recreate it or something correct? --~--~-~--~~~---~--~~ You received this message because you are

Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso
> The usual route I go with when trying to extend on the User model is > to create a new model and link it to the User model. For example: > > class UserExt(models.Model): > user = models.ForeignKey(User) > # ... other fields that you need here > > def __init__(self, user): >

Re: Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso
Alright, I did about 2 hours of searching today and I'm beginning to think that the above is an impossibility. Which probably means that I'm going to have to bypass Django authentication and make my own, but I don't even know where to start on that, so I'm at quite a loss. :/

Password Logistics Help Needed

2007-06-27 Thread Bryan Veloso
Long story short, I'm building a control panel + backend to an MMORPG. It runs off of a mySQL database, I used inspectdb, and all of that worked perfectly. However, now I have some duplicate data, the User model (since I'm using django-registration) and the account table of the inspected

Re: looking for calender and a message board

2007-06-23 Thread Bryan Veloso
I just found this a few minutes ago: http://code.google.com/p/beastly/ On Jun 23, 9:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If by message board you mean a forum, a la VBulletin and the like, > Zyons is the only Django one I know of:http://zyons.com/ > > As for calendar, I wasn't

Re: Ticket #3297 & Newforms Image Uploading

2007-06-23 Thread Bryan Veloso
On Jun 23, 2:41 pm, Bryan Veloso <[EMAIL PROTECTED]> wrote: > > for n in range(0, MAX_NUM_UPLOADS): > > img_manip = ImageAttachment.AddManipulator() > > img_obj = img_manip.save() > > uploaded = clean_data['img_fld%d' % n] > > obj.save_image

Re: Ticket #3297 & Newforms Image Uploading

2007-06-23 Thread Bryan Veloso
> for n in range(0, MAX_NUM_UPLOADS): > img_manip = ImageAttachment.AddManipulator() > img_obj = img_manip.save() > uploaded = clean_data['img_fld%d' % n] > obj.save_image_file(uploaded['filename'], uploaded['content']) What library did you have to import to get ImageAttachment

Re: Ticket #3297 & Newforms Image Uploading

2007-06-22 Thread Bryan Veloso
> Can't paste the code from the actual app (am under NDA) but the logic > in saving the image from form data is here: > > http://dpaste.com/12731/ The only problem with this, and probably why I'm looking to use #3297 (which actually didn't work too well anyway), is because I have as many as 15

Re: Ticket #3297 & Newforms Image Uploading

2007-06-22 Thread Bryan Veloso
> You can always write the code to process File/Image fields in the view > or just extend your form to handle them properly. I have managed to do > so either by processing in the view or extending the form. As of now, > all processing of all forms occur in the view and validation for file > and

Ticket #3297 & Newforms Image Uploading

2007-06-21 Thread Bryan Veloso
RE: http://code.djangoproject.com/ticket/3297 I'm wondering if anybody has actually used this patch for a production site. If not, then I'll put off a certain feature of my site until later. The patch is really tempting though, so I wanted to get a better outlook of experiences before taking the

Re: Hypothetical: Customizable Member Pages

2007-06-20 Thread Bryan Veloso
> Not really sure if it's a good idea to > allow users to enter arbitrary HTML code. I mean, just look at what > happened to MySpace and Friendster :) It's better to just allow users > to select from a set of predesigned templates and then allow them to > customize the CSS stylesheets. Believe

Hypothetical: Customizable Member Pages

2007-06-20 Thread Bryan Veloso
I'd like to build a site in which members have the ability to customize the look of their profile using HTML, CSS and template tags that we'd provide to the member. So, I want to know if Django supports this or not, as well as how difficult it would be to implement. Best case scenario would be a

Re: Development times

2007-06-20 Thread Bryan Veloso
I've only developed two sites, a blog and a dynamic scoreboard, having no prior python experience. The blog took about 4 weeks, with a lot of help, and it's still not done due to some limitations I've hit with the framework (or limitations in my own knowledge). The scoreboard I just finished an

Re: SelectDateWiget Problem

2007-06-20 Thread Bryan Veloso
I was looking through the code today and saw this: http://code.djangoproject.com/browser/django/trunk/django/newforms/extras/widgets.py def value_from_datadict(self, data, name): y, m, d = data.get(self.year_field % name), data.get(self.month_field % name),

Re: SelectDateWiget Problem

2007-06-18 Thread Bryan Veloso
Yep, the other fields are populated correctly. My Form: class ProfileForm(forms.Form): name= forms.CharField(required=False) avatar = forms.Field(widget=forms.FileInput, required=False) photo = forms.Field(widget=forms.FileInput, required=False)

SelectDateWiget Problem

2007-06-18 Thread Bryan Veloso
birthday= forms.DateField(widget=SelectDateWidget(years=range(today.year, 1900,-1)), required=False) I have this in my forms.py, and it defaults to January 1, 2007. So, I set my birthday, save, come back and it's back to that default, so if I were to save the form without changing that

Re: Uploading Image, Marking a Field as True

2007-06-10 Thread Bryan Veloso
> I think you need to work on your workflow a little more. You will > definitely need to play with views; I'm not sure what you think > signals will acheive. > > You need to think in terms of "what HTML pages can I present to the > user, in what order; and what conditions must be met to move from

Uploading Image, Marking a Field as True

2007-06-06 Thread Bryan Veloso
Alright, example model: # Baseball baseball = models.PositiveIntegerField('Baseball Skill Level', blank=True, null=True, maxlength=4) baseball_approved = models.BooleanField('Approved', default=False) baseball_proof = models.ImageField('Proof', upload_to="/images/proof/ baseball",

Re: QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso
> This will grab _all_ score objects, and sort them by baseball score. > If there isn't a baseball score, then 'baseball' will have a value of > None, which is still a sortable value. Alright, so just to be safe, I really shouldn't be showing the values for all players, since that risks showing

Re: QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso
> Score.objects.order_by('-baseball') > > will return all the objects in reverse order. Does this only grab the baseball scores? Or grabs all of them and THEN sorts them by score? (Just for future reference.) > However, it looks like your table is intended to be at least partially > sparse

QuerySet Question - Selecting a Single Field

2007-06-05 Thread Bryan Veloso
Alright, new problem for you guys. Here's an example model in an app called "scores", which contains all the scores for a particular player: # Baseball baseball= models.PositiveIntegerField('Baseball Skill Level', blank=True, null=True, maxlength=4) # Bowling bowling

Re: MySQLdb Error

2007-05-15 Thread Bryan Veloso
It looks like you're using version 1.2.2. Try using 1.2.1_p2 and see if that works, I had a problem similiar to yours and downgrading to that version fixed my problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Feed Displaying Odd Dates

2007-05-13 Thread Bryan Veloso
That worked, -and- I learned something too! Thank you for the advice. :D Cheers, Bryan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How well should I know Python before using Django?

2007-05-10 Thread Bryan Veloso
> To use Django, a developer should have an exceptionally strong > knowledge of the following area(s) of Python: __ > > dictionaries Amen. Those things still baffle me a bit. Other than that, I'd say #1. --~--~-~--~~~---~--~~ You received

Re: Feed Displaying Odd Dates

2007-05-10 Thread Bryan Veloso
> The secret is to look in the syndication documentation and search for > the word "pubdate". There, it talks about the item_pubdate() method that > can be used to generate the date for a single item. I tried that, it'd be... def item_pubdate(self) return Entry.pub_date But it'd give me

Re: Feed Displaying Odd Dates

2007-05-08 Thread Bryan Veloso
Thanks for the help Malcom, > The feed framework looks at the attribute called "pubdate" to determine > the publication date for items. Your attribute is called "pub_date", so > ti isn't being examined. Simplest solution here is to add a pubdate() > method or property to your model that returns

Feed Displaying Odd Dates

2007-05-06 Thread Bryan Veloso
= "Bryan Veloso" author_email = "xxx" title = "Avalonstar" link = "http://avalonstar.com; description= "The latest from Avalonstar, the home of Bryan Veloso." def items(self): return Entry.objec

Re: "Complex" Views/Generic Views

2007-05-01 Thread Bryan Veloso
> In fact, that whole thread possibly has some relevance to your problem. > Note that the solution in the particular post I've highlighted works on > Python 2.3 and up, but if you are using 2.4 or later, Ned Batchelder's > post is of more than trivial relevance. So, (with my very limited python

Re: "Complex" Views/Generic Views

2007-05-01 Thread Bryan Veloso
> What you *can* do, if you're willing to be a bit adventurous, is pull > out the content you want from the different models you want, and dump > the results into one big list (a list doesn't care what types of > objects it contains). Then you can take advantage of Python's > list-sorting

"Complex" Views/Generic Views

2007-04-30 Thread Bryan Veloso
Just want to thank everybody for their help so far. :) The responses here are a lot faster than I had expected. Anyway, here's my next question. I have a blog, and I have 3 post types, regular posts (Entry), videocasts and tutorials. Now, I want to be able to have all of these grouped in

Import Errors - Development vs. Production

2007-04-29 Thread Bryan Veloso
Problems are only getting weirder for me. So I'm using a few external applications, such as django-tagging and template_utils: Now, if I am viewing my production (mod_python) admin, I have to configure INSTALLED_APPS this way in order to be clear of ImportErrors: INSTALLED_APPS = (

Dev Server - Being Denied Admin Media

2007-04-28 Thread Bryan Veloso
Permission denied: /usr/local/lib/python2.5/site-packages/django/ contrib/admin/media/ Getting this message when I'm trying to access the admin. It's odd, because I didn't do any changing of permissions. Any reason this would happen -other- than the obvious?