Search Results

Search found 23428 results on 938 pages for 'django related manager'.

Page 12/938 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Django templates tag error

    - by Hulk
    def _table_(request,id,has_permissions): dict = {} dict.update(get_newdata(request,rid)) return render_to_response('home/_display.html',context_instance=RequestContext(request,{'dict': dict, 'rid' : rid, 'has_permissions' : str(has_permissions)})) In templates the code is as, {% if has_permissions == "1" %} <input type="button" value="Edit" id="edit" onclick="javascript:edit('{{id}}')" style="display:inline;"/>&nbsp;&nbsp;&nbsp;&nbsp; {% endif %} There is a template error in has_permissions line. Can any 1 tell me what is wrong here. has_permissions has the value 1 or 0.

    Read the article

  • django generic view update/create: update works but create raises IntegrityError

    - by smarber
    I'm using CreateView and UpdateView directely into urls.py of my application whose name is dydict. In the file forms.py I'm using ModelForm and I'm exluding a couple of fields from being shown, some of which sould be set when either creating or updating. So, as mentioned in the title, update part works but create part doesn't which is obvious because required fields that I have exluded are sent empty which is not allowed in my case. So the question here is, how should I do to fill exluded fields into the file forms.py so that I don't have to override CreateView? Thanks in advance.

    Read the article

  • Django many to many annotations and filters

    - by dl8
    So I have two models, Person and Film where they're in a many to many relationship. My goal is to grab a film, and output the persons that have also appeared in at least 10 films. For example I can get the count individually by: >>> Person.objects.get(short__istartswith = "Matt Damon").film_set.count() 71 However, if I try to filter all the actors of a particular film out: >>> Film.objects.get(name__istartswith="Saving Private Ryan").actors.all().annotate(film_count=Count('film')).filter(film_count__gte=10) [] it returns an empty set since if I manually look at everyone's film_count it's 1, even though an actor such as Matt Damon (as seen above) has been in 71 films in my db. As you can see with this query, the annotation doesn't work: >>> Film.objects.get(name__istartswith="Saving Private Ryan").actors.all().annotate(film_count=Count('film'))[0].film_count 1 >>> Film.objects.get(name__istartswith="Saving Private Ryan").actors.all().annotate(film_count=Count('film'))[0].film_set.count() 7 and I can't seem to figure out a way to filter it by the film_set.count()

    Read the article

  • querying for timestamp field in django

    - by Hulk
    In my views i have the date in the following format s_date=20090106 and e_date=20100106 The model is defined as class Activity(models.Model): timestamp = models.DateTimeField(auto_now_add=True) how to query for the timestamp filed with the above info. Activity.objects.filter(timestamp>=s_date and timestamp<=e_date) Thanks.....

    Read the article

  • Django admin.py missing field error

    - by user782400
    When I include 'caption', I get an error saying EntryAdmin.fieldsets[1][1]['fields']' refers to field 'caption' that is missing from the form In the admin.py; I have imported the classes from joe.models import Entry,Image Is that because my class from models.py is not getting imported properly ? Need help in resolving this issue. Thanks. models.py class Image(models.Model): image = models.ImageField(upload_to='joe') caption = models.CharField(max_length=200) imageSrc = models.URLField(max_length=200) user = models.CharField(max_length=20) class Entry(models.Model): image = models.ForeignKey(Image) mimeType = models.CharField(max_length=20) name = models.CharField(max_length=200) password = models.URLField(max_length=50) admin.py class EntryAdmin(admin.ModelAdmin): fieldsets = [ ('File info', {'fields': ['name','password']}), ('Upload image', {'fields': ['image','caption']})] list_display = ('name', 'mimeType', 'password') admin.site.register(Entry, EntryAdmin) admin.site.register(Image)

    Read the article

  • Creating a QuerySet based on a ManyToManyField in Django

    - by River Tam
    So I've got two classes; Picture and Tag that are as follows: class Tag(models.Model): pics = models.ManyToManyField('Picture', blank=True) name = models.CharField(max_length=30) # stuff omitted class Picture(models.Model): name = models.CharField(max_length=100) pub_date = models.DateTimeField('date published') tags = models.ManyToManyField('Tag', blank=True) content = models.ImageField(upload_to='instaton') #stuff omitted And what I'd like to do is get a queryset (for a ListView) given a tag name that contains the most recent X number of Pictures that are tagged as such. I've looked up very similar problems, but none of the responses make any sense to me at all. How would I go about creating this queryset?

    Read the article

  • Django templates check condition

    - by Hulk
    If there are are no values in the table how can should the code be to indicate no name found else show the drop down box in the below code {% for name in dict.names %} <option value="{{name.id}}" {% for selected_id in selected_name %}{% ifequal name.id selected_id %} {{ selected }} {% endifequal %} {% endfor %}>{{name.firstname}}</option>{% endfor %} </select> Thanks..

    Read the article

  • Django - calling full_clean() inside of clean() equivalent?

    - by orokusaki
    For transaction purposes, I need all field validations to run before clean() is done. Is this possible? My thinking is this: @transaction.commit_on_success def clean(self): # Some fun stuff here. self.full_clean() # I know this isn't correct, but it illustrates my point. but obviously that's not correct, because it would be recursive. Is there a way to make sure that everything that full_clean() does is done inside clean()?

    Read the article

  • Debugging "Premature end of script headers" - WSGI/Django [migrated]

    - by Marcin
    I have recently deployed an app to a shared host (webfaction), and for no apparent reason, my site will not load at all (it worked until today). It is a django app, but the django.log is not even created; the only clue is that in one of the logs, I get the error message: "Premature end of script headers", identifying my wsgi file as the source. I've tried to add logging to my wsgi file, but I can't find any log created for it. Is there any recommended way to debug this error? I am on the point of tearing my hair out. My WSGI file: import os import sys from django.core.handlers.wsgi import WSGIHandler import logging logger = logging.getLogger(__name__) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' os.environ['CELERY_LOADER'] = 'django' virtenv = os.path.expanduser("~/webapps/django/oneclickcosvirt/") activate_this = virtenv + "bin/activate_this.py" execfile(activate_this, dict(__file__=activate_this)) # if 'VIRTUAL_ENV' not in os.environ: # os.environ['VIRTUAL_ENV'] = virtenv sys.path.append(os.path.dirname(virtenv+'oneclickcos/')) logger.debug('About to run WSGIHandler') try: application = WSGIHandler() except (Exception,), e: logger.debug('Exception starting wsgihandler: %s' % e) raise e

    Read the article

  • Disabling email-style usernames in Django 1.2 with django-registration

    - by shacker
    Django 1.2 allows usernames to take the form of an email address. Changed in Django 1.2: Usernames may now contain @, +, . and - characters I know that's a much-requested feature, but what if you don't want the new behavior? It makes for messy usernames in profile URLs and seems to break django-registration (if a user registers an account with an email-style username, the link in the django-registration activation email returns 404). Does anyone have a recipe for restoring the old behavior and disabling email-style usernames?

    Read the article

  • Does Django cache url regex patterns somehow?

    - by Emre Sevinç
    I'm a Django newbie who needs help: Even though I change some urls in my urls.py I keep on getting the same error message from Django. Here is the relevant line from my settings.py: ROOT_URLCONF = 'mydjango.urls' Here is my urls.py: from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^mydjango/', include('mydjango.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: #(r'^admin/doc/', include(django.contrib.admindocs.urls)), # (r'^polls/', include('mydjango.polls.urls')), (r'^$', 'mydjango.polls.views.homepage'), (r'^polls/$', 'mydjango.polls.views.index'), (r'^polls/(?P<poll_id>\d+)/$', 'mydjango.polls.views.detail'), (r'^polls/(?P<poll_id>\d+)/results/$', 'mydjango.polls.views.results'), (r'^polls/(?P<poll_id>\d+)/vote/$', 'mydjango.polls.views.vote'), (r'^polls/randomTest1/', 'mydjango.polls.views.randomTest1'), (r'^admin/', include(admin.site.urls)), ) So I expect that whenever I visit http://mydjango.yafz.org/polls/randomTest1/ the mydjango.polls.views.randomTest1 function should run because in my polls/views.py I have the relevant function: def randomTest1(request): # mainText = request.POST['mainText'] return HttpResponse("Default random test") However I keep on getting the following error message: Page not found (404) Request Method: GET Request URL: http://mydjango.yafz.org/polls/randomTest1 Using the URLconf defined in mydjango.urls, Django tried these URL patterns, in this order: 1. ^$ 2. ^polls/$ 3. ^polls/(?P<poll_id>\d+)/$ 4. ^polls/(?P<poll_id>\d+)/results/$ 5. ^polls/(?P<poll_id>\d+)/vote/$ 6. ^admin/ 7. ^polls/randomTest/$ The current URL, polls/randomTest1, didn't match any of these. I'm surprised because again and again I check urls.py and there is no ^polls/randomTest/$ in it, but there is ^polls/randomTest1/' It seems like Django is somehow storing the previous contents of urls.py and I just don't know how to make my latest changes effective. Any ideas? Why do I keep on seeing some old version of regexes when I try to load that page even though I changed my urls.py?

    Read the article

  • force delete row on django app after migration

    - by unsorted
    After a migration with south, I ended up deleting a column. Now the current data in one of my tables is screwed up and I want to delete it, but attempts to delete just result in an error: >>> d = Degree.objects.all() >>> d.delete() Traceback (most recent call last): File "<console>", line 1, in <module> File "C:\Python26\lib\site-packages\django\db\models\query.py", line 440, in d elete for i, obj in izip(xrange(CHUNK_SIZE), del_itr): File "C:\Python26\lib\site-packages\django\db\models\query.py", line 106, in _ result_iter self._fill_cache() File "C:\Python26\lib\site-packages\django\db\models\query.py", line 760, in _ fill_cache self._result_cache.append(self._iter.next()) File "C:\Python26\lib\site-packages\django\db\models\query.py", line 269, in i terator for row in compiler.results_iter(): File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 67 2, in results_iter for rows in self.execute_sql(MULTI): File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 72 7, in execute_sql cursor.execute(sql, params) File "C:\Python26\lib\site-packages\django\db\backends\util.py", line 15, in e xecute return self.cursor.execute(sql, params) File "C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py", line 200, in execute return Database.Cursor.execute(self, query, params) DatabaseError: no such column: students_degree.abbrev >>> Is there a simple way to just force a delete? Do I drop the table and then rerun manage.py schemamigration to recreate the table in south?

    Read the article

  • 2-step user registration with Django

    - by David S
    I'm creating a website with Django and want a fairly common 2-step user registration. What I mean by this is that the user fills in the some basic user information + some application specific information (sort of like a coupon value). Upon submit, an email is sent to ensure email address is valid. This email should contain a link to click on to "finish" the registration. When the link is clicked, the user is marked as validated and they are directed to a new page to complete optional "user profile" type information. So, pretty basic stuff. I have done some research and found django-registration by James Bennett. I do know who James is and have seen him at PyCons and DjanoCons in the past. There is obviously very few people in the world that know Django better than James (so, I know the quality of the code/app is good). But, it almost seems like a bit of over kill. I've read through the docs and was a bit confused (maybe I'm just being a bit dense today). I believe that if I do use django-registration, I will need to have some custom forms, etc. Is there anything else out there I should evaluate? Or are there any good tutorials or videos on using django-registration? I've done a bit of googling, but haven't found anything. But, I suspect that it might be a case of a lot of very common words that don't really find what you are looking for (django user registration tutorial/example). Or is just a case where it would be just about as easy to build your own solution with Django forms, etc? Here is the tech stack I'm using: Python 2.7.2 Django 1.3.1 PostgreSQL 9.1 psycopg2 2.4.1 Twitter Bootstrap 2.0.2

    Read the article

  • error in implementing static files in django

    - by POOJA GUPTA
    my settings.py file:- STATIC_ROOT = '/home/pooja/Desktop/static/' # URL prefix for static files. STATIC_URL = '/static/' # Additional locations of static files STATICFILES_DIRS = ( '/home/pooja/Desktop/mysite/search/static', ) my urls.py file:- from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^search/$','search.views.front_page'), url(r'^admin/', include(admin.site.urls)), ) urlpatterns += staticfiles_urlpatterns() I have created an app using django which seraches the keywords in 10 xml documents and then return their frequency count displayed as graphical representation and list of filenames and their respective counts.Now the list has filenames hyperlinked, I want to display them on the django server when user clicks them , for that I have used static files provision in django. Hyperlinking has been done in this manner: <ul> {% for l in list1 %} <li><a href="{{STATIC_URL}}static/{{l.file_name}}">{{l.file_name}}</a{{l.frequency_count</li> {% endfor %} </ul> Now when I run my app on the server, everything is running fine but as soon as I click on the filename, it gives me this error : Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^search/$ ^admin/ ^static\/(?P<path>.*)$ The current URL, search/static/books.xml, didn't match any of these. I don't know why this error is coming, because I have followed the steps required to achieve this. I have posted my urls.py file and it is showing error in that only. I'm new to django , so Please help

    Read the article

  • Disabling packages from the update manager

    - by asoundmove
    Hi all, I'm looking for ways to blacklist packages from being suggested for update by the update manager. Reason: gdesklets for instance works for me with v0.36.1-3, but the update manager keeps suggesting 0.36.1-4. When I use update manager, I generally just scan the list of updates and click Ok. Hoever when some packages which I want to keep at a certain version are in the middle I tend to miss them. Hence looking for a way to blacklist them for the purposes of the update manager. I have found such a blacklist to disable packages from the auto-update, but it only seems to work with auto-update (fully unattended) - the update manager still lists the package for update and ticks it by default, like all packages. Any hints as to where I could find this feature - if it exists? TIA, asm.

    Read the article

  • Oracle Access Manager 10gR3 Certified with E-Business Suite

    - by Keith M. Swartz
    Oracle Access Manager 10gR3 (10.1.4.3) is now certified for use with E-Business Suite Releases 11.5.10 and 12.1, using the new component, Oracle E-Business Suite AccessGate. For information on how to obtain, install, and configure this new component, see:Integrating Oracle E-Business Suite with Oracle Access Manager using Oracle E-Business Suite AccessGate (Note 975182.1) About Oracle Access Manager Oracle Access Manager is Oracle's next-generation identity and access management platform, and is a key component in Oracle's Fusion Middleware Identity Management solution. It provides a set of authentication and authorization features, including support for single sign-on authentication, and integration with other identity management offerings such as Oracle Identity Federation and Oracle Adaptive Access Manager.

    Read the article

  • Log in manager doesn't appear after editing /etc/X11/default-display-manager

    - by hamed
    I have ubuntu 11.10 , and I installed kde and I choosed kdm mistakly, as mentioned here I did this procedure Pretty simple. Open the file /etc/X11/default-display-manager with your editor of choice. Make sure you invoke that editor as root, otherwise it won't work. In that file there's a single line: /usr/bin/kdm Change that to /usr/bin/gdm and save the file. Reboot and you're in Gnome. now ,after booting, the log in manager gdm or kdm didn't appear . how can I fix this?

    Read the article

  • Manually activate Network Manager Applet

    - by diosney
    The issue I've is that when I connect via modem through gnome-ppp the Network Manager Applet don't detect a connection and don't let me use the configured VPNs via its interface. How Can I manually activate the Network Manager Applet? What I need is to enable the Network Manager apple in order to use the "VPN Connection" section of the GUI. When I don't have an ethernet cable connected and I connect through a modem the Network Manager applet doesn't enables itself, it is like if don't recognizes the ppp0 interface. My question is: there is a way to force the Network Manager GUI indicator to make it "alive"/"up"/"enabled" in order to use the "VPN Connections"section? Thanks in advance.

    Read the article

  • How to override a related sets "add" method?

    - by MB_
    I am working on a django project and i want to send a signal when something get's added to some models related set, e.g. we have an owner wo has a set of collectables and each time the method owner.collectable_set.add(something) is getting called i want signal like "collectable_added" or something. signals are clear to me, but in which manager(?) the "add" method sits that i want to override is unclear to me.

    Read the article

  • How to make a model instance read-only after saving it once?

    - by Ryszard Szopa
    One of the functionalities in a Django project I am writing is sending a newsletter. I have a model, Newsletter and a function, send_newsletter, which I have registered to listen to Newsletter's post_save signal. When the newsletter object is saved via the admin interface, send_newsletter checks if created is True, and if yes it actually sends the mail. However, it doesn't make much sense to edit a newsletter that has already been sent, for the obvious reasons. Is there a way of making the Newsletter object read-only once it has been saved? Edit: I know I can override the save method of the object to raise an error or do nothin if the object existed. However, I don't see the point of doing that. As for the former, I don't know where to catch that error and how to communicate the user the fact that the object wasn't saved. As for the latter, giving the user false feedback (the admin interface saying that the save succeded) doesn't seem like a Good Thing. What I really want is allow the user to use the Admin interface to write the newsletter and send it, and then browse the newsletters that have already been sent. I would like the admin interface to show the data for sent newsletters in an non-editable input box, without the "Save" button. Alternatively I would like the "Save" button to be inactive.

    Read the article

  • django internationalization doesn't work

    - by xRobot
    I have: * created translation strings in the template and in the application view. * run this command: django-admin.py makemessages -l it and the file it/LC_MESSAGES/django.po has been created * translated strings in the django.po file. * run this command: django-admin.py compilemessages and I receive: processing file django.po in /home/jobber/Desktop/library/books/locale/it/LC_MESSAGES * set this in settings.py: LANGUAGE_CODE = 'it' TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", ) USE_I18N = True MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) but.... translation doesn't work !! I always see english text. Why ?

    Read the article

  • WICD Network Manager does'nt work in 13.10

    - by Jayakumar J
    I am currently making use of a Wired Broadband, where in the default Network Manager though shows that the Auto Ethernet is connected, I was unable to browse through any websites in the browser. I had to disconnect & connect the Auto Ethernet several times in the Network Manager or restart Ubuntu to get it fixed. But following these steps is quiet annoying as this issue happens very frequently. I browsed through the internet and got to know that WICD Network Manager fixes this issue. Earlier I have been using Ubuntu 12.04 where the same issue was fixed by making use of WCID Network Manager. Recently I upgraded to 13.10 and as I got the same network issue in default Network Manager, I have installed WICD Network Manager but when I try to open WCID, I get an alert message saying, "Could not connect to wicd's D-Bus interface. Check the wicd log for error messages." When I click on OK, I get the same message again and when I click on OK again I get the following message, "Error connecting to wicd service via D-Bus.Please ensure the wicd service is running." Any help to fix this issue is greatly appreciated as this issue was annoying me since I installed 13.10

    Read the article

  • Programmatically specifying Django model attributes

    - by mojbro
    Hi! I would like to add attributes to a Django models programmatically, at run time. For instance, lets say I have a Car model class and want to add one price attribute (database column) per currency, given a list of currencies. What is the best way to do this? I had an approach that I thought would work, but it didn't exactly. This is how I tried doing it, using the car example above: from django.db import models class Car(models.Model): name = models.CharField(max_length=50) currencies = ['EUR', 'USD'] for currency in currencies: Car.add_to_class('price_%s' % currency.lower(), models.IntegerField()) This does seem to work pretty well at first sight: $ ./manage.py syncdb Creating table shop_car $ ./manage.py dbshell shop=# \d shop_car Table "public.shop_car" Column | Type | Modifiers -----------+-----------------------+------------------------------------------------------- id | integer | not null default nextval('shop_car_id_seq'::regclass) name | character varying(50) | not null price_eur | integer | not null price_usd | integer | not null Indexes: "shop_car_pkey" PRIMARY KEY, btree (id) But when I try to create a new Car, it doesn't really work anymore: >>> from shop.models import Car >>> mycar = Car(name='VW Jetta', price_eur=100, price_usd=130) >>> mycar <Car: Car object> >>> mycar.save() Traceback (most recent call last): File "<console>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/base.py", line 410, in save self.save_base(force_insert=force_insert, force_update=force_update) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/base.py", line 495, in save_base result = manager._insert(values, return_id=update_pk) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/manager.py", line 177, in _insert return insert_query(self.model, values, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/query.py", line 1087, in insert_query return query.execute_sql(return_id) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql cursor = super(InsertQuery, self).execute_sql(None) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql cursor.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) ProgrammingError: column "price_eur" specified more than once LINE 1: ...NTO "shop_car" ("name", "price_eur", "price_usd", "price_eur... ^

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >