Search Results

Search found 5330 results on 214 pages for 'django auth'.

Page 88/214 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Deleting files associated with model - django

    - by alexBrand
    I have the following code in one of my models class PostImage(models.Model): post = models.ForeignKey(Post, related_name="images") # @@@@ figure out a way to have image folders per user... image = models.ImageField(upload_to='images') image_infowindow = models.ImageField(upload_to='images') image_thumb = models.ImageField(upload_to='images') image_web = models.ImageField(upload_to='images') description = models.CharField(max_length=100) order = models.IntegerField(null=True) IMAGE_SIZES = { 'image_infowindow':(70,70), 'image_thumb':(100,100), 'image_web':(640,480), } def delete(self, *args, **kwargs): # delete files.. self.image.delete(save=False) self.image_thumb.delete(save=False) self.image_web.delete(save=False) self.image_infowindow.delete(save=False) super(PostImage, self).delete(*args, **kwargs) I am trying to delete the files when the delete() method is called on PostImage. However, the files are not being removed. As you can see, I am overriding the delete() method, and deleting each ImageField. For some reason however, the files are not being removed.

    Read the article

  • What is the correct way to implement Auth/ACL in MVC?

    - by WiseStrawberry
    I am looking into making a correctly laid out MVC Auth/ACL system. I think I want the authentication of a user (and the session handling) to be separate from the ACL system. (I don't know why but this seems a good idea from the things I've read.) What does MVC have to do with this question you ask? Because I wish for the application to be well integrated with my ACL. An example of a controller (CodeIgniter): <?php class forums extends MX_Controller { $allowed = array('users', 'admin'); $need_login = true; function __construct() { //example of checking if logged in. if($this->auth->logged_in() && $this->auth->is_admin()) { echo "you're logged in!"; } } public function add_topic() { if($this->auth->allowed('add_topic') { //some add topic things. } else { echo 'not allowed to add topic'; } } } ?> My thoughts $this->auth would be autoloaded in the system. I would like to check the $allowed array against the user currently (not) logged in and react accordingly. Is this a good way of doing things? I haven't seen much literature on MVC integration and Auth. I want to make things as easy as possible.

    Read the article

  • How to setup a django site with Cherokee, DynDNS and virtual_env?

    - by e-satis
    I have a django project running with the dev server, and would like to try run it in a production environment. I wanted to try Cherokee for a change, so I installed it. We don't have a domain name yet, so I set up a DynDNS looking like stuff.gotdns.org. It works fine, I can see the Cherokee welcome page (so red, I first believed I got an error :-p). I ran the wizard to create a new virtual server for Django. No everything is setup, but I have nothing. Still the default Cherokee welcome page. What should I do now if I want to go to "http://stuff.gotdns.org" and see my website? What should I do now if I next want to make it available only at "http://project.stuff.gotdns.org"? Important fact, I use virtual_env, so your can call Python directly, you have to activate it first.

    Read the article

  • Django, wsgi, py. what's the difference?

    - by Kenny
    I'm trying to get a django application up and running on my cpanel system. I've installed mod_wsgi, and am following the guide here: http://www.nerdydork.com/setting-up-django-on-a-whm-cpanel-vps-liquidweb.html However, I'm now confused as I don't know what to do next. The application has .py files, and I am able to run it via this: python manage.py runserver 211.144.131.148:8000 However, that's via command line and binds to port 8000. I want to use Apache instead. The question is, that tutorial doesn't go further into how to get apache to recognize .py files and run the application as I want it. What do I do next?

    Read the article

  • Google App Engine (python): TemplateSyntaxError: 'for' statements with five words should end in 'rev

    - by Phil
    This is using the web app framework, not Django. The following template code is giving me an TemplateSyntaxError: 'for' statements with five words should end in 'reversed' error when I try to render a dictionary. I don't understand what's causing this error. Could somebody shed some light on it for me? {% for code, name in charts.items %} <option value="{{code}}">{{name}}</option> {% endfor %} I'm rendering it using the following: class GenerateChart(basewebview): def get(self): values = {"datepicker":True} values["charts"] = {"p3": "3D Pie Chart", "p": "Segmented Pied Chart"} self.render_page("generatechart.html", values) class basewebview(webapp.RequestHandler): ''' Base class for all webapp.RequestHandler type classes ''' def render_page(self, filename, template_values=dict()): filename = "%s/%s" % (_template_dir, filename) path = os.path.join(os.path.dirname(__file__), filename) self.response.out.write(template.render(path, template_values))

    Read the article

  • Hooking up Sproutcore frontend and custom Python backend

    - by Suvir
    Hello everyone, I am building a web-based application. The frontend has been designed in Sproutcore. For the backend, we have our own python API which handles all transactions with multiple databases. What is the best way to hook up the front-end with the back-end. AFAIK django is pretty monolithic (correct me if i am wrong) and it would be cumbersome if I dont use its native ORM...I would prefer a python-based solution..any ideas? thanks! Suvir

    Read the article

  • Why don't these class attributes register?

    - by slypete
    I have a factory method that generates django form classes like so: def get_indicator_form(indicator, patient): class IndicatorForm(forms.Form): #These don't work! indicator_id = forms.IntegerField(initial=indicator.id, widget=forms.HiddenInput()) patient_id = forms.IntegerField(initial=patient.id, widget=forms.HiddenInput()) def __init__(self, *args, **kwargs): forms.Form.__init__(self, *args, **kwargs) self.indicator = indicator self.patient = patient #These do! setattr(IndicatorForm, 'indicator_id', forms.IntegerField(initial=indicator.id, widget=forms.HiddenInput())) setattr(IndicatorForm, 'patient_id', forms.IntegerField(initial=patient.id, widget=forms.HiddenInput())) for field in indicator.indicatorfield_set.all(): setattr(IndicatorForm, field.name, copy(field.get_field_type())) return type('IndicatorForm', (forms.Form,), dict(IndicatorForm.__dict__)) I'm trying to understand why the top form field declarations don't work, but the setattr method below does work. I'm fairly new to python, so I suspect it's some language feature that I'm misunderstanding. Can you help me understand why the field declarations at the top of the class don't add the fields to the class? In a possibly related note, when these classes are instantiated, instance.media returns nothing even though some fields have widgets with associated media. Thanks, Pete

    Read the article

  • Search over multiple fields

    - by schneck
    Hi there, I think I don't unterstand django-haystack properly: I have a data model containing several fields, and I would to have two of them searched: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True, default=None) twitter_account = models.CharField(max_length=50, blank=False) My search index settings: class UserProfileIndex(SearchIndex): text = CharField(document=True, model_attr='user') twitter_account = CharField(model_attr='twitter_account') def get_queryset(self): """Used when the entire index for model is updated.""" return UserProfile.objects.all() But when I perform a search, only the field "username" is searched; "twitter_account" is ignored. When I select the Searchresults via dbshell, the objects contain the correct values for "user" and "twitter_account", but the result page shows a "no results": {% if query %} <h3>Results</h3> {% for result in page.object_list %} <p> <a href="{{ result.object.get_absolute_url }}">{{ result.object.id }}</a> </p> {% empty %} <p>No results</p> {% endfor %} {% endif %} Any ideas?

    Read the article

  • Cache for everybody except staff members.

    - by Oli
    I have a django site where I want to stick an "admin bar" along the top of every non-admin page for staff members. It would contain useful things like page editing tools, etc. The problem comes from me using the @cache_page decorator on lots of pages. If a normal user hits a page, the cached version comes up without the admin bar (even for admin users) and if an admin hits the page first, normal users see the admin bar. I could tediously step through the templates, adding regional cache blocks but there are a lot of templates, and life is altogether too short. Ideally, there would be a way of telling the caching to ignore cache get/set requests from admin users... But I don't know how to best implement that. How would you tackle this problem?

    Read the article

  • How do I prevent a ManyToManyField('self') from linked an object to itself?

    - by dyve
    Consider this model (simplified for this question): class SecretAgentName(models.Model): name = models.CharField(max_length=100) aliases = ManyToManyField('self') I have three names, "James Bond", "007" and "Jason Bourne". "James Bond" and "007" are aliases of each other. This works exactly like I want it to, except for the fact that every instance can also be an alias of itself. This I want to prevent. So, there can be many SecretAgentNames, all can be aliases of each other as long as "James Bond" does not show up as an alias for "James Bond". Can I prevent this in the model definition? If not, can I prevent it anywhere else, preferably so that the Django Admin understands it?

    Read the article

  • Removing a result from Queryset

    - by Enrico
    Is there a simple way to discard/remove the last result in a queryset without affecting the db? I am trying to paginate results in Django, but don't know the total number of objects for a given query. I was planning on using next/previous or older/newer links, so I only need to know if this is the first and/or last page. First is easy to check. To check for the last page I can compare the number of results with the pagesize or make a second query. The first method fails to detect the last page when the number of results in the last set equals the pagesize (ie 100 records get broken into 10 pages with the last page containing exactly 10 results) and I would like to avoid making a second query. My current thought is that I should fetch pagesize + 1 results from the db. If the queryset length equals 11, I know this is not the last page and I want to discard the last result in the queryset before passing the queryset to the template.

    Read the article

  • Quering distinct values throught related model

    - by matheus.emm
    Hi! I have a simple one-to-many (models.ForeignKey) relationship between two of my model classes: class TeacherAssignment(models.Model): # ... some fields year = models.CharField(max_length=4) class LessonPlan(models.Model): teacher_assignment = models.ForeignKey(TeacherAssignment) # ... other fields I'd like to query my database to get the set of distinct years of TeacherAssignments related to at least one LessonPlan. I'm able to get this set using Django query API if I ignore the relation to LessonPlan: class TeacherAssignment(models.Model): # ... model's fields def get_years(self): year_values = self.objects.all().values_list('year').distinct().order_by('-year') return [yv[0] for yv in year_values if len(yv[0]) == 4] Unfortunately I don't know how to express the condition that the TeacherAssignment must be related to at least one LessonPlan. Any ideas how I'd be able to write the query? Thanks in advance.

    Read the article

  • Passing session data to ModelForm inside of ModelAdmin

    - by theactiveactor
    I'm trying to initialize the form attribute for MyModelAdmin class inside an instance method, as follows: class MyModelAdmin(admin.ModelAdmin): def queryset(self, request): MyModelAdmin.form = MyModelForm(request.user) My goal is to customize the editing form of MyModelForm based on the current session. When I try this however, I keep getting an error (shown below). Is this the proper place to pass session data to ModelForm? If so, then what may be causing this error? TypeError at ... Exception Type: TypeError Exception Value: issubclass() arg 1 must be a class Exception Location: /usr/lib/pymodules/python2.6/django/forms/models.py in new, line 185

    Read the article

  • Saving related model objects

    - by iHeartDucks
    I have two related models (one to many) in my django app and When I do something like this ObjBlog = Blog() objBlog.name = 'test blog' objEntry1 = Entry() objEntry1.title = 'Entry one' objEntry2 = Entry() objEntry2.title = 'Entry Two' objBlog.entry_set.add(objEntry1) objBlog.entry_set.add(objEntry2) I get an error which says "null value in column and it violates the foreign key not null constraint". None of my model objects have been saved. Do I have to save the "objBlog" before I could set the entries? I was hoping I could call the save method on objBlog to save it all. NOTE: I am not creating a blog engine and this is just an example.

    Read the article

  • Is it ok to hardcode dynamic links in a permanent view?

    - by meder
    Let's say I wanted to showcase 2-3 clickable buttons on my homepage which will be there permanently. These are links to the css, html, and javascript tag listing pages. Is it fine to just hardcode href=/tags/css and href=/tags/html right in my django templates/view? I won't change them for at least a year or so, meaning I don't think I need to add a column to the tags table to distinguish them - is this common or should I try to make it somewhat dynamic? These tags are in a table but so are 1000 other tags.

    Read the article

  • Select distinct users with referrals

    - by Mark
    I have a bunch of Users. Since Django doesn't really let me extend the default User model, they each have Profiles. The Profiles have a referred_by field (a FK to User). I'm trying to get a list of Users with = 1 referral. Here's what I've got so far Profile.objects.filter(referred_by__isnull=False).values_list('referred_by', flat=True) Which gives me a list of IDs of the users who have referrals... but I need it to be distinct, and I want the User object, not their ID. Or better yet, it would be nice if it could return the number of referrals a user has. Any ideas?

    Read the article

  • Overwrite queryset which builds filter sidebar

    - by cw
    Hi, I'm writing a hockey database/manager. So I have the following models: class Team(models.Model): name = models.CharField(max_length=60) class Game(models.Model): home_team = models.ForeignKey(Team,related_name='home_team') away_team = models.ForeignKey(Team,related_name='away_team') class SeasonStats(models.Model): team = models.ForeignKey(Team) Ok, so my problem is the following. There are a lot of teams, but Stats are just managed for my Club. So if I use "list_display" in the admin backend, I'd like to modify/overwrite the queryset which builds the sidebar for filtering, to just display our home teams as a filter option. Is this somehow possible in Django? I already made a custom form like this class SeasonPlayerStatsAdminForm(forms.ModelForm): team = forms.ModelChoiceField(Team.objects.filter(club__home=True)) So now just the filtering is missing. Any ideas?

    Read the article

  • Errors in Decimal Calcs within def clean method?

    - by allanhenderson
    I'm attempting a few simple calculations in a def clean method following validation (basically spitting out a euro conversion of retrieved uk product price on the fly). I keep getting a TypeError. Full error reads: Cannot convert {'product': , 'invoice': , 'order_discount': Decimal("0.00"), 'order_price': {...}, 'order_adjust': None, 'order_value': None, 'DELETE': False, 'id': 92, 'quantity': 8} to Decimal so I guess django is passing through the entire cleaned_data form to Decimal method. Not sure where I'm going wrong - the code I'm working with is: def clean_order_price(self): cleaned_data = self.cleaned_data data = self.data order_price = cleaned_data.get("order_price") if not order_price: try: existing_price = ProductCostPrice.objects.get(supplier=data['supplier'], product_id=cleaned_data['product'], is_latest=True) except ProductCostPrice.DoesNotExist: existing_price = None if not existing_price: raise forms.ValidationError('No match found, please enter new price') else: if data['invoice_type'] == 1: return existing_price.cost_price_gross elif data['invoice_type'] == 2: exchange = EuroExchangeRate.objects.latest('exchange_date') calc = exchange.exchange_rate * float(existing_price.cost_price_gross) calc = Decimal(str(calc)) return calc return cleaned_data If the invoice is of type 2 (a euro invoice) then the system should grab the latest exchange rate and apply that to the matching UK pound price pulled through to get euro result. Should performing a decimal conversion be a problem within def clean method? Thanks

    Read the article

  • Enable export to XML via HTTP on a large number of models with child relations

    - by Vasil
    I've a large number of models (120+) and I would like to let users of my application export all of the data from them in XML format. I looked at django-piston, but I would like to do this with minimum code. Basically I'd like to have something like this: GET /export/applabel/ModelName/ Would stream all instances of ModelName in applabel together with it's tree of related objects . I'd like to do this without writing code for each model. What would be the best way to do this?

    Read the article

  • Elegant solution for multiple forms on single page

    - by NFicano
    I'm building a web application (in Django) that will accept a search criteria and display a report - once the user is satisfied with the results, save both the criteria and a reference to these objects back to the database. The problem I'm having is finding an elegant solution for having 2 forms: Display (GET) the results of their criteria. Enter in some descriptions, and save (POST) everything back to the database. I'm leaning towards AJAX for the GET stuff and a POST for the save, but I wanted to make sure there wasn't a more elegant solution first.

    Read the article

  • Indexing a method return (depending on Internationalization)

    - by Hedde
    Consider a django model with an IntegerField with some choices, e.g. COLORS = ( (0, _(u"Blue"), (1, _(u"Red"), (2, _(u"Yellow"), ) class Foo(models.Model): # ...other fields... color = models.PositiveIntegerField(choices=COLOR, verbose_name=_(u"color")) My current (haystack) index: class FooIndex(SearchIndex): text = CharField(document=True, use_template=True) color = CharField(model_attr='color') def prepare_color(self, obj): return obj.get_color_display() site.register(Product, ProductIndex) This obviously only works for keyword "yellow", but not for any (available) translations. Question: What's would be a good way to solve this problem? (indexing method returns based on the active language) What I have tried: I created a function that runs a loop over every available language (from settings) appending any translation to a list, evaluating this against the query, pre search. If any colors are matched it converts them backwards into their numeric representation to evaluate against obj.color, but this feels wrong.

    Read the article

  • Not quite nested inlines?

    - by Lynden Shields
    Not quite sure what to call this, it's not quite nested inlines, but is probably related. I have a 3 level hierarchy of objects, A one-to-many B one-to-many C. Therefore, every C implicitly also belongs to an A. class A(models.Model): stuff = models.CharField("Stuff", max_length=50) class B(models.Model): a = models.ForeignKey(A) class C(models.Model): b = models.ForeignKey(B) I would like all C's that belong to an A to be listed on the admin page for A in an in-line. They do not have to show which B they belong to on the same page. Is this possible or is it the same problem as nested inlines anyway? If it's possible, how do I do it? I'm using django 1.3

    Read the article

  • squid3 auth thru samba using ntlm to AD doesn't work

    - by derty
    some users here are spending to much time exploring the WWW. So big boss whats to get this under control. We use a squid3 just for some security reason and chace benefits. and now i'm trying to set up a new proxy on a different server (Debian 6) Permissions are defined in AC and the squid3 should get the auth thru samba/winbind by using the ntlm protocol. but i'll get all the time Access, denited. it only works by using LDAP but thats not the way i need it. here some log and confs squid access.log 1326878095.784 1 192.168.15.27 TCP_DENIED/407 4049 GET http://at.msn.com/? -NONE/- text/html 1326878095.791 1 192.168.15.27 TCP_DENIED/407 4294 GET http://at.msn.com/? - NONE/- text/html 1326878095.803 9 192.168.15.27 TCP_DENIED/403 4028 GET http://at.msn.com/? kavan NONE/- text/html 1326878095.848 0 192.168.15.27 TCP_DENIED/403 3881 GET http://www.squid-cache.org/Artwork/SN.png kavan NONE/- text/html 1326878100.279 0 192.168.15.27 TCP_DENIED/403 3735 GET http://www.google.at/ kavan NONE/- text/html 1326878100.296 0 192.168.15.27 TCP_DENIED/403 3870 GET http://www.squid-cache.org/Artwork/SN.png kavan NONE/- text/html 1326878155.700 0 192.168.15.27 TCP_DENIED/407 4072 GET http://ie9cvlist.ie.microsoft.com/IE9CompatViewList.xml - NONE/- text/html 1326878155.705 2 192.168.15.27 TCP_DENIED/407 4317 GET http://ie9cvlist.ie.microsoft.com/IE9CompatViewList.xml - NONE/- text/html 1326878155.709 3 192.168.15.27 TCP_DENIED/403 4026 GET http://ie9cvlist.ie.microsoft.com/IE9CompatViewList.xml kavan NONE/- text/html squid chace 2012/01/18 10:12:49| Creating Swap Directories 2012/01/18 10:12:49| Starting Squid Cache version 3.1.6 for x86_64-pc-linux-gnu... 2012/01/18 10:12:49| Process ID 17236 2012/01/18 10:12:49| With 65535 file descriptors available 2012/01/18 10:12:49| Initializing IP Cache... 2012/01/18 10:12:49| DNS Socket created at [::], FD 7 2012/01/18 10:12:49| DNS Socket created at 0.0.0.0, FD 8 2012/01/18 10:12:49| Adding nameserver 192.168.15.2 from /etc/resolv.conf 2012/01/18 10:12:49| Adding nameserver 192.168.15.19 from /etc/resolv.conf 2012/01/18 10:12:49| Adding nameserver 192.168.15.1 from /etc/resolv.conf 2012/01/18 10:12:49| Adding domain schoenbrunn.local from /etc/resolv.conf 2012/01/18 10:12:49| helperOpenServers: Starting 5/5 'squid_ldap_auth' processes 2012/01/18 10:12:49| helperOpenServers: Starting 10/10 'ntlm_auth' processes 2012/01/18 10:12:49| helperOpenServers: Starting 10/10 'squid_kerb_auth' processes 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| helperOpenServers: Starting 5/5 'squid_ldap_group' processes 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| squid_kerb_auth: INFO: Starting version 1.0.5 2012/01/18 10:12:49| Unlinkd pipe opened on FD 73 2012/01/18 10:12:49| Local cache digest enabled; rebuild/rewrite every 3600/3600 sec 2012/01/18 10:12:49| Store logging disabled 2012/01/18 10:12:49| Swap maxSize 0 + 262144 KB, estimated 20164 objects 2012/01/18 10:12:49| Target number of buckets: 1008 2012/01/18 10:12:49| Using 8192 Store buckets 2012/01/18 10:12:49| Max Mem size: 262144 KB 2012/01/18 10:12:49| Max Swap size: 0 KB 2012/01/18 10:12:49| Using Least Load store dir selection 2012/01/18 10:12:49| Set Current Directory to /var/spool/squid3 2012/01/18 10:12:49| Loaded Icons. 2012/01/18 10:12:49| Accepting HTTP connections at [::]:3128, FD 74. 2012/01/18 10:12:49| HTCP Disabled. 2012/01/18 10:12:49| Squid modules loaded: 0 2012/01/18 10:12:49| Adaptation support is off. 2012/01/18 10:12:49| Ready to serve requests. 2012/01/18 10:12:50| storeLateRelease: released 0 objects smb.conf # Domain Authntication Settings workgroup = <WORKGROUP> security = ads password server = <DOMAINNAME>.LOCAL realm = <DOMAINNAME>.LOCAL ldap ssl = no # logging log level = 5 max log size = 50 # logs split per machine log file = /var/log/samba/%m.log # max 50KB per log file, then rotate ; max log size = 50 # User settings username map = /etc/samba/smbusers idmap uid = 10000-20000000 idmap gid = 10000-20000000 idmap backend = ad ; template primary group = <ad group> template shell = /sbin/nologin # Winbind Settings winbind separator = + winbind enum users = Yes winbind enum groups = Yes winbind netsted groups = Yes winbind nested groups = Yes winbind cache time = 10 winbind use default domain = Yes #Other Globals unix charset = LOCALE server string = <SERVERNAME> load printers = no printing = cups cups options = raw ; printcap name = /etc/printcap #obtain list of printers automatically on SystemV ; printcap name = lpstat ; printing = cups squid.conf auth_param ntlm program /usr/bin/ntlm_auth --require-membership-of=<DOMAINNAME>\\INTERNETZ --helper-protocol=squid-2.5-ntlmssp auth_param ntlm children 10 auth_param basic program /usr/lib/squid3/squid_ldap_auth -R -b "dc=<dcname>,dc=local" -D "cn=administrator,cn=Users,dc=<domainname>,dc=local" -w "******" -f sAMAccountName=%s -h 192.168.15.19:3268 auth_param basic realm "Proxy Authentifizierung. Bitte geben Sie Ihren Benutzername und Ihr Passwort ein!" #means insert you PW in an other language - # external_acl_type InetGroup %LOGIN /usr/lib/squid3/squid_ldap_group -R -b "dc=<domainname>,dc=local" -D "cn=administrator,cn=Users,dc=<domainname>,dc=local" -w "******" -f "(&(objectclass=person)(sAMAccountName=%v) (memberof=cn=%a,cn=internetz,dc=<domainname>,dc=local))" -h 192.168.15.19:3268 auth_param negotiate program /usr/lib/squid3/squid_kerb_auth -d auth_param negotiate children 10 auth_param negotiate keep_alive on acl localnet proxy_auth REQUIRED acl InetAccess external InetGroup Internetz http_access allow InetAccess http_access deny all acl auth proxy_auth REQUIRED http_access allow auth and a very suspicious is that by adding the proxy server to the Domain i see 2 new entries in the PC one with the original computer-name leopoldine and one with leopoldine CNF:f8efa4c4-ff0e-4217-939d-f1523b43464d ?!? I tried a lot, really... but i stuck on this problem... i actually i even reinstalled all dependent programs and reconfigured them from default. Group exists and has me in it. Firefox running on the old proxy and i use IE for testing the new one. But i'll get all the time Access-Denited and to be honest i'm quite a beginner, so please don't be to prude. I'll interested in improving, i'll get the information we need to fix this but i started working 2 month ago and got only 1 1/2 year's training and not a single sec. in linux ;)

    Read the article

  • Celery tasks not works with gevent

    - by Novarg
    When i use celery + gevent for tasks that uses subprocess module i'm getting following stacktrace: Traceback (most recent call last): File "/home/venv/admin/lib/python2.7/site-packages/celery/task/trace.py", line 228, in trace_task R = retval = fun(*args, **kwargs) File "/home/venv/admin/lib/python2.7/site-packages/celery/task/trace.py", line 415, in __protected_call__ return self.run(*args, **kwargs) File "/home/webapp/admin/webadmin/apps/loggingquarantine/tasks.py", line 107, in release_mail_task res = call_external_script(popen_obj.communicate) File "/home/webapp/admin/webadmin/apps/core/helpers.py", line 42, in call_external_script return func_to_call(*args, **kwargs) File "/usr/lib64/python2.7/subprocess.py", line 740, in communicate return self._communicate(input) File "/usr/lib64/python2.7/subprocess.py", line 1257, in _communicate stdout, stderr = self._communicate_with_poll(input) File "/usr/lib64/python2.7/subprocess.py", line 1287, in _communicate_with_poll poller = select.poll() AttributeError: 'module' object has no attribute 'poll' My manage.py looks following (doing monkeypatch there): #!/usr/bin/env python from gevent import monkey import sys import os if __name__ == "__main__": if not 'celery' in sys.argv: monkey.patch_all() os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webadmin.settings") from django.core.management import execute_from_command_line sys.path.append(".") execute_from_command_line(sys.argv) Is there a reason why celery tasks act like it wasn't patched properly? p.s. strange thing that my local setup on Macos works fine while i getting such exceptions under Centos (all package versions are the same, init and config scripts too)

    Read the article

  • Using map() on a _set in a template?

    - by Stuart Grimshaw
    I have two models like this: class KPI(models.Model): """KPI model to hold the basic info on a Key Performance Indicator""" title = models.CharField(blank=False, max_length=100) description = models.TextField(blank=True) target = models.FloatField(blank=False, null=False) group = models.ForeignKey(KpiGroup) subGroup = models.ForeignKey(KpiSubGroup, null=True) unit = models.TextField(blank=True) owner = models.ForeignKey(User) bt_measure = models.BooleanField(default=False) class KpiHistory(models.Model): """A historical log of previous KPI values.""" kpi = models.ForeignKey(KPI) measure = models.FloatField(blank=False, null=False) kpi_date = models.DateField() and I'm using RGraph to display the stats on internal wallboards, the handy thing is Python lists get output in a format that Javascript sees as an array, so by mapping all the values into a list like this: def f(x): return float(x.measure) stats = map(f, KpiHistory.objects.filter(kpi=1) then in the template I can simply use {{ stats }} and the RGraph code sees it as an array which is exactly what I want. [87.0, 87.5, 88.5, 90] So my question is this, is there any way I can achieve the same effect using Django's _set functionality to keep the amount of data I'm passing into the template, up until now I've been passing in a single KPI object to be graphed but now I want to pass in a whole bunch so is there anything I can do with _set {{ kpi.kpihistory_set }} dumps the whole model out, but I just want the measure field. I can't see any of the built in template methods that will let me pull out just the single field I want. How have other people handled this situation?

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >