Search Results

Search found 7702 results on 309 pages for 'django validation'.

Page 78/309 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • On-Demand thumbnail creation with django and nginx

    - by sharjeel
    I want to generate thumbnails of images on the fly. My site is built with django and deployed using nginx which serves all the static content and communicates with django/apache using reverse proxy. Right now, for every image in my site, I generate all required sizes of thumbnails on-hand and deliver them when required. The problem is that whenever I change the size of a thumbnail, I have to regenerate all of them (and they are tons). However now I'd like to generate the thumbnail the first time it is accessed and later on nginx would deliver the same file over n over. If I delete that thumbnail file because of lesser accesses, it should get generated automatically the next time. Thumbnails in my case also have watermarks which require some computation logic of my application so a webserver thumbnail module might not work very well. The size of the thumbnail can be embedded in the URL. So http://www.example.com/thumbnail/abc_320x240.jpg gets the 320x240 size of the thumbnail. The approach I'm looking right now is to let nginx lookup the file and if it doesn't exist, forward the query to my django application which would create the thumbnail and send either the response or a redirect string. However I'm not sure about the concurrency issues and any other issues which might pop up later. What is the appropriate way to achieve this?

    Read the article

  • inserting a form to session raises picklingerror - django

    - by shanyu
    I receive an exception when I add a form to the session: PicklingError: Can't pickle <class 'django.utils.functional.__proxy__'>: attribute lookup django.utils.functional.__proxy__ failed The form includes a few simple fields and has some javascript attached to a widget. It might be that Django forms cannot be pickled at all, but the exception seems to point to unicode lazy translation. To test further, I have also tried to insert only the form errors (an errordict) to the session and received the same error. I appreciate some help here, thanks in advance. EDIT: Here's why I insert a form into the session: I have an app that has a form. This form is rendered by a template tag in another app. When posted, if the form is valid, no problem, I do stuff and redirect to "next". However if it is not valid, I want to go back to the posting page to show errors. Recall that the comments app in this case redirects to an intermediate "hey, please fix the errors" page. I am trying to avoid this, and hence redirect back to the posting page with the form and its errors in the session that the template tag will render.

    Read the article

  • Django Development Environment Setup Questions

    - by Ross Peoples
    Hello, I'm trying to set up a good development environment for a Django project that I will be working on from two different physical locations. I have two Mac machines, one at home and one at work that I do most of my development on. I currently host a Ubuntu virtual machine on one of the machines to host the Django environemnt, install DropBox on it, and edit source code from my Mac. When I save the code file, the changes get synced over DropBox to the Ubuntu VM and the Django development server automatically restarts because of the change. This method has worked well in the past, but I am starting to use DropBox for a lot of other things now and don't want all of that to be downloaded on every virtual machine I use. Plus, I want to start using Eclipse + PyDev to be able to debug code and have code completion. Currently, I use TextEdit which is great, but doesn't support debugging or completion. So what are my options? I thought about setting up a Parallels VM on a thumb drive that has my entire environment on it (Eclipse included), but that has its own problems. Any other thoughts?

    Read the article

  • Django website on Apache with wsgi failing

    - by notagain
    I have a website I've built in django that I'm trying to get working on our corporate Apache server (on debian) for our intranet at my workplace. Unfortunately, Apache keeps returning server errors whenever I try to navigate to my site. Although I can navigate to the statics folder. My Apache config and wsgi script look like the following... lbirdf.wsgi import os import sys sys.path.append('/home/lbi/rdfweb/web') sys.path.append('/home/lbi/rdfweb/lbirdf') os.environ['DJANGO_SETTINGS_MODULE'] = 'lbirdf.settings_production' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() Apache config Listen 8080 <VirtualHost *:8080> ServerName server1 WSGIScriptAlias /rdfweb /home/lbi/rdfweb/web/lbirdf/apache/lbirdf.wsgi Alias /statics /home/lbi/rdfweb/web/lbirdf/statics Alias /admin_media /home/lbi/rdfweb/web/lbirdf/admin_media <Directory /home/lbi/rdfweb/web/lbirdf/apache> Order allow,deny Allow from all </Directory> <Directory /home/lbi/rdfweb/web/lbirdf/admin_media> Order allow,deny Allow from all </Directory> </VirtualHost> Any ideas on where I might be going wrong?

    Read the article

  • JavaScript cookie value can't be retrieved in Django

    - by Boris Rusev
    I am trying to build a web site in both English and Bulgarian using the Django framework. My idea is the user should click on a button, the page will reload and the language will be changed. This is how I am trying to do it: In my html I hava a the button tag <button id='btn' onclick="changeLanguage();" type="button"> ... </button> An excerpt from cookies.js: function changeLanguage() { if (getCookie('language') == 'EN') { document.getElementById('btn').innerHTML = getCookie('language'); setCookie("language", 'BG'); } else { document.getElementById('btn').innerHTML = getCookie('language'); setCookie("language", 'EN'); } } function setCookie(sName, sValue, oExpires, sPath, sDomain, bSecure) { var sCookie = sName + "=" + encodeURIComponent(sValue); if (oExpires) { sCookie += "; expires=" + oExpires.toGMTString(); } if (sPath) { sCookie += "; path=" + sPath; } if (sDomain) { sCookie += "; domain=" + sDomain; } if (bSecure) { sCookie += "; secure"; } document.cookie = sCookie; } And in my views.py file this is the situation @base def index(request): if request.session['language'] == 'EN': return """<b>%s</b>""" % "Home" else request.session['language'] == 'BG': return """<b>%s</b>""" % "??????" So I know that my JS changes the value of the language cookie but I think Django doesn't get that. On the other hand when I set and get the cookie in my Python code again the cookie is set. My question is whether there is a way to make JS and Django work together - JavaScript sets the cookie value and Python only reads it when asked and takes adequate actions? Thank you.

    Read the article

  • Django: Serving a Download in a Generic View

    - by TheLizardKing
    So I want to serve a couple of mp3s from a folder in /home/username/music. I didn't think this would be such a big deal but I am a bit confused on how to do it using generic views and my own url. urls.py url(r'^song/(?P<song_id>\d+)/download/$', song_download, name='song_download'), The example I am following is found in the generic view section of the Django documentations: http://docs.djangoproject.com/en/dev/topics/generic-views/ (It's all the way at the bottom) I am not 100% sure on how to tailor this to my needs. Here is my views.py def song_download(request, song_id): song = Song.objects.get(id=song_id) response = object_detail( request, object_id = song_id, mimetype = "audio/mpeg", ) response['Content-Disposition'= "attachment; filename=%s - %s.mp3" % (song.artist, song.title) return response I am actually at a loss of how to convey that I want it to spit out my mp3 instead of what it does now which is to output a .mp3 with all of the current pages html contained. Should my template be my mp3? Do I need to setup apache to serve the files or is Django able to retrieve the mp3 from the filesystem(proper permissions of course) and serve that? If it do need to configure Apache how do I tell Django that? Thanks in advanced. These files are all on the HD so I don't need to "generate" anything on the spot and I'd like to prevent revealing the location of these files if at all possible. A simple /song/1234/download would be fantastic.

    Read the article

  • Ajax request not receiving xml from Django

    - by amougeot
    I have a Django server which handles requests to a URL which will return some HTML for use in an image gallery. I can navigate to the URL and the browser will display the HTML that is returned, but I can't get that same HTML by doing an AJAX call (using jQuery) to the same URL. This is the view that generates the response: def gallery_images(request, gallery_name): return render_to_response('galleryimages.html', {'images': get_images_of_gallery(gallery_name)}, mimetype='text/xml') This is the 'galleryimages.html' template: {% for image in images %} <div id="{{image.name}}big"> <div class="actualImage" style="background-image:url({{image.image.name}});"> <h1>{{image.caption|safe}}</h1> </div> </div> {% endfor %} This is the jQuery call I am making: $("#allImages").load("http://localhost:8000/galleryimages/Web"); However, this loads nothing into my #allImages div. I've used firebug and ran jQuery's Ajax method .get("http://localhost:8000/galleryimages/Web") and firebug says that the response text is completely empty. When I check my Django server log, this is the entry I see for when I navigate to the URL manually, through my browser: [16/Jan/2010 17:34:10] "GET /galleryimages/Web HTTP/1.1" 200 215 This is the entry in the server log for when I make the AJAX call: [16/Jan/2010 17:36:19] "OPTIONS /galleryimages/Web HTTP/1.1" 200 215 Why does the AJAX request not get the xml that my Django page is serving?

    Read the article

  • Django | passing form values

    - by MMRUser
    I want to create a user sign up process that requires two different forms with the same data one (1st form) is for filling out the data and other one (2nd form) is for displaying the filled data as a summery (before actually saving the data) so then user can view what he/she has filled up... my problem is that how do I pass 1st form's data in to the 2nd one .. I have used the basic Django form manipulation mechanism and passed the form field values to the next form using Django template tags.. if request.method == 'POST': form = Users(request.POST) if form.is_valid(): cd = form.cleaned_data try: name = cd['fullName'] email = cd['emailAdd'] password1 = cd['password'] password2 = cd['password2'] phoneNumber = cd['phoneNumber'] return render_to_response('signup2.html', {'name': name, 'email': email, 'password1': password1, 'password2': password2, 'phone': phone, 'pt': phoneType}) except Exception, ex: return HttpResponse("Error %s" % str(ex)) and from the second from I just displayed those field values using tags and also used hidden fields in order to submit the form with values, like this: <label for="">Email:</label> {{ email }} <input type="hidden" id="" name="email" class="width250" value="{{ email }}" readonly /> It works nicely from the out look, but the real problem is that if someone view the source of the html he can simply get the password even hackers can get through this easily. So how do I avoid this issue.. and I don't want to use Django session since this is just a simple sign up process and no other interactions involved. Thanks.

    Read the article

  • Sort queryset by a generic foreign key (django)?

    - by thornomad
    I am using Django's comment framework which utilizes generic foreign keys. Question: How do I sort a given model's queryset by their comment count using the generic foreign key lookup? Reading the django docs on the subject it says one needs to calculate them not using the aggregation API: Django's database aggregation API doesn't work with a GenericRelation. [...] For now, if you need aggregates on generic relations, you'll need to calculate them without using the aggregation API. The only way I can think of, though, would be to iterate through my queryset, generate a list with content_type and object_id's for each item, then run a second queryset on the Comment model filtering by this list of content_type and object_id ... sort the objects by the count, then re-create a new queryset in this order by pulling the content_object for each comment ... This just seems wrong and I'm not even sure how to pull it off. Ideas? Someone must have done this before. I found this post online but it requires me handwriting SQL -- is that really necessary ?

    Read the article

  • Rails - Why is my custom validation being triggered for only a build command.

    - by adam
    I have a sentence and correction model with a has_one and belongs_to relationship respectively. For some reason when I do def create @sentence = Sentence.find(params[:sentence_id]) @correction = @sentence.build_correction(params[:correction]) a custom validation I wrote for Correction is being called at the build_correction point. the validation is below class Correction < ActiveRecord::Base attr_accessible :text, :sentence_id, :user_id belongs_to :sentence belongs_to :user validate :correction_is_different_than_sentence def correction_is_different_than_sentence errors.add(:text, "can't be the same as the original sentence.") if (text == self.sentence.text) end the problem is for some reason on validation the correction object doesn't have the sentence id set (despite I used the build_correction method) and so it complains "you have nil object .... while executing nil.text" in the if clause in the validation above. So my question is why is the validation occuring for a build command, i thought it only triggers on a create or update. And why isnt the sentence_id getting set?

    Read the article

  • Testing InlineFormset clean methods

    - by Rory
    I have a Django project, with 2 models, a Structure and Bracket, the Bracket has a ForeignKey to a Structure (i.e. one-to-many, one Structure has many Brackets). I created a TabularInline for the admin site, so that there would be a table of Brackets on the Structure. I added a custom formset with some a custom clean method to do some extra validation, you can't have a Bracket that conflicts with another Bracket on the same Structure etc. The admin looks like this: class BracketInline(admin.TabularInline): model = Bracket formset = BracketInlineFormset class StructureAdmin(admin.ModelAdmin): inlines = [ BracketInline ] admin.site.register(Structure, StructureAdmin) That all works, and the validation works. However now I want to write some unittest to test my complex formset validation logic. My first attempt to validate known-good values is: data = {'form-TOTAL_FORMS': '1', 'form-INITIAL_FORMS': '0', 'form-MAX_NUM_FORMS': '', 'form-0-field1':'good-value', … } formset = BracketInlineFormset(data) self.assertTrue(formset.is_valid()) However that doesn't work and raises the exception: ====================================================================== ERROR: testValid (appname.tests.StructureTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/paht/to/project/tests.py", line 494, in testValid formset = BracketInlineFormset(data) File "/path/to/django/forms/models.py", line 672, in __init__ self.instance = self.fk.rel.to() AttributeError: 'BracketInlineFormset' object has no attribute 'fk' ---------------------------------------------------------------------- The Django documentation (for formset validation) implies one can do this. How come this isn't working? How do I test the custom clean()/validation for my inline formset?

    Read the article

  • How do I use jquery validate remote validation on a field that depends on another field in the form?

    - by Kevin J
    I have a form in which I am using remote validation to check if an email address already exists in the database. However, the catch is that on this form, the user can select between several different "groups", and each group has its own distinct set of email addresses (thus the same email can exist once in each group). The group selection is a dropdown on the form, and the email address is an input field with remote validation. I have a couple issues. First, I have set up my remote rule like this: remote: { url: 'remote_script.php', data: { group_id: $('select.group_id').val() } } However, this seems to statically set the group_id parameter to whatever the first value in the select is. Meaning, if I change the select, then trigger the remote validation again, the group_id parameter does not change First, how can I make this parameter dynamic, depending on the value of a select in the form? Secondly, how do I manually trigger the remote validation on the email address field? When the group_id select is changed, I want to re-trigger the remote validation on the email address field (without changing the value of the field). I tried using $(selector).validate().element('.email_addr') But this appears to only trigger the standard validation (required, email), and not the remote call.

    Read the article

  • Should I be relying on WebTests for data validation?

    - by Alexander Kahoun
    I have a suite of web tests created for a web service. I use it for testing a particular input method that updates a SQL Database. The web service doesn't have a way to retrieve the data, that's not its purpose, only to update it. I have a validator that validates the response XML that the web service generates for each request. All that works fine. It was suggested by a teammate that I add data validation so that I check the database to see the data after the initial response validator runs and compare it with what was in the input request. We have a number of services and libraries that are separate from the web service I'm testing that I can use to get the data and compare it. The problem is that when I run the web test the data validation always fails even when the request succeeds. I've tried putting the thread to sleep between the response validation and the data validation but to no avail; It always gets the data from before the response validation. I can set a break point and visually see that the data has been updated in the DB, funny thing is when I step through it in debug with the breakpoint it does validate successfully. Before I get too much more into this issue I have to ask; Is this the purpose of web tests? Should I be able to validate data through service calls in this manner or am I asking too much of a web test and the response validation is as far as I should go?

    Read the article

  • Where to put data management rules for complex data validation in ASP.NET MVC?

    - by TheRHCP
    Hello, I am currently working on an ASP.NET MVC2 project. This is the first time I am working on a real MVC web application. The ASP.NET MVC website really helped me to get started really fast, but I still have some obscure knowledge concerning datamodel validation. My problem is that I do not really know where to manage my filled datamodel when it comes to complex validation rules. For example, validating a string field with a Regex is quite easy and I know that I just have to decorate my field with a specific attribute, so data management rules are implemented in the model. But if I have multiple fields that I need to validate which each other, for example multiple datetime that need to be correctly set following a specific time rule, where do I need to validate them? I know that I could create my own validation attributes, but sometimes validation ask a specific validation path which is to complex to be validated using attributes. This first question also leads me to a related question which is, is it right to validate a model in the controller? Because for the moment that is the only way I found for complex validation. But I find this a bit dirty and I feel it does not really fit a the controller role and much harder to test (multiple code path). Thanks.

    Read the article

  • How can I prevent a page to jump to top position after failed validation?

    - by Slauma
    I have a simple aspx page with a few TextBoxes and a submit button. Some fields are required and below the button is a ValidationSummary. The complete form is larger than screen height so one has to scroll down to reach the submit button. If I don't fill all required fields and click on submit validation fails as expected and the validation summary displays some info messages below the button. Validation happens on the client and no postback occurs. So this all works as wished. But disturbing is that the page moves ("jumps") to top position when I click on the submit button. To see the validation summary one has to move down the page again. I've tried to set the ShowSummary property to false (which doesn't make much sense): The validation still works (no postback) but in this case the page does not move to top position. So the problem seems to depend on rendering the validation texts. Is there a way to prevent this page jump? Thank you in advance!

    Read the article

  • Django rewrites URL as IP address in browser - why?

    - by Mitch
    I am using django, nginx and apache. When I access my site with a URL (e.g., http://www.foo.com/) what appears in my browser address is the IP address with admin appended (e.g., http://123.45.67.890/admin/). When I access the site by IP, it is redirected as expected by django's urls.py (e.g., http://123.45.67.890/ - http://123.45.67.890/accounts/login/?next=/) I would like to have the name URL act the same way as the IP. That is, if the URL goes to a new view, the host in the browser address should remain the same and not change to the IP address. Where should I be looking to fix this? My files: ; cpa.com (apache) NameVirtualHost *:8080 <VirtualHost *:8080> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/htm DocumentRoot /path/to/root ServerName www.foo.com <IfModule mod_rpaf.c> RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 </IfModule> <Directory /public/static> AllowOverride None AddHandler mod_python .py PythonHandler mod_python.publisher </Directory> Alias / /dj <Location /> SetHandler python-program PythonPath "['/usr/lib/python2.5/site-packages/django', '/usr/lib/python2.5/site-packages/django/forms'] + sys.path" PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE dj.settings PythonDebug On </Location> </VirtualHost> ; ; ports.conf (apache) Listen 127.0.0.1:8080 ; ; cpa.conf (nginx) server { listen 80; server_name www.foo.com; location /static { root /var/public; index index.html; } location /cpa/js { root /var/public/js; } location /cpa/css { root /var/public/css; } location /djmedia { alias "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"; } location / { include /etc/nginx/proxy.conf; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080; } } ; ; proxy.conf (nginx) proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 500; proxy_buffers 32 4k;

    Read the article

  • File uploads and client_max_body_size in nginx + gunicorn + django

    - by carlosescri
    I need to configure nginx + gunicorn to be able to upload files greater than the default max size in both servers. My nginx .conf file looks like this: server { # ... location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 60; proxy_pass http://localhost:8000/; } } The idea is to allow requests of 20M for two locations: /admin/path/to/upload?param=value /installer/other/path/to/upload?param=value I've tried to add location directives at the same level than the one I've pasted here (getting 404 errors) and also tried to add them inside the location / directive (getting 413 Entity Too Large errors). My location directives look like these in their simplest form: location /admin/path/to/upload/ { client_max_body_size 20M; } location /installer/other/path/to/upload/ { client_max_body_size 20M; } But they don't work (actually I tested lots of combinations and I'm desperate thinking about this. Please, help If you can: What settings do I need to set to make this work? Thank you so much!

    Read the article

  • permission errors with python/django

    - by tipu
    Error can be seen here: http://djaffry.selfip.com:8080/ If i go to the folder /srv/twingle/search and do ls -l I get -rwxrwxrwx 1 root root 65142784 May 26 20:28 words.db I gave it 777 access (absolutely unsafe, I know, but I thought it would atleast work) any idea what can be the permissions problem? Edit: A very strange problem is that the code doesn't crash once every few refreshes.. then goes back to crashing

    Read the article

  • Is windows a "second class citizen" in the django community?

    - by Daniel Upton
    I'm currently doing R&D for a web application which we plan to host ourselves initially and then allow customers to self host. My task has been evaluating web frameworks to see which would give us the biggest productivity initially and ease of maintence while also allowing us to easily support deployment to customer controlled environments. Our team has experience with ASP.NET (MVC and Webforms) and Ruby on Rails. Our experience with rails is that windows deployment is a very taboo subject and any questions on IRC or SO are met with knee jerk "why not linux" responses.. However in this case our target market may be running windows or linux servers. Is this also the case in django land? Is it possible with rubbish performance? Is it possible with lost of pain? Is it seen as reasonable and not treated as a completely stupid idea for not wanting to run linux?

    Read the article

  • Django templates crashes with no sense

    - by user233323
    Hello I'm trying to use google visualization API along with django templates system. I got an error that don't know how to fix. The error is the following: invalid_block_tag raise self.error(token, "Invalid block tag: '%s'" % command) django.template.TemplateSyntaxError: Invalid block tag: 'endfor' The code is: function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('date', 'time'); data.addColumn('number', 'x'); data.addColumn('number', 'y'); data.addColumn('number', 'z'); data.addRows([ {% for d in datos &} [new Date({{d.instante|date:"Y, m, d, H, i, s"}}), {{d.x}}, {{d.y}}, {{d.z}}] {% if not forloop.last %},{% endif %} ]); {% endfor %} var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); chart.draw(data, {displayAnnotations: true}); } Thanks you all!

    Read the article

  • Django ORM: Ordering w/ aggregate functions — None special treatment

    - by deno
    Hi, I'm doing query like that: SomeObject.objects.annotate(something=Avg('something')).order_by(something).all() Now, I normally have an aggregate field in my model that I use with Django signals to keep in sync, however in this case perfomance isn't an issue so I thought I'd keep it simple and just use subqueries. This approach, however, presented an unexpected issue: It all works grate if aggregate function results are like this: [5.0, 4.0, 6.0 … (etc, just numbers)] However if you mix in some Nones than it's being ordered like this: [None, 5.0, 4.0 …] The issue is that None has higher value than any number, while it should have value at most of 0. I'm using PostgreSQL and haven't tested w/ other DBs. I haven't actually checked what query is generated etc. I worked it around by just sorting in memory: sorted(…, key=lambda _:_.avg_rating if _.avg_rating is not None else 0) So I'm just curious if you know a way to do it w/ just Django ORM. Perhaps .where? or something… Kind regards

    Read the article

  • Best practice for Python & Django constants

    - by Dylan Klomparens
    I have a Django model that relies on a tuple. I'm wondering what the best practice is for refering to constants within that tuple for my Django program. Here, for example, I'd like to specify "default=0" as something that is more readable and does not require commenting. Any suggestions? Status = ( (-1, 'Cancelled'), (0, 'Requires attention'), (1, 'Work in progress'), (2, 'Complete'), ) class Task(models.Model): status = models.IntegerField(choices=Status, default=0) # Status is 'Requires attention' (0) by default. EDIT: If possible I'd like to avoid using a number altogether. Somehow using the string 'Requires attention' instead would be more readable.

    Read the article

  • Django deployment: PIL and virtualenv problem

    - by AndriJan
    Hey guys, I'm deploying a Django site on my Vserver (Debian Lenny) and I'm having problem with PIL. I'm using virtualenv as well. When I'm in the virtualenv and type pip install -U PIL everything installs fine and I get this: *** TKINTER support not available --- JPEG support available --- ZLIB (PNG/ZIP) support available *** FREETYPE2 support not available *** LITTLECMS support not available And when I go in to the shell (python manage.py shell) and type from PIL import Image I get no error. But when I use it in the Django project (uploading an image in the admin for example) I just get No module named PIL I don't think it's a problem with the model because it works fine on the development machine but here is part of the class: class Category(models.Model): name = models.CharField(max_length=255, verbose_name="Name") logo = models.ImageField(upload_to='images/category/', blank=True, null=True, verbose_name="Logo") I'm going out of my mind about this. I feel like this is a very common issue but I've been trying to google this all day with no luck. Thanks in advance, AndriJan

    Read the article

  • django select max field from mysql when column is varchar

    - by doza
    Hi, Using Django 1.1, I am trying to select the maximum value from a varchar column (in MySQL.) The data stored in the column looks like: 9001 9002 9017 9624 10104 11823 (In reality, the numbers are much bigger than this.) This worked until the numbers incremented above 10000: Feedback.objects.filter(est__pk=est_id).aggregate(sid=Max('sid')) Now, that same line would return 9624 instead of 11823. I'm able to run a query directly in the DB that gives me what I need, but I can't figure out the best way to do this in Django. The query would be: select max(sid+0) from Feedback; Any help would be much appreciated. Thanks!

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >